From 32118f6690a5677b509b08730b896304150d4d63 Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Wed, 25 Apr 2018 15:19:47 -0700 Subject: Rename the dir for SystemUpdaterSample. Also replace the occurrence in README.md and PREUPLOAD.cfg. Test: mmma -j bootable/recovery Change-Id: I04c0ef00dd64f49e008ad2a4a2c1e8eaed76bf8d --- Android.mk | 2 +- PREUPLOAD.cfg | 2 +- sample_updater/.gitignore | 9 - sample_updater/Android.mk | 32 --- sample_updater/AndroidManifest.xml | 36 --- sample_updater/README.md | 72 ----- sample_updater/res/layout/activity_main.xml | 163 ----------- sample_updater/res/mipmap-hdpi/ic_launcher.png | Bin 3056 -> 0 bytes .../res/mipmap-hdpi/ic_launcher_round.png | Bin 5024 -> 0 bytes sample_updater/res/raw/sample.json | 22 -- sample_updater/res/values/strings.xml | 21 -- .../android/systemupdatersample/PayloadSpec.java | 122 -------- .../android/systemupdatersample/UpdateConfig.java | 183 ------------ .../systemupdatersample/ui/MainActivity.java | 314 --------------------- .../updates/AbNonStreamingUpdate.java | 52 ---- .../util/PackagePropertyFiles.java | 42 --- .../systemupdatersample/util/PayloadSpecs.java | 117 -------- .../systemupdatersample/util/UpdateConfigs.java | 82 ------ .../util/UpdateEngineErrorCodes.java | 84 ------ .../util/UpdateEngineStatuses.java | 51 ---- sample_updater/tests/Android.mk | 32 --- sample_updater/tests/AndroidManifest.xml | 31 -- sample_updater/tests/build.properties | 1 - .../systemupdatersample/UpdateConfigTest.java | 79 ------ .../systemupdatersample/ui/MainActivityTest.java | 48 ---- .../systemupdatersample/util/PayloadSpecsTest.java | 117 -------- .../util/UpdateConfigsTest.java | 63 ----- updater_sample/.gitignore | 9 + updater_sample/Android.mk | 32 +++ updater_sample/AndroidManifest.xml | 36 +++ updater_sample/README.md | 72 +++++ updater_sample/res/layout/activity_main.xml | 163 +++++++++++ updater_sample/res/mipmap-hdpi/ic_launcher.png | Bin 0 -> 3056 bytes .../res/mipmap-hdpi/ic_launcher_round.png | Bin 0 -> 5024 bytes updater_sample/res/raw/sample.json | 22 ++ updater_sample/res/values/strings.xml | 21 ++ .../android/systemupdatersample/PayloadSpec.java | 122 ++++++++ .../android/systemupdatersample/UpdateConfig.java | 183 ++++++++++++ .../systemupdatersample/ui/MainActivity.java | 314 +++++++++++++++++++++ .../updates/AbNonStreamingUpdate.java | 52 ++++ .../util/PackagePropertyFiles.java | 42 +++ .../systemupdatersample/util/PayloadSpecs.java | 117 ++++++++ .../systemupdatersample/util/UpdateConfigs.java | 82 ++++++ .../util/UpdateEngineErrorCodes.java | 84 ++++++ .../util/UpdateEngineStatuses.java | 51 ++++ updater_sample/tests/Android.mk | 32 +++ updater_sample/tests/AndroidManifest.xml | 31 ++ updater_sample/tests/build.properties | 1 + .../systemupdatersample/UpdateConfigTest.java | 79 ++++++ .../systemupdatersample/ui/MainActivityTest.java | 48 ++++ .../systemupdatersample/util/PayloadSpecsTest.java | 117 ++++++++ .../util/UpdateConfigsTest.java | 63 +++++ 52 files changed, 1775 insertions(+), 1775 deletions(-) delete mode 100644 sample_updater/.gitignore delete mode 100644 sample_updater/Android.mk delete mode 100644 sample_updater/AndroidManifest.xml delete mode 100644 sample_updater/README.md delete mode 100644 sample_updater/res/layout/activity_main.xml delete mode 100644 sample_updater/res/mipmap-hdpi/ic_launcher.png delete mode 100644 sample_updater/res/mipmap-hdpi/ic_launcher_round.png delete mode 100644 sample_updater/res/raw/sample.json delete mode 100644 sample_updater/res/values/strings.xml delete mode 100644 sample_updater/src/com/example/android/systemupdatersample/PayloadSpec.java delete mode 100644 sample_updater/src/com/example/android/systemupdatersample/UpdateConfig.java delete mode 100644 sample_updater/src/com/example/android/systemupdatersample/ui/MainActivity.java delete mode 100644 sample_updater/src/com/example/android/systemupdatersample/updates/AbNonStreamingUpdate.java delete mode 100644 sample_updater/src/com/example/android/systemupdatersample/util/PackagePropertyFiles.java delete mode 100644 sample_updater/src/com/example/android/systemupdatersample/util/PayloadSpecs.java delete mode 100644 sample_updater/src/com/example/android/systemupdatersample/util/UpdateConfigs.java delete mode 100644 sample_updater/src/com/example/android/systemupdatersample/util/UpdateEngineErrorCodes.java delete mode 100644 sample_updater/src/com/example/android/systemupdatersample/util/UpdateEngineStatuses.java delete mode 100644 sample_updater/tests/Android.mk delete mode 100644 sample_updater/tests/AndroidManifest.xml delete mode 100644 sample_updater/tests/build.properties delete mode 100644 sample_updater/tests/src/com/example/android/systemupdatersample/UpdateConfigTest.java delete mode 100644 sample_updater/tests/src/com/example/android/systemupdatersample/ui/MainActivityTest.java delete mode 100644 sample_updater/tests/src/com/example/android/systemupdatersample/util/PayloadSpecsTest.java delete mode 100644 sample_updater/tests/src/com/example/android/systemupdatersample/util/UpdateConfigsTest.java create mode 100644 updater_sample/.gitignore create mode 100644 updater_sample/Android.mk create mode 100644 updater_sample/AndroidManifest.xml create mode 100644 updater_sample/README.md create mode 100644 updater_sample/res/layout/activity_main.xml create mode 100644 updater_sample/res/mipmap-hdpi/ic_launcher.png create mode 100644 updater_sample/res/mipmap-hdpi/ic_launcher_round.png create mode 100644 updater_sample/res/raw/sample.json create mode 100644 updater_sample/res/values/strings.xml create mode 100644 updater_sample/src/com/example/android/systemupdatersample/PayloadSpec.java create mode 100644 updater_sample/src/com/example/android/systemupdatersample/UpdateConfig.java create mode 100644 updater_sample/src/com/example/android/systemupdatersample/ui/MainActivity.java create mode 100644 updater_sample/src/com/example/android/systemupdatersample/updates/AbNonStreamingUpdate.java create mode 100644 updater_sample/src/com/example/android/systemupdatersample/util/PackagePropertyFiles.java create mode 100644 updater_sample/src/com/example/android/systemupdatersample/util/PayloadSpecs.java create mode 100644 updater_sample/src/com/example/android/systemupdatersample/util/UpdateConfigs.java create mode 100644 updater_sample/src/com/example/android/systemupdatersample/util/UpdateEngineErrorCodes.java create mode 100644 updater_sample/src/com/example/android/systemupdatersample/util/UpdateEngineStatuses.java create mode 100644 updater_sample/tests/Android.mk create mode 100644 updater_sample/tests/AndroidManifest.xml create mode 100644 updater_sample/tests/build.properties create mode 100644 updater_sample/tests/src/com/example/android/systemupdatersample/UpdateConfigTest.java create mode 100644 updater_sample/tests/src/com/example/android/systemupdatersample/ui/MainActivityTest.java create mode 100644 updater_sample/tests/src/com/example/android/systemupdatersample/util/PayloadSpecsTest.java create mode 100644 updater_sample/tests/src/com/example/android/systemupdatersample/util/UpdateConfigsTest.java diff --git a/Android.mk b/Android.mk index e54db2d1b..eef4a020f 100644 --- a/Android.mk +++ b/Android.mk @@ -199,7 +199,7 @@ include $(BUILD_EXECUTABLE) include \ $(LOCAL_PATH)/boot_control/Android.mk \ $(LOCAL_PATH)/minui/Android.mk \ - $(LOCAL_PATH)/sample_updater/Android.mk \ $(LOCAL_PATH)/tests/Android.mk \ $(LOCAL_PATH)/tools/Android.mk \ $(LOCAL_PATH)/updater/Android.mk \ + $(LOCAL_PATH)/updater_sample/Android.mk \ diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg index 878651c8e..108429193 100644 --- a/PREUPLOAD.cfg +++ b/PREUPLOAD.cfg @@ -7,5 +7,5 @@ clang_format = --commit ${PREUPLOAD_COMMIT} --style file --extensions c,h,cc,cpp [Hook Scripts] checkstyle_hook = ${REPO_ROOT}/prebuilts/checkstyle/checkstyle.py --sha ${PREUPLOAD_COMMIT} - -fw sample_updater/ + -fw updater_sample/ diff --git a/sample_updater/.gitignore b/sample_updater/.gitignore deleted file mode 100644 index 487263f73..000000000 --- a/sample_updater/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -*~ -*.bak -*.pyc -*.pyc-2.4 -Thumbs.db -*.iml -.idea/ -gen/ -.vscode diff --git a/sample_updater/Android.mk b/sample_updater/Android.mk deleted file mode 100644 index 2786de44f..000000000 --- a/sample_updater/Android.mk +++ /dev/null @@ -1,32 +0,0 @@ -# -# Copyright (C) 2018 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_PACKAGE_NAME := SystemUpdaterSample -LOCAL_SDK_VERSION := system_current -LOCAL_MODULE_TAGS := samples - -# TODO: enable proguard and use proguard.flags file -LOCAL_PROGUARD_ENABLED := disabled - -LOCAL_SRC_FILES := $(call all-java-files-under, src) - -include $(BUILD_PACKAGE) - -# Use the following include to make our test apk. -include $(call all-makefiles-under,$(LOCAL_PATH)) diff --git a/sample_updater/AndroidManifest.xml b/sample_updater/AndroidManifest.xml deleted file mode 100644 index 5bbb21c84..000000000 --- a/sample_updater/AndroidManifest.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/sample_updater/README.md b/sample_updater/README.md deleted file mode 100644 index 467ef5d4a..000000000 --- a/sample_updater/README.md +++ /dev/null @@ -1,72 +0,0 @@ -# SystemUpdaterSample - -This app demonstrates how to use Android system updates APIs to install -[OTA updates](https://source.android.com/devices/tech/ota/). 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. - - -## Running on a device - -The commands expected to be run from `$ANDROID_BUILD_TOP`. - -1. Compile the app `$ mmma bootable/recovery/sample_updater`. -2. Install the app to the device using `$ adb install `. -3. Add update config files. - - -## Update Config file - -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`. - - -## Development - -- [x] Create a UI with list of configs, current version, - control buttons, progress bar and log viewer -- [x] Add `PayloadSpec` and `PayloadSpecs` for working with - update zip file -- [x] Add `UpdateConfig` for working with json config files -- [x] Add applying non-streaming update -- [ ] Add applying streaming update -- [ ] Prepare streaming update (partially downloading package) -- [ ] Add tests for `MainActivity` -- [ ] Add stop/reset the update -- [ ] Verify system partition checksum for package -- [ ] HAL compatibility check -- [ ] Change partition demo -- [ ] Add non-A/B updates demo - - -## Running tests - -1. Build `$ mmma bootable/recovery/sample_updater/` -2. Install app - `$ adb install $OUT/system/app/SystemUpdaterSample/SystemUpdaterSample.apk` -3. Install tests - `$ adb install $OUT/testcases/SystemUpdaterSampleTests/SystemUpdaterSampleTests.apk` -4. Run tests - `$ adb shell am instrument -w com.example.android.systemupdatersample.tests/android.support.test.runner.AndroidJUnitRunner` -5. Run a test file - ``` - $ adb shell am instrument \ - -w com.example.android.systemupdatersample.tests/android.support.test.runner.AndroidJUnitRunner \ - -c com.example.android.systemupdatersample.util.PayloadSpecsTest - ``` - - -## Getting access to `update_engine` API and read/write access to `/data` - -Run adb shell as a root, and set SELinux mode to permissive (0): - -```txt -$ adb root -$ adb shell -# setenforce 0 -# getenforce -``` diff --git a/sample_updater/res/layout/activity_main.xml b/sample_updater/res/layout/activity_main.xml deleted file mode 100644 index 3cd772107..000000000 --- a/sample_updater/res/layout/activity_main.xml +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - -