Commit graph

58 commits

Author SHA1 Message Date
Bob Badour
29be3f6ef1 [LSC] Add LOCAL_LICENSE_KINDS to bootable/recovery
Added SPDX-license-identifier-Apache-2.0 to:
  applypatch/Android.bp
  bootloader_message/Android.bp
  edify/Android.bp
  fuse_sideload/Android.bp
  install/Android.bp
  minadbd/Android.bp
  minui/Android.bp
  otautil/Android.bp
  recovery_ui/Android.bp
  recovery_utils/Android.bp
  tests/Android.bp
  tools/image_generator/Android.bp
  tools/recovery_l10n/Android.bp
  uncrypt/Android.bp
  update_verifier/Android.bp
  updater/Android.bp
  updater/Android.mk
  updater_sample/Android.bp
  updater_sample/tests/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-MIT
    SPDX-license-identifier-OFL
to:
  Android.bp
  Android.mk

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work
Change-Id: I3da761b525452838977297f773974000d4de7bd6
2021-02-14 10:37:20 -08:00
Jindong
e0134fc715 updater_sample: add internet access permission
Add internet access permission to fix below error:
java.net.SocketException: socket failed: EPERM (Operation not permitted)

Change-Id: I6fba2c871df77ad7a0b98ed4a2ffa907037e9d6f
Signed-off-by: Jindong <jindong.yue@nxp.com>
2019-12-10 14:49:57 +08:00
Tao Bao
7d47aebd79 Update OWNERS.
Test: N/A
Change-Id: I290fe43ee14fa3751f9ddb2c009bff235d8e1cff
2019-10-08 20:32:42 -07:00
Tao Bao
00d4092790 Merge "updater_sample: Build SystemUpdaterSample as non-privileged app by default." am: b87520077b
am: b50f855396

Change-Id: If1cc36794ce4dd4a14b6e1225c025305a95d793e
2019-06-24 09:24:31 -07:00
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
4be5562ae9 Merge "Updater updater_sample/README.md - build instructions." am: 52db3dc12e am: 2ee3614be3
am: 32bd2aa290

Change-Id: Ie988dd227283f3280466e7ad375ffc857ea6b679
2019-02-25 22:47:45 -08: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
faf656f3a7 Merge "Add verification before downloading whole package" am: 2e7393dbde am: e84953e9aa
am: d09708940c

Change-Id: Iffa2427f16444a1d51231caa35f26ae8961439fe
2018-12-17 22:45:34 -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
75f4073baf 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: Iea69acd9aa41e17538c26aff60f7598093ca7744
2018-12-14 15:07:22 -08:00
koushik panuganti
d5c7fb5e6e Migrate bootable/recovery to androidx.test
See go/jetpack-test-android-migration

Test: make checkbuild
Change-Id: I0740a2205e6b3893ba292cd841592ea85071eefb
2018-12-12 11:29:34 -08:00
Colin Cross
88dcca91dd Fix instrumentation_for to refer to name of module
The instrumentation_for property takes the name a module, not the
name of a class.

Test: m checkbuild
Change-Id: I4671ed7b42696eb023052655c0ce7997d2b754f8
2018-10-17 15:14:31 -07: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
Colin Cross
f27ca7eff6 Remove TODO for b/112462307
b/112462307 is fixed now, remove the TODO.

Bug: 112462307
Test: dexlist out/soong/.intermediates/bootable/recovery/updater_sample/SystemUpdaterSample/android_common/dex/classes.dex | grep getUpdaterState
Change-Id: I19cb93a74b714967e4bab2964e229a0ab0a15676
2018-08-13 12:38:28 -07: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
2d9ffb62a3 updater_sample: run as a systemp app
Android.mk: remove local tags, make privileged module
AndroidManifest.xml: add access cache filesystem

Test: on device
Test: junit4
Change-Id: I611970747b7b630520249dd53105b9a2f7f76355
Signed-off-by: Zhomart Mukhamejanov <zhomart@google.com>
2018-06-18 10:29:47 -07:00
Zhomart Mukhamejanov
aa7abc0359 updater_sample: add proguard.flags
Test: on device
Change-Id: Ia8582053b7330d06e618f2555332cfb2a89b3df8
Signed-off-by: Zhomart Mukhamejanov <zhomart@google.com>
2018-06-18 10:16:19 -07:00
Zhomart Mukhamejanov
9ed4b41478 Merge "updater_sample: add metadata mismatch error code" 2018-06-14 17:15:58 +00:00
Ian Pedowitz
c02fb99e1d Revert "updater_sample: add proguard.flags"
This reverts commit 8c3af4aa8c.

Reason for revert: Broke Master

Change-Id: I37bceeea630fb7db39efa25d03ababe3d84cdfbf
2018-06-14 06:35:18 +00:00
Zhomart Mukhamejanov
ebee98df6f updater_sample: add metadata mismatch error code
Update util/UpdateEngineErrorCodes.java

Test: n/a
Change-Id: I7250b1198b1d5ff0e38b7d4effe61eebd114a44f
Signed-off-by: Zhomart Mukhamejanov <zhomart@google.com>
2018-06-13 16:18:38 -07:00
Zhomart Mukhamejanov
8c3af4aa8c updater_sample: add proguard.flags
Test: junit
Change-Id: I0175271935fdd87dd49ad9936d0e1b550d164e05
Signed-off-by: Zhomart Mukhamejanov <zhomart@google.com>
2018-06-13 09:53:29 -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
8a6a86a101 updater_sample: fix payload spec tests
Test: junit4
Change-Id: Ia2f7475cfba01a65486bb0e5d0f3976304ca0969
Signed-off-by: Zhomart Mukhamejanov <zhomart@google.com>
2018-06-07 12:07:20 -07:00
Zhomart Mukhamejanov
da96070ffd updater_sample: change gen_update_config args
Change gen_update_config arg '--ab_force_switch_slot'
from 'bool' to 'store_action'.

Test: manually
Change-Id: Ic65ac9ca3feb99b3a1751a44dec038d49c2b446a
Signed-off-by: Zhomart Mukhamejanov <zhomart@google.com>
2018-06-06 18:38:51 -07:00
Zhomart Mukhamejanov
16db994fad updater_sample: Add suspend/resume update
- Add suspend/resume buttons.
- UpdateManager: add suspend/resume control methods.
- UpdaterState: fix transitions.

Test: on the device
Bug: 77150010
Change-Id: I174edd32401f8232b5071eb1a2758a4704779801
Signed-off-by: Zhomart Mukhamejanov <zhomart@google.com>
2018-06-04 17:33:16 -07: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
469b35a457 updater_sample: improve updater state handling
- Enable more UpdaterState transitions.
- MainActivity: Improve UI states.
- UpdateManager: fix status handling errors, add
  suspend/resume methods.
  Add "synchronize this" to public control (suspend, cancel, ..)
  methods.
- Add several UpdateManager tests.

Test: on device
Test: JUnit4
Change-Id: Id7f85dfaa466fa0d6136eee39e9fd7658278c616
Signed-off-by: Zhomart Mukhamejanov <zhomart@google.com>
2018-06-04 14:23:37 -07:00
Zhomart Mukhamejanov
51cde1e60c updater_sample: validate state only once
Test: on device
Change-Id: I0a8a87d7b69f0efdcbd17facbf42cb94fb96fe51
Signed-off-by: Zhomart Mukhamejanov <zhomart@google.com>
2018-05-31 23:12:43 +00:00
Zhomart Mukhamejanov
f6522eba71 updater_sample: Add @GuardedBy
Test: on the device
Change-Id: I15762dafec1814980e1c2529f5fc2048853c8ff2
Signed-off-by: Zhomart Mukhamejanov <zhomart@google.com>
2018-05-31 23:12:28 +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
674aa6c611 updater_sample: add UpdaterState
- Add UpdaterState - atomic class, handles proper
  state changes.
- Remove util.UpdaterStates.

Test: compiled and ran on the device
Change-Id: I7fa87bbf09f8289632e8de1f26654365f4891700
Signed-off-by: Zhomart Mukhamejanov <zhomart@google.com>
2018-05-25 23:27:07 -07:00
Zhomart Mukhamejanov
b34f7ea9a5 updater_sample: add UpdateData
This class allows easily passing update data to
apply payload, re-applying the updata data,
and in the future persisting.

Test: on the device
Change-Id: Ie01c5f3384c421bf1180122f27811c644179e3f5
Signed-off-by: Zhomart Mukhamejanov <zhomart@google.com>
2018-05-25 23:23:30 -07:00
Treehugger Robot
44e857390a Merge "updater_sample: Add OWNERS." 2018-05-25 18:15:13 +00:00
Tao Bao
35db9cf666 updater_sample: Add OWNERS.
Test: N/A
Change-Id: I519a0fa38b87c7d826ed07414d14a4f7a858aeb4
2018-05-25 09:43:08 -07:00
Zhomart Mukhamejanov
8f4059d603 updater_sample: add updater state
- Add util.UpdaterStates - the state of SystemUpdaterSample.
    It's different from status of UpdateEngine;
    when UpdateEngine#cancel is used to suspend the update,
    UpdateEngine sets status to IDLE, which cannot be used
    to track the suspended state.
- UI: Change 'Update status' to 'Engine status'.
- UI: Change 'Update completion' to 'Engine error code'.
- UI: Add 'Updater state'.

Test: manually on the device
Test: using JUnit4
Change-Id: I9c58b5ed0eae3be7ab8b217fc01a621e8fb2f4bf
Signed-off-by: Zhomart Mukhamejanov <zhomart@google.com>
2018-05-25 16:25:34 +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
b0361ffa3e updater_config: make utils/PayloadSpecs non-static
PayloadSpecs has complicated methods, which makes hard
to test other dependent classes.
Making it non-static allows mocking it, which makes
testing other classes easier.

Test: manually
Test: using JUnit4
Change-Id: I818dc59c6bb0e7d131439d0d41f88d5cd9a451b4
Signed-off-by: Zhomart Mukhamejanov <zhomart@google.com>
2018-05-18 10:38:33 -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
bb8a215138 updater_sample: fix UpdateConfig
- fix UpdateConfig
- fix smaple.json
- fix FileDownloaderTest

Test: manually
Change-Id: I09d272f77c89a02f54a24cf753fdfda4ce243927
Signed-off-by: Zhomart Mukhamejanov <zhomart@google.com>
2018-05-10 12:19:16 -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
daa86e9024 Merge "updater_sample: update tools" 2018-05-09 01:04:59 +00: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
0dd5a83d0e updater_sample: add streaming support
- UpdateConfigs: add helper methods for streaming
- add PrepareStreamingService intent service

Test: manually and junit4
Bug: 77148143
Change-Id: I61711eb9abe051987e725fbd94f8cd029ff21dd3
2018-05-08 21:12:33 +00:00
Zhomart Mukhamejanov
e606f6d3ff updater_sample: update tests
- fix tools/gen_update_config.py
- add tests for PayloadSpecs#forStreaming

Test: junit4
Change-Id: Ife1980c5f72944ed35500aa820b30031fc99e820
Signed-off-by: Zhomart Mukhamejanov <zhomart@google.com>
2018-05-03 14:04:16 -07: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
da7e237596 updater_sample: Add streaming to PayloadSpec
PayloadSpec
- add streaming generator and tests
- fix sample.json
- fix tests
- rename PackagePropertyFiles to PackageFiles, it has info
  not only about property files, and new name is shorter

Bug: 77148467
Test: `mmma -j bootable/recovery/updater_sample`
Change-Id: I9c1206c07c37183f13d3c25940f12981ca85b1b4
Signed-off-by: Zhomart Mukhamejanov <zhomart@google.com>
2018-05-02 12:40:49 -07:00