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: https://www.globallogic.com/ua/about/events/embedded-community-webinar-3/
8. 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
9. 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
11. 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.
12. 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.
13. 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
15. 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)
16. 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.
17. 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
18. ● 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
19. 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
20. 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
21. 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
22. Partitions in Android 10
Odm - an extension of the vendor partition. Can be used for customization without
changing vendor partition.
23. 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
24. 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
25. 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.
26. Updates in Android R
● 21 OS components will be updatable through Google play
● Generic kernel image
● Virtual A/B updates