Commit graph

19 commits

Author SHA1 Message Date
Tao Bao
061267eee9 updater_sample: Build SystemUpdaterSample as non-privileged app by default.
Prior to the change, SystemUpdaterSample was built as privileged app.
It must be installed along with the matching privapp-permissions
whitelist change (as noted in updater_sample/README.md), otherwise would
block device booting if installed unintentionally (e.g. with `mm` or
`mmma`).

This CL avoids putting the device in a bad state due to a sample app.

Fixes: 135703777
Test: `lunch aosp_taimen-userdebug && m -j installclean &&
          mmma -j bootable/recovery && m -j`
      Flash on device and boot successfully.
Test: Run the tests per instructions in updater_sample/README.md.
Change-Id: Ib8b587c77570f05f7db748fad84744fa45016aab
2019-06-21 12:10:36 -07:00
Zhomart Mukhamejanov
011b5bbc06 Updater updater_sample/README.md - build instructions.
Change-Id: Icbd577e3ceeec2766eca690b529b31f562df6fb2
Test: docs only
2019-02-25 16:19:55 -08:00
Zhomart Mukhamejanov
c18d488658 Add verification before downloading whole package
UpdateEngine has a feature that verifies
payload without downloading the whole update package.

If UpdateEngine detects invalid payload,
the sample app aborts the update.

No JUnit tests, because it accesses files on the
device and migrating tests to robolectric
is not worth for this sample app.

Bug: 77150191
Test: device
Change-Id: Ib8ce73508a02cf5fdcb326d8ba46c1d05ed5efe5
2018-12-17 14:24:25 -08:00
Zhomart Mukhamejanov
bc07775393 Add PrepareUpdateService.
It's moved from PrepareStreamingService intent service.
Now PrepareUpdateService takes an UpdateConfig and
builds PayloadSpec for UpdateEngine for both streaming
and non-streaming update.

It allows us to do all preparations in intent service's
thread, without blocking UI.

We will also add checksum verification to
PrepareUpdateService.

Test: device, junit
Bug: 77150191
Change-Id: I15c0bc58e3238bea6ea1c4f13063575e2def89c1
Merged-In: Iea69acd9aa41e17538c26aff60f7598093ca7744
2018-12-17 10:56:28 -08:00
Zhomart Mukhamejanov
88712f7610 Move ab_streaming_metadata under ab_config.
Add new config: ab_config.verify_payload_metadata.

Change-Id: I521dff92166c33dd9c2efa498dc599fe4bc83fde
Signed-off-by: Zhomart Mukhamejanov <zhomart@google.com>
Test: mmm, junit
Bug: 77150191
2018-08-22 18:37:51 +00:00
Tao Bao
d2be7fc29a updater_sample: Move to Soong.
Test: Follow the steps in "Running tests" in updater_sample/README.md.
Change-Id: I70c3239e3daea0dcdadf02f68abe7d6aafa67a2e
2018-08-10 09:05:56 -07:00
Zhomart Mukhamejanov
c0ec9135d5 Remove non-A/B mention from README.
Test: N/A
Change-Id: I8622733d0a23ff062031a67efd0e32480a297322
2018-08-01 15:38:16 -07:00
Zhomart Mukhamejanov
65dcf32274 updater_sample: add privileged system app docs
README.md: add instructions

Test: on device
Bug: 80250430
Change-Id: I2e04fdefda2b73d01dfa0a8e684542feb2ed6c61
Signed-off-by: Zhomart Mukhamejanov <zhomart@google.com>
2018-06-18 10:31:18 -07:00
Zhomart Mukhamejanov
ec33e4504c updater_sample: update README.md
Test: n/a
Change-Id: I0b488ca9fe628c3614c203ab9264175f291f49db
Signed-off-by: Zhomart Mukhamejanov <zhomart@google.com>
2018-06-07 22:49:22 +00:00
Zhomart Mukhamejanov
60abf5c653 updater_sample: Add UI docs to README
Test: N/A
Change-Id: Idc0a4fa778c23c503162337a682c872644e5419c
Signed-off-by: Zhomart Mukhamejanov <zhomart@google.com>
2018-06-04 23:18:55 +00:00
Zhomart Mukhamejanov
7671f68ab8 updater_sample: Improve update completion handling
Currently sample app relies on onPayloadApplicationComplete
callback. It might not get invoked when app is unbound and
update is complete.
On the other hand, onStatusUpdate gets invoked always
(except when update_engine fails to init).
It's good to rely on onStatusUpdate callback to
reapply the update if it's IDLE but sample app state
is RUNNING.

- Add methods to ensure correct updater state.
- Update README.md.

BUG: 80205922
Test: on the device
Change-Id: Ic2f390e85af43556e227362321ab69f0ff146188
Signed-off-by: Zhomart Mukhamejanov <zhomart@google.com>
2018-05-31 21:13:05 +00:00
Zhomart Mukhamejanov
6f26e71263 updater_sample: create UpdateManager
- Add UpdateManager - responsible for the update logic.
    Now ui.MainActivity is responsible for only UI.
- Create sample test for UpdateManager
- Remove MainActivityTest - now MainActivity is really simple.
- Add separate callback for progress update.
- MainActivity: UpdateEngine#bind/unbind on pause/resume.

Test: manually on the device
Test: using JUnit4
Change-Id: I1dba7c4ec74b1afb520be762413cfc261ccfbc08
Signed-off-by: Zhomart Mukhamejanov <zhomart@google.com>
2018-05-23 15:37:43 -07:00
Zhomart Mukhamejanov
238beb7373 updater_sample: add switch slot demo
- Add util/UpdateEngineProperties.java
- Set SWITCH_SLOT_ON_REBOOT=0 when update is applied
- Allow user to switch slot to the updated partition manually
- Add config "ab_config.force_switch_slot"
- Add ab_force_switch_slot to tools/gen_update_config.py

Test: manually on the marlin device
Bug: 79492522
Change-Id: I52f818b576d52a052b5427ba3f732cb2371ddb06
Signed-off-by: Zhomart Mukhamejanov <zhomart@google.com>
2018-05-17 16:29:57 +00:00
Zhomart Mukhamejanov
46a51ac4b6 updater_sample: add HAL compatibility check
- Refactor PrepareStreamingService#onHandleIntent
- Add PrepareStreamingService#verifyPackageCompatibility

Test: on the device
Bug: 79471299
Signed-off-by: Zhomart Mukhamejanov <zhomart@google.com>

Change-Id: I1b18502f0638d66810a3f7ada582e4c7cea20cdb
2018-05-10 14:45:52 -07:00
Zhomart Mukhamejanov
6aa5fb0bbe updater_sample: add http header demo
Added demo passing http headers to UpdateEngine#applyPayload.

Bug: 79483768
Test: manually
Change-Id: I3e9c812dba2066acadbcea8d07c933368806e20c
Signed-off-by: Zhomart Mukhamejanov <zhomart@google.com>
2018-05-09 17:33:52 -07:00
Zhomart Mukhamejanov
96eb59e4b1 updater_sample: update tools
- Allow gen_update_config.py to use ota_from_target_files from
  $ANDROID_BUILD_TOP/build/make/tools/releasetools/
- tests/res/raw/ota_002_package.zip re-generated using functions from
  $ANDROID_BUILD_TOP/build/make/tools/releasetools/test_ota_from_target_files.py
- sample app tests updated

Test: ./tools/gen_update_config_test.py
Change-Id: I5c492ec22782ba54fe481f592a44e797c695684e
Signed-off-by: Zhomart Mukhamejanov <zhomart@google.com>
2018-05-08 21:13:34 +00:00
Zhomart Mukhamejanov
f7a70388ee updater_sample: update ui and README, clean-up
- ui: add text view for latest completion (error) code
- update README.md
- update MainActivity.java
- remove AbNonStreamingUpdate

Test: mmma bootable/recovery/updater_sample
Change-Id: Ie9bb64211c57d536036b04f13896e4937c392b6e
Signed-off-by: Zhomart Mukhamejanov <zhomart@google.com>
2018-05-03 14:59:45 +00:00
Zhomart Mukhamejanov
d5a41822c2 sample_updater: create tools/gen_update_config.py
gen_update_config.py generates JSON config files
from given OTA image zip files.

README.md is updated.

Test: manually

Change-Id: Ifd09b49a73983a42752ee3842a566cecedb9cae0
Signed-off-by: Zhomart Mukhamejanov <zhomart@google.com>
2018-04-25 17:43:26 -07:00
Tao Bao
32118f6690 Rename the dir for SystemUpdaterSample.
Also replace the occurrence in README.md and PREUPLOAD.cfg.

Test: mmma -j bootable/recovery
Change-Id: I04c0ef00dd64f49e008ad2a4a2c1e8eaed76bf8d
2018-04-25 15:34:37 -07:00
Renamed from sample_updater/README.md (Browse further)