This app demonstrates how to use Android system updates APIs to install OTA updates. It contains a sample client for update_engine
to install A/B (seamless) updates and a sample of applying non-A/B updates using recovery
.
A/B (seamless) update is available since Android Nougat (API 24), but this sample targets the latest android.
The commands expected to be run from $ANDROID_BUILD_TOP
.
$ mmma bootable/recovery/updater_sample
.$ adb install <APK_PATH>
.Directory can be found in logs or on UI. Usually json config files are located in /data/user/0/com.example.android.systemupdatersample/files/configs/
. Example file is located at res/raw/sample.json
.
PayloadSpec
and PayloadSpecs
for working with update zip fileUpdateConfig
for working with json config filesMainActivity
$ mmma bootable/recovery/updater_sample/
$ adb install $OUT/system/app/SystemUpdaterSample/SystemUpdaterSample.apk
$ adb install $OUT/testcases/SystemUpdaterSampleTests/SystemUpdaterSampleTests.apk
$ adb shell am instrument -w com.example.android.systemupdatersample.tests/android.support.test.runner.AndroidJUnitRunner
$ adb shell am instrument \ -w com.example.android.systemupdatersample.tests/android.support.test.runner.AndroidJUnitRunner \ -c com.example.android.systemupdatersample.util.PayloadSpecsTest
update_engine
API and read/write access to /data
Run adb shell as a root, and set SELinux mode to permissive (0):
$ adb root
$ adb shell
# setenforce 0
# getenforce