Commit Graph

63 Commits

Author SHA1 Message Date
Yo Chiang
e5a9e4a354 Merge "Disable DSU in executeRebootToNormalCommand()" am: 0b6bf88ccd am: f785394fb3 am: b8f884150d am: 7d1a821d9d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1470783

Change-Id: I795daab4a881b78cc6717cee41bfa01637d93e37
2020-10-30 08:20:29 +00:00
Yo Chiang
b8f884150d Merge "Disable DSU in executeRebootToNormalCommand()" am: 0b6bf88ccd am: f785394fb3
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1470783

Change-Id: Ie3cccfbeb1d4d187bcf2282fe0fcdbcbc22ca261
2020-10-30 07:44:22 +00:00
Yo Chiang
0b6bf88ccd Merge "Disable DSU in executeRebootToNormalCommand()" 2020-10-30 06:55:43 +00:00
Yo Chiang
68e2d6b360 Disable DSU in executeRebootToNormalCommand()
executeRebootToNormalCommand() reboots the device only if DSU is
successfully disabled, else show a toast describing the failure.

Bug: 171380622
Test: 1. Install and boot into a DSU
      2. adb shell gsi_tool enable
      3. Press "Restart" in DSU notification
      4. Observe the device reboots back to the original system
Change-Id: I19b3d09a64282a28ca7b99b441ca93dea45fcce0
2020-10-29 16:03:38 +08:00
Howard Chen
09e1c8925c Merge "Add a mutability flag to the PendingIntent in DynamicSystemInstallationService" am: dc0b992c75 am: 5107e43858 am: 46a6aee06d am: 0e0af4cf47
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1479478

Change-Id: I7fb65a386b3a058c4da0f2d539e2903aae180987
2020-10-29 07:28:44 +00:00
Howard Chen
46a6aee06d Merge "Add a mutability flag to the PendingIntent in DynamicSystemInstallationService" am: dc0b992c75 am: 5107e43858
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1479478

Change-Id: I78b38fdf4bd8ddad4eb6abf9ddf89c15e6537093
2020-10-29 06:35:55 +00:00
Howard Chen
54653ba116 Add a mutability flag to the PendingIntent in DynamicSystemInstallationService
Bug: 171718124
Test: DSU installation
Change-Id: Id352e37238aad6499841dc379b006f2e0150181d
2020-10-29 11:06:26 +08:00
Jeff Sharkey
d23b5379c0 Enable Error Prone to detect obscure bugs.
We've been writing many new framework-specific Error Prone checkers
to help detect obscure platform bugs, and this change starts enabling
those checkers for more packages across the platform.

Bug: 155703208
Test: manual
Exempt-From-Owner-Approval: trivial blueprint changes
Change-Id: I1db3412b0be40f6f78c68331ae01756887192071
2020-10-23 16:55:30 -06:00
Yo Chiang
8dd34a1749 Merge "Dismiss DSU notification in executeDiscardCommand()" am: 3313038017 am: 7af64dd1f7 am: 9e47644314 am: 970bd09428
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1448418

Change-Id: Ib2314a9423f132a7c9ec001acb380369426c870d
2020-10-06 05:56:28 +00:00
Yo Chiang
9e47644314 Merge "Dismiss DSU notification in executeDiscardCommand()" am: 3313038017 am: 7af64dd1f7
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1448418

Change-Id: Ia170a72614648614cb33c8ff079531f1507899d0
2020-10-06 05:13:34 +00:00
Yo Chiang
7af64dd1f7 Merge "Dismiss DSU notification in executeDiscardCommand()" am: 3313038017
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1448418

Change-Id: Id0a2b1fb7752e3d9de83f3613d0290c0ecf9096a
2020-10-06 04:38:53 +00:00
Yo Chiang
569c31cef6 Dismiss DSU notification in executeDiscardCommand()
Dismiss notification even if there is no active DSU installation.

Bug: 170072953
Test: Install a DSU system.
  Reboot into guest system and reboot back to host system.
  `adb shell gsi_tool wipe`
  Press "Discard" in the DSU notification, the notifiction is dismissed.
Change-Id: I6f217c4ba287e4789d61182a12485db60f9605c9
2020-10-05 08:57:50 +00:00
Bill Yi
c7be32a1b1 Import translations. DO NOT MERGE ANYWHERE
Auto-generated-cl: translation import
Change-Id: I923ae5fe5c949911dc0b49cc9ad43dbbbf448431
2020-10-04 23:33:11 -07:00
Bill Yi
078b413289 Import translations. DO NOT MERGE ANYWHERE
Auto-generated-cl: translation import
Change-Id: I7df5410104e4be01cb906e0f607a3acc730bfbe7
2020-09-10 10:57:30 +00:00
Bill Yi
70726e8fad Import translations. DO NOT MERGE ANYWHERE
Auto-generated-cl: translation import
Change-Id: Ic9f70d811812b888832db3c4f302f628d757bafc
2020-09-04 17:36:13 +00:00
TreeHugger Robot
3a301e8671 Merge "Import translations. DO NOT MERGE ANYWHERE" into stage-aosp-master 2020-09-03 01:07:47 +00:00
Bill Yi
31ccff50f7 Import translations. DO NOT MERGE ANYWHERE
Auto-generated-cl: translation import
Change-Id: I7672d1bacef6d243b623cd0c222cf4e438b65631
2020-09-02 23:21:32 +00:00
Yo Chiang
309f789948 Merge "Check error status after installing each DSU partition" am: fbd85db85d am: 73d5afb2cb am: dbe6d55157 am: 9b2f226473 am: 52a88df94a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1404669

Change-Id: I0b3f8dcbdfe4bf4451bb38d734aa423f489187d4
2020-09-02 06:25:57 +00:00
Yo Chiang
55668c1a49 Check error status after installing each DSU partition
Add DynamicSystemManager.closePartition() that closes a partition
installation and returns its error status.
InstallationAsyncTask may call this method to do error checking.

Bug: 165471299
Test: Observe the logcat of a failed DSU installation
Change-Id: I9d155c70c6e490899a4acfd35c8096549af005d4
2020-08-25 07:48:16 +00:00
Yo Chiang
713b48970e Merge "Post a notification if reboot to DSU failed" am: 5432af8406 am: dcdec0017e am: 3a3ec27223 am: 07f7f83826 am: 2f624e15fd
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1404648

Change-Id: Ie6f06c9bd5a68fdfec663d1cac0d2c3cecec1223
2020-08-20 09:49:16 +00:00
Yo Chiang
591602bf26 Post a notification if reboot to DSU failed
Also call resetTaskAndStop() so the lingering Installation task is
cleaned up and failed states such as installation progress are cleared.

Bug: 165471299
Test: Install a failing DSU package and observe logcat
Test: Retry install DSU package and observe notification progress
Change-Id: I1ce55ea98256954bb06d46ca948cae6ca48d9679
2020-08-19 20:14:04 +08:00
Treehugger Robot
39867f4242 Merge "Update language to comply with Android’s inclusive language guidance" am: f366f37aa1 am: 5383e257e2 am: 9df4a45b87 am: 240de71ebd am: 2fb3fdb5d5
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1372976

Change-Id: I2cf69030196c9f83af06ebe040c634a8624755ea
2020-07-27 06:47:58 +00:00
Yo Chiang
d5a6030fd2 Update language to comply with Android’s inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code for
reference

#inclusivefixit

Bug: 161896447
Test: TH presubmit
Test: atest DynamicSystemInstallationServiceTests
Change-Id: I94ab7cabc4f86ecb266c1d7d89357da1e3f88921
2020-07-27 04:26:09 +00:00
Bill Yi
4702c7eb94 Import translations. DO NOT MERGE
Auto-generated-cl: translation import
Change-Id: Ib50020255e2903fb4186a180228d4b824ab6009c
2020-04-27 14:20:42 -07:00
TreeHugger Robot
6c491c054b Merge "Import translations. DO NOT MERGE" 2020-04-26 18:31:42 +00:00
Bill Yi
a14c398f52 Import translations. DO NOT MERGE
Auto-generated-cl: translation import
Change-Id: I98d91f31c423aa8befda7d4c582623bf34e9d407
2020-04-25 17:44:19 -07:00
Po-Chien Hsueh
8f3bdb821c Extend strings.xml character limits
Per linguist's suggestion, extend character limits of strings. And,
keep app's name "Dynamic System Update" not translated.

Bug: 154345776
Bug: 154345861
Bug: 154345863
Test: None
Change-Id: If57e0e0f301588f60744678f0ec942e8eb8e8a70
2020-04-23 14:48:08 +08:00
Po-Chien Hsueh
7ba4d3945a Keep error message notification after stop
If the notification contains an error message, keep it even after the
service is stopped.

Bug: 149876966
Test: adb shell am start-activity \
    -n com.android.dynsystem/com.android.dynsystem.VerificationActivity \
    -a android.os.image.action.START_INSTALL \
    -d file:///file_does_not_exist
Change-Id: I5fdbcaf5ed28343f53d66b3f02ccb66d3c7920ff
2020-03-05 13:49:16 +08:00
Yo Chiang
f41e145480 Add DSU default userdata partition size
Use DEFAULT_USERDATA_SIZE as userdata partition size if the calling
Intent desn't specify the userdata size or the specified size is zero.

Bug: 145891687
Test: adb shell am start-activity \
  -n com.android.dynsystem/com.android.dynsystem.VerificationActivity \
  -a android.os.image.action.START_INSTALL \
  -d file:///storage/emulated/0/Download/aosp_arm64-dsu_test.zip

Change-Id: I52767dfefef394403c5e16fcfd40792b14ff9a71
2020-02-24 15:06:56 +08:00
Treehugger Robot
b2d41e93f8 Merge "Fix VerificationActivity Intent" 2020-02-21 05:51:24 +00:00
Yo Chiang
f8d6789233 Fix VerificationActivity Intent
VerificationActivity crashes when the Intent sent to it doesn't have an
extras Bundle. This is because VerificationActivity copies the incoming
Intents extras Bundle with getExtras() / putExtras(Bundle), and
putExtras(Bundle) doesn't expect a null Bundle.

Bug: 145891687
Test: adb shell am start-activity \
  -n com.android.dynsystem/com.android.dynsystem.VerificationActivity \
  -a android.os.image.action.START_INSTALL \
  -d file:///storage/emulated/0/Download/aosp_arm64-dsu_test.zip

Test: Dynamic system service mustn't crash
Change-Id: I111641f366d50d739b922bcc3a52993c44212759
2020-02-21 04:17:51 +00:00
Po-Chien Hsueh
5b380af950 Replace action button "Uninstall" with "Restart"
When DSU is running, restarting the device will not uninstall the
installed system update.

Bug: 149716233
Test: run DSU install
Change-Id: If4e7b2f5f9123161ae85c0be80069aa600548c74
2020-02-20 14:19:39 +08:00
Yo Chiang
be20495f0b Key revocation check is permissive when device is unlocked
imageValidationThrowOrWarning() logs the error as a warning if device
bootloader is unlocked, else re-throw the error.
Device lock state is queried via PersistentDataBlockManager service.

Bug: 128892201
Test: adb shell am start-activity \
    -n com.android.dynsystem/com.android.dynsystem.VerificationActivity \
    -a android.os.image.action.START_INSTALL \
    --el KEY_USERDATA_SIZE 8192 \
    -d file:///storage/emulated/0/Download/aosp_arm64-dsu_test.zip \
    --es ${IMAGE_KEY}
Test: Observe the logcat
Change-Id: I895e70d90624afda2bf7cd3b34ea8d21a1702163
2020-02-19 11:11:29 +00:00
Yo Chiang
a86e1ab30a Check DSU public key with key revocation list
Throw RevocationListFetchException if failed to fetch key revocation
list.
Throw KeyRevokedException if DSU intent or image public key is revoked.
Throw PublicKeyException if getAvbPublicKey() failed.

Bug: 128892201
Test: adb shell am start-activity \
    -n com.android.dynsystem/com.android.dynsystem.VerificationActivity \
    -a android.os.image.action.START_INSTALL \
    --el KEY_USERDATA_SIZE 8192 \
    -d file:///storage/emulated/0/Download/aosp_arm64-dsu_test.zip \
    --es KEY_PUBKEY ${IMAGE_KEY}
Test: edit the code so that imageValidationThrowOrWarning() always
Test: throw and observe the logcat and device notification
Change-Id: I33733c019b305c45e7d2511c44ef1d9b446ea52e
2020-02-19 09:32:36 +00:00
Yo Chiang
739c45ea23 Merge "DSU to support GSI key revocation list" 2020-02-05 19:01:54 +00:00
Yo Chiang
61fc692d66 DSU to support GSI key revocation list
DSU installation service fetches a key revocation list (key blacklist).
Revocation list is a https URL specified in a resource string.

Fetched result is cached in HttpResponseCache to save bandwidth, and the
cached result is always forced validated with server to ensure freshness.
In other words, fetching a revocation list is done via a "conditional GET",
such http GET returns a brief (304 NOT MODIFIED) response if ours cache is
still valid, else the server sends a (200 OK) response with new data.

TODO: Compare the installed DSU image's public key with the revocation
list and boot-ramdisk. If the public key is revoked then abort installation.

Bug: 128892201
Test: atest DynamicSystemInstallationServiceTests
Test: adb shell am start-activity \
    -n com.android.dynsystem/com.android.dynsystem.VerificationActivity \
    -a android.os.image.action.START_INSTALL \
    --el KEY_USERDATA_SIZE 8589934592 \
    -d file:///storage/emulated/0/Download/aosp_arm64-dsu_test.zip \
    --es KEY_PUBKEY key1

Change-Id: I29ae088acb1bd23336ec09654f38b4fc464316d8
2020-01-25 21:31:21 +08:00
Treehugger Robot
03e365f649 Merge "Improve DSU log and notification message" 2020-01-16 12:15:26 +00:00
Po-Chien Hsueh
bcf2adb424 Improve DSU log and notification message
Improve DSU installation service's status log message. And, use
Notification.BigTextStyle for DSU notification message.

Bug: 132924741
Test: Run DSU installation
Change-Id: I9e821edfeff88a1f4084a005de3e0f4264338996
2020-01-16 13:52:57 +08:00
Howard Chen
69d181aecc Merge "Support multiple DSU installations" 2020-01-16 05:33:10 +00:00
Howard Chen
c6f64c44eb Support multiple DSU installations
Bug: 144247097
Test: adb shell am start-activity \
        -n com.android.dynsystem/com.android.dynsystem.VerificationActivity \
        -a android.os.image.action.START_INSTALL \
        -d file:///storage/emulated/0/Download/system.raw.gz \
        --el KEY_SYSTEM_SIZE $(du -b system.raw|cut -f1) \
        --el KEY_USERDATA_SIZE 8589934592
Change-Id: Ib2f86039c4c0c1dae2bc94a702721572567bcbf2
2020-01-14 02:20:47 +00:00
Po-Chien Hsueh
00cf589f45 Merge "Remove notification right after clicking on cancel" 2020-01-08 03:05:42 +00:00
Po-Chien Hsueh
ede56ae7ea Remove notification right after clicking on cancel
After aosp/1188881, DynamicSystemManager.remove() is blocked for
about 30 seconds. To give users feedbacks faster when they click on
the [Cancel] button, This CL removes the progress notification
earlier.

Bug: 145891864
Test: Clicking on the [Cancel] button
Change-Id: I4e43775b2de6eaa50d4a1cc073a5057f22f6d8d5
2020-01-02 15:44:26 +08:00
Yo Chiang
a69bb0712d VerificationActivity clones calling Intent
When VerificationActivity receives an Intent, clone the calling Intent's
extras Bundle and pass the whole Bundle into
DynamicSystemInstallationService Intent. Don't unpack and repack the
calling Intent's extras field. Since VerificationActivity aren't using the
contents of the extras Bundle, it shouldn't know about the details of extra.

Test: adb shell am start-activity \
  -n com.android.dynsystem/com.android.dynsystem.VerificationActivity \
  -a android.os.image.action.START_INSTALL \
  --el KEY_USERDATA_SIZE 8589934592 \
  -d file:///storage/emulated/0/Download/aosp_arm64-dsu_test.zip

Change-Id: Ie19b9d4d9ebcbd4623d8c76637da4fa732a4a3c3
2019-12-27 12:43:14 +08:00
Po-Chien Hsueh
99d18dddd2 DSU to support zip files
DSU previously only supports gzipped system images. This CL enables
DSU to also read zipped files. If there are multiple images in the
zipped release, DSU will install them all.

Bug: 134353973
Test: adb shell am start-activity \
    -n com.android.dynsystem/com.android.dynsystem.VerificationActivity \
    -a android.os.image.action.START_INSTALL \
    -d https://dl.google.com/developers/android/qt/images/gsi/aosp_arm64-QP1A.190771.020-5800535.zip \
    --el KEY_USERDATA_SIZE 8589934592
Test: adb shell am start-activity \
    -n com.android.dynsystem/com.android.dynsystem.VerificationActivity \
    -a android.os.image.action.START_INSTALL \
    -d file:///storage/emulated/0/Download/aosp_crosshatch-img-eng.pchsueh.zip \
    --el KEY_USERDATA_SIZE 8589934592

Change-Id: I9c2137d4d81398a9c6153df63a29c16eb8339795
2019-11-22 15:12:22 +08:00
Howard Chen
265f8bfd99 Create a SparseInputstream
SparseInputStream read from upstream and detects the data format.
If the upstream is a valid sparse data, it will unsparse it on the fly.
Otherwise, it just passthrough as is.

Bug: 139510436
Test: \
   java com.android.dynsystem.SparseInputStream system.img system.raw
   simg2img system.img system.raw.golden
   diff system.raw system.raw.golden

Change-Id: Ibc5c130127a455392484467fe32d638be642afa8
2019-11-22 15:11:36 +08:00
Howard Chen
6ea5beddd9 Use the new gsid interface
This CL supports gsid refactoring aosp/1148898.

Test: adb shell am start-activity \
                -n com.android.dynsystem/com.android.dynsystem.VerificationActivity \
                -a android.os.image.action.START_INSTALL \
                -d file:///storage/emulated/0/Download/system.raw.gz \
                --el KEY_SYSTEM_SIZE $(du -b system.raw|cut -f1) \
                --el KEY_USERDATA_SIZE 8589934592
Change-Id: I0209a1b0750e96623f90f134bb18d37254249fbd
2019-11-12 18:29:18 +08:00
Howard Chen
e176c56f6e Use new GsiInstallParams struct
Bug: 139402092
Test: adb shell am start-activity \
            -n com.android.dynsystem/com.android.dynsystem.VerificationActivity \
            -a android.os.image.action.START_INSTALL \
            -d file:///storage/emulated/0/Download/system.raw.gz \
            --el KEY_SYSTEM_SIZE $(du -b system.raw|cut -f1) \
            --el KEY_USERDATA_SIZE 8589934592

Change-Id: I62330ccbe3c863850b545db5e911196d22f518d7
2019-10-24 21:34:43 +00:00
Howard Chen
ae615b32cd Use Ashmem to reduce buffer copies
Use android.os.MemoryFile to allocate Ashmem and use gsid.setAshmem and
gsid.commitGsiChunkFromAshmem to submit data.

Bug: 138976291
Test: adb shell am start-activity \
    -n com.android.dynsystem/com.android.dynsystem.VerificationActivity \
    -a android.os.image.action.START_INSTALL \
    -d file:///storage/emulated/0/Download/system.raw.gz \
    --el KEY_SYSTEM_SIZE $(du -b system.raw|cut -f1) \
    --el KEY_USERDATA_SIZE 8589934592

Change-Id: I6df718a8cc3f4e5835c9d20d0bf5bf8bb0daee22
Merged-In: I6df718a8cc3f4e5835c9d20d0bf5bf8bb0daee22
2019-09-09 18:14:48 +08:00
Howard Chen
c44ee158b9 Clean up usage on deprecated GSID methods
change: Add a oneShot argument to setEnable

remove: commit() and replace it with enableGsi

rename: removeGsiInstall -> removeGsi
rename: disableGsiInstall -> disableGsi

Bug: 138969329
Test: adb shell am start-activity \
    -n com.android.dynsystem/com.android.dynsystem.VerificationActivity \
    -a android.os.image.action.START_INSTALL \
    -d file:///storage/emulated/0/Download/system.raw.gz \
    --el KEY_SYSTEM_SIZE $(du -b system.raw|cut -f1) \
    --el KEY_USERDATA_SIZE 8589934592

Change-Id: I680013c8b1181599f0b858222bd92e31c5f085fd
Merged-In: I680013c8b1181599f0b858222bd92e31c5f085fd
2019-09-09 18:14:29 +08:00
Colin Cross
20bc2bf3f6 Convert more of frameworks/base/packages to Android.bp
See build/soong/README.md for more information.

Bug: 122332340
Test: m DynamicSystemInstallationService InputDevices MtpDocumentsProvider SimAppDialog
Change-Id: I851b819030a1da6091f5d6125a228bb01a99011b
2019-07-24 16:06:52 -07:00