logo

Android - Overview

Last Updated: 2023-10-21

The 3 "Layers"

If you want to be an Android developer, these are the 3 "layers" you need to be aware of.

Android Framework (Base)

AndroidX (JetPack):

Google Play Services (GMS) And Firebase

  • packages under com.google.android.gms.* and com.google.firebase.
  • Closed Source. Only Google certified companies can use it. When the news of "Google banning Huawei" came, it referred to this part, as Android(AOSP) is fully open sourced.
  • for both Google's 1st party apps(e.g. YouTube, Google Maps) and 3rd party APIs.
  • not available in China.
  • Some devices may use AOSP but develop their own GMS equivalents(e.g. Amazon Fire)

Languages

  • Originally Java is the main programming language
  • Android was going Kotlin-first in 2019; Kotlin is strongly backed by Google and JetBrains (they co-created Kotlin Foundation), so it may be the future.

Trends

Project Treble

Since Android 8.0 Oreo.

Project Treble: adding interfaces to separate low-level (hardware specific) code from the main Android framework.

AOSP will compile to Android GSI (Generic System Images); devices certified with Project Treble should work with GSI images. Android framework can be replaced without rebuilding the Hardware abstraction layer (HAL).

Vendors or SOC makers build HALs once and place them in a /vendor partition on the device; the framework, in its own partition, can then be replaced with an over-the-air (OTA) update without recompiling the HALs.

Project Mainline

Since Android 10

Project Mainline: update core OS components like apps (i.e. through Google Play Store).

  • security and privacy patches can be delivered faster
  • absorbing logics from OEMs where customizations are not needed

APEX vs APK:

  • APEX is a new format, in addition to APK
  • APEX are loaded much earlier in the booting process
  • APK has more limited permissions

Generic Kernel Image

Android "has been pushing very hard towards this generic kernel image and has been basing this on stable updates. That's because they find that this helps improve Android's security. They've found that the vast majority of security problems are disclosed in the kernel and or even fixed in the Android kernels before they are disclosed because they were already incorporated before anybody knew that they were actually security-related bugs."

Moving away from Google Play Services?

Google Maps SDK for Android v3 is moving away from Google Play Services and becomes a standalone static library.

https://developers.google.com/maps/documentation/android-sdk/v3-client-migration

Similarly the new Places SDK is also a static library instead of relying on GMS; also it depends on AndroidX and moved away from support libraries.

https://developers.google.com/places/android-sdk/client-migration

Is this a trend?

Huawei Ban

Huawei phones would not get Google Apps and Play Store installed.

Other Notable Components

Besides platform/frameworks/base and platform/frameworks/support, here lists some other interesting/important repos:

  • platform/libcore: Google's implementation of some core Java libs(e.g. java.net, java.util, etc)
  • bionic: the C library

Time Diff

UTC time on a device is NOT monotonic, it can jump forwards or backwards unpredictably. To calculate time deltas, always use android.location.Location#getElapsedRealtimeNanos()

Related Websites