diff options
author | Zhomart Mukhamejanov <zhomart@google.com> | 2018-05-03 05:37:12 +0200 |
---|---|---|
committer | Zhomart Mukhamejanov <zhomart@google.com> | 2018-05-03 16:59:45 +0200 |
commit | f7a70388ee22e5971ea19caef5208c1da2282ee4 (patch) | |
tree | 81c1a71270098123ebfd4ed68025613db2d1a557 /updater_sample/README.md | |
parent | Merge "screen_ui: Merge Menu::Start() into its ctor." (diff) | |
download | android_bootable_recovery-f7a70388ee22e5971ea19caef5208c1da2282ee4.tar android_bootable_recovery-f7a70388ee22e5971ea19caef5208c1da2282ee4.tar.gz android_bootable_recovery-f7a70388ee22e5971ea19caef5208c1da2282ee4.tar.bz2 android_bootable_recovery-f7a70388ee22e5971ea19caef5208c1da2282ee4.tar.lz android_bootable_recovery-f7a70388ee22e5971ea19caef5208c1da2282ee4.tar.xz android_bootable_recovery-f7a70388ee22e5971ea19caef5208c1da2282ee4.tar.zst android_bootable_recovery-f7a70388ee22e5971ea19caef5208c1da2282ee4.zip |
Diffstat (limited to 'updater_sample/README.md')
-rw-r--r-- | updater_sample/README.md | 60 |
1 files changed, 45 insertions, 15 deletions
diff --git a/updater_sample/README.md b/updater_sample/README.md index ee1faaf85..12f803ff6 100644 --- a/updater_sample/README.md +++ b/updater_sample/README.md @@ -30,13 +30,19 @@ to the app, but in this sample, the config files are stored on the device. The directory can be found in logs or on the UI. In most cases it should be located at `/data/user/0/com.example.android.systemupdatersample/files/configs/`. -SystemUpdaterSample app downloads OTA package from `url`. If `ab_install_type` -is `NON_STREAMING` then app downloads the whole package and -passes it to the `update_engine`. If `ab_install_type` is `STREAMING` -then app downloads only some files to prepare the streaming update and -`update_engine` will stream only `payload.bin`. -To support streaming A/B (seamless) update, OTA package file must be -an uncompressed (ZIP_STORED) zip file. +SystemUpdaterSample app downloads OTA package from `url`. In this sample app +`url` is expected to point to file system, e.g. `file:///data/sample-builds/ota-002.zip`. + +If `ab_install_type` is `NON_STREAMING` then app checks if `url` starts +with `file://` and passes `url` to the `update_engine`. + +If `ab_install_type` is `STREAMING`, app downloads only the entries in need, as +opposed to the entire package, to initiate a streaming update. The `payload.bin` +entry, which takes up the majority of the space in an OTA package, will be +streamed by `update_engine` directly. The ZIP entries in such a package need to be +saved uncompressed (`ZIP_STORED`), so that their data can be downloaded directly +with the offset and length. As `payload.bin` itself is already in compressed +format, the size penalty is marginal. Config files can be generated using `tools/gen_update_config.py`. Running `./tools/gen_update_config.py --help` shows usage of the script. @@ -44,11 +50,15 @@ Running `./tools/gen_update_config.py --help` shows usage of the script. ## Running on a device -The commands expected to be run from `$ANDROID_BUILD_TOP`. +The commands expected to be run from `$ANDROID_BUILD_TOP` and for demo +purpose only. 1. Compile the app `$ mmma bootable/recovery/updater_sample`. 2. Install the app to the device using `$ adb install <APK_PATH>`. -3. Add update config files. +3. Change permissions on `/data/ota_package/` to `0777` on the device. +4. Set SELinux mode to permissive. See instructions below. +5. Add update config files. +6. Push OTA packages to the device. ## Development @@ -86,13 +96,33 @@ The commands expected to be run from `$ANDROID_BUILD_TOP`. ``` -## Getting access to `update_engine` API and read/write access to `/data` +## Accessing `android.os.UpdateEngine` API + +`android.os.UpdateEngine`` APIs are marked as `@SystemApi`, meaning only system apps can access them. + -Run adb shell as a root, and set SELinux mode to permissive (0): +## Getting read/write access to `/data/ota_package/` + +Following must be included in `AndroidManifest.xml`: + +```xml + <uses-permission android:name="android.permission.ACCESS_CACHE_FILESYSTEM" /> +``` + +Note: access to cache filesystem is granted only to system apps. + + +## Setting SELinux mode to permissive (0) ```txt -$ adb root -$ adb shell -# setenforce 0 -# getenforce +local$ adb root +local$ adb shell +android# setenforce 0 +android# getenforce ``` + + +## License + +SystemUpdaterSample app is released under +[Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). |