Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Evolution of Android Update Principles


Published on

This webinar by Maksym Kreshchuk (Lead Software Engineer, Consultant, GlobalLogic) was delivered at Embedded Community Webinar #3 on August 19, 2020.

Webinar agenda:
- how the principles and approaches to Android updates have changed
- Project Treble, A / B updates, Android partitions, Mainline modules
- what to expect from the new version of Android 11, which is scheduled for release this fall

More details and presentation:

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Evolution of Android Update Principles

  1. 1. Evolution of Android Update Principles Maksym Kreshchuk, 2020
  2. 2. Agenda ● What is Android? ● Project Treble ● Updates in Android ● Android partitions ● Mainline modules
  3. 3. Android Open Source Project (AOSP) ● Free for download ● More than 800 projects ● More than 50 GB of sources
  4. 4. What is Android? AOSP GMS (Google mobile services)
  5. 5. Device production process
  6. 6. Fragmentation of Android 8 & and below
  7. 7. Project treble ● Introduced in Android 8.0 ● main goal: make Android updates easier, faster, and less costly for device manufacturers ● separates the vendor implementation (device-specific, lower-level software written by silicon manufacturers) from the Android OS framework via a new vendor interface
  8. 8. Project treble: system-vendor dependencies Before treble With treble system.img system.img vendor.img Android OS framework Android OS framework Vendor implemen- tation Vendor implemen- tation Shared libraries Stable API Depends on
  9. 9. Project treble: Android updates
  10. 10. Android 7.0 and earlier updates Download OS The update is downloaded to /cache or /data; enough space must be available. Boot to Recovery The device reboots to recovery. Apply Update The update is applied in recovery. Boot Android The device reboots into a new Android build.
  11. 11. A/B updates Stream Update In the background, the update is streamed directly to B slot. Switch Slot The B slot is marked as bootable. Boot to New Slot ● The device reboots. ● If boot fails, the device reverts to the A slot. Alt Slot Reserved Once successfully booted on the B slot, the next update applies directly to the A slot, etc.
  12. 12. A/B updates ● Reliable OTAs ○ Rollback mechanism built-in ○ Likelihood of bricking greatly reduced ● Background OTAs ○ Including bootloader and device-specific partitions ● Reduced downtime when applying an OTA
  13. 13. Partitions on Moto X (2014), Android M mmcblk0: 16GB eMMC flash mmcblk0p1modem mmcblk0p2sbl1 mmcblk0p3DDR mmcblk0p4aboot mmcblk0p5rpm mmcblk0p6tz mmcblk0p7sdi mmcblk0p8utags mmcblk0plogs mmcblk0p10factorytune1 mmcblk0p11padA mmcblk0p12abootBackup mmcblk0p13rpmBackup mmcblk0p14tzBackup mmcblk0p15utagsBackup mmcblk0p16frp mmcblk0p17padB mmcblk0p18modemst1 mmcblk0p19modemst2 mmcblk0p20hob mmcblk0p21dhob mmcblk0p22fsg mmcblk0p23fsc mmcblk0p24ssd mmcblk0p25sp mmcblk0p26cid mmcblk0p27pds mmcblk0p28misc mmcblk0p29logo mmcblk0p30clogo mmcblk0p31persist mmcblk0p32kpan mmcblk0p33boot mmcblk0p34recovery mmcblk0p35factorytune2 mmcblk0p36customize mmcblk0p37cache mmcblk0p38system mmcblk0p39userdata
  14. 14. Partitions for Android 7 and earlier ○ boot - Linux kernel and a minimal root filesystem (loaded into a RAM disk) ○ cache - application and JVM caches ○ recovery - failsafe micro OS that can be used for maintenance and un-bricking ○ system - Android OS files and core components ○ userdata - any user related things (like non-system utilities, games and other optional staff)
  15. 15. Partitions in Android 8 ● vendor - Contains system applications and libraries that do not have source code available on Android Open Source Project (AOSP) ● cache - not needed for A/B updates ● recovery - not needed for A/B updates, recovery RootFS moves to boot partition ● For A/B updates uses two sets of partitions referred to as slots (normally slot A and slot B) ○ boot_a, boot_b, system_a, system_b, vendor_a, vendor_b.
  16. 16. Problem with partitions in Android 8 On some production device System cannot take a 10MB update even though there is space free! system vendor 5MB free 150MB free
  17. 17. ● Introduced in Android 9 ● Dynamic partitions solves space problem by making partitions resizable ● Dynamic partitions are stored in a fixed-size super partition. ● Contains contents of dynamic partitions as well as some metadata ● Dynamic partitions do not appear in the fixed-partition table, super replaces them ● Is NOT used for writable partitions (such as userdata) Dynamic partitions system_b vendor_b product_b super system_a vendor_a product_a
  18. 18. Partitions in Android 9 Product - an extension of the system partition. Uses for customization application and packages from system partition Super - contains other partitions, handles A/B slots internally
  19. 19. Problem with A/B updates ● A/B updates allow roll back of updates that fail to boot ○ Rolls back system, vendor, etc. ● BUT if update modifies userdata before failing, cannot roll back modifications ● Android does not support updated userdata with old system/vendor
  20. 20. User Data Checkpoint ● Introduced in Android 10 ● Allows Android to roll back to its previous state when an Android over-the-air (OTA) update fails. ● UDC enables the device to revert the user data partition even after being modified. ● Use backup on write mechanism ● Require some free space on userdata partition
  21. 21. Partitions in Android 10 Odm - an extension of the vendor partition. Can be used for customization without changing vendor partition.
  22. 22. Current Google recommendation for partitions To reduce the number of builds needed to support device variants Pros ● Lower Android version update cost ● Lower compatibility and certification cost ● Lower build management complexity ● Easier patching and releasing of security patches ● Quicker release of major updates Cons ● Slight increase in technical complexity of factory calibration and device configuration ODM Vendor System Product A&B Can be separate OEM A OEM B Device A Device B
  23. 23. Mainline modules Deliver “important code changes” to specific internal OS components directly from Google Play. Modules in Android 10: ● Security: Media Codecs, Media Framework Components, DNS Resolver, Conscrypt ● Privacy: Documents UI, Permission Controller, ExtServices ● Consistency: Timezone data, ANGLE, Module Metadata, Networking components, Captive Portal Login, Network Permission Configuration
  24. 24. Mainline modules: how it’s work ● Mainline components are delivered as either APK or APEX files ● APEX is a new file format we developed, similar to APK ● After reboot, the APEX is mounted at the /apex/<apex_name>@<version> directory. ● Multiple versions of the same APEX can be mounted at the same time.
  25. 25. Updates in Android R ● 21 OS components will be updatable through Google play ● Generic kernel image ● Virtual A/B updates
  26. 26. Q&A