Android - Concepts

Updated: 2019-06-27

Android Runtime vs Dalvik VM

In Android 5.0, Android Runtime with ahead-of-time compilation replaces the Dalvik VM with just-in-time compilation introduced in Android 2.2.


NDK is for native code(C/C++), while SDK is for Java.

Bionic vs NDK

Platform code uses bionic, while third-party developers use NDK.

OpenGL ES vs Vulkan

Vulkan is the replacement of OpenGL. Android started to support Vulkan since Android N

Android App Bundle(.aab) vs Android PacKage(.apk)

  • App Bundle cannot be deployed to a device, it is an upload format(upload to play store); APK is the deploy/download format(download from play store to device).
  • Play store will auto-generate a basic APK, multiple configuration APKs and multiple dynamic feature APKs from an uploaded App Bundle
  • Android App Bundle frees the developers from building, signing, and managing multiple APKs to support different devices; users get smaller, more optimized downloads
  • Android App Bundles do not support APK expansion (*.obb) files

Google Mobile Services vs Google Play Services

Google Mobile Services refers to the pre-installed Google closed-source apps, like Google Search, Chrome, YouTube, Google Maps, etc.

Google Play Services refers to an app, which provides backend services and APIs, e.g. single sign-on, security, location services. It is confusingly under, since the internal name is gmscore

GoogleApi vs GoogleApiClient

GoogleApi is the new interface, replacing GoogleApiClient.

However the naming is confusing, e.g. FusedLocationProviderApi is based on the old GoogleApiClient, while the new GoogleApi based interfaced is called FusedLocationProviderClient.


  • AAR is a JAR, so also based on ZIP
  • APK for app modules and AAR for library moduels


Android Expansion Files


  • Obfuscator and optimizer for Java bytecode
  • ProGuard is the free version, a default tool in Android SDK, later replaced by R8
  • DexGuard is the paid version, with extra security layers on top of ProGuard


  • SQLite
  • LevelDB


Looper/Handler/Message/MessageQueue: how Android solves the problem of async programming.

How it works:

  • a Thread gets a Looper and a MessageQueue by calling Looper.prepare()
  • A Handler gets implicitly associated with the thread that instantiates it via thread's Looper
  • Handler will enqueue the Message to the MessageQueue: handler.sendMessage(msg) or
  • Looper.loop() will start an infinite loop for(;;) {}, must be called to start the associated looper.
  • Get next message from the MessageQueue: Message msg =;, this may block if the next Message is not ready to be processed.
  • pass the message to Handler to execute:, where will get the Handler
  • looper must be terminated explicitly: looper.quit()

Other notes:

  • HandlerThread: just a Thread with a Looper. A Handler needs a Looper to work.
  • the main thread is built with a Looper and Handlers. Android prevents from updating UI components from most threads. A separate thread can update the UI by using Looper and Handler. No need to lock access to UI components.
  • get Looper in the main thread: Looper.getMainLooper()
  • post to the main thread MessageQueue and execute in the main thread: new Handler(Looper.getMainLooper()).post(new Runnable() {...})


Intent and ContentProvider are higher-level abstractions of Binder


There are 2 related packages


  • Parcelable: Android's serializable
  • Parcel: a message container
  • Bundle: stores heterogeneous data(map from String to different types of Parcelable)

Android UI Toolkit

UI related packages:

  • android.widget
  • android.view


  • Main-thread, usually the UI thread
  • worker-threads: working on network access, database queries, respond to system callbacks(like button push onKeyDown()) etc.


  • AIDL is for IPC within Android Framework
  • HIDL is for IPC between HAL and Android Framework. Started from Android 8, so HAL no longer needs to recompile to adopt a new version of Android Framework. Android framework and HALs communicate with each other using Binder IPC calls.
  • Both related to Binder IPC

HIDL HALs guarantee the Android core system/platform(system.img) is backward compatible. Vendors build their images(vendor.img, boot.img) then update them independent of the platform. It is possible to have newer platform version running on the device, vendor images cannot have a newer version than the platform.


  • SDK: for developing Android apps
  • NDK: for using native code
  • PDK: (P=platform) a subset of the new Android release so SoC vendors and OEMs can start adoption and migration before it is released. Only the necessary components for developing HAL.


OEM: Original equipment manufacturer, produces parts and equipment that may be marketed by another manufacturer, e.g. iPhone designed by Apple, manufactured by Foxconn(OEM).

ODM: Original design manufacturer, designs and manufactures a product, as specified, that is eventually rebranded by another firm for sale. e.g. phones designed and manufactured in China get rebranded and sold in India.

SoC: system-on-a-chip, e.g. Apple's A series chips found in iPhones, or Qualcomm's Snapdragon.

Android O splits the monolithic Android OS into generic (system.img) and hardware-specific (vendor.img and odm.img) partitions. Conditional compilation was removed from system partition.

Future Android: single SoC kernel; OEM/ODM may add additional modules or override configs for different devices.