Commit Graph

66 Commits

Author SHA1 Message Date
Treehugger Robot
b704222433 Merge "Change log tag of DynamicSystemClient to match class name" am: 916dfddfd0 am: 198e4b4c4b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1537885

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I36612768f8f876e93c624ed59d7c92bed7ae8b2d
2021-01-06 11:24:01 +00:00
Treehugger Robot
916dfddfd0 Merge "Change log tag of DynamicSystemClient to match class name" 2021-01-06 11:11:58 +00:00
Yo Chiang
ddff5bca30 Merge "DynamicSystemInstallationService: Support remount for DSU guest system" am: 4896c7f2ac am: b64a3f5871
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1537222

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ic2468f5f90cc7ae789ab0a1b5eaa4262e279c429
2021-01-06 09:45:56 +00:00
Yo Chiang
cd65cd4e04 Change log tag of DynamicSystemClient to match class name
Expand the "DynSystem" abbreviation to "DynamicSystem".
For simpler log grepping.

Bug: 165471299
Test: No
Change-Id: Ibec692ae45539dacd55e13ffaa903b58f3bf0417
2021-01-06 08:24:16 +00:00
Yo Chiang
848bcdc42a DynamicSystemInstallationService: Support remount for DSU guest system
DSU service would try to install a DSU scratch partition if host system
is debuggable.
If the scratch partition failed to install, then skip installing
scratch, as remount support should be optional.
Otherwise if the guest system is non-debuggable, then the scratch
partition would be ignored by guest, which is harmless.
Otherwise the guest system is debuggable, which means the guest system
would be able to do adb remount.

Relax partition allocation status polling rate from 10ms -> 100ms,
because there's no point polling faster than the screen framerate.

Bug: 165925766
Test: TH
Test: Install a DSU system on a debuggable host, reboot into the guest
  system, and guest system can remount.
Change-Id: I9a8255483cc963ebcf7a2909e68ac69371cb369f
2021-01-05 15:38:42 +08:00
Yo Chiang
df076f3e17 Merge "Update OWNERS file for DynamicSystemInstallationService related files" am: d15cbc37d5 am: da54c495b6
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1537268

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I88527e0b97e6a3705935bde0e89760435e0bb46b
2021-01-05 04:42:37 +00:00
Yo Chiang
d15cbc37d5 Merge "Update OWNERS file for DynamicSystemInstallationService related files" 2021-01-05 03:34:39 +00:00
Yo Chiang
70aa429243 Update OWNERS file for DynamicSystemInstallationService related files
Also sort OWNERS by alphabetical order.

Bug: 165925766
Test: No
Change-Id: Ib272ba802d0f7281aa2d1bbc8b74dc5954dbe13c
2020-12-31 14:10:36 +08:00
Yo Chiang
2103e9b0d7 Merge "Refactor InstallationAsyncTask.Progress" am: 93e3644f88 am: 33ad4e1225
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1537221

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ia4d25259d14eb51cf4d60c7e3e1bf774b5073a77
2020-12-31 04:28:42 +00:00
Yo Chiang
93e3644f88 Merge "Refactor InstallationAsyncTask.Progress" 2020-12-31 03:18:26 +00:00
Treehugger Robot
25dd5b0894 Merge "Add OWNERS file for packages/DynamicSystemInstallationService" am: 4c7a71448d am: f75c4574ab
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1536709

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I96f8798965a22e401c4548809db8c0e714b0b120
2020-12-30 16:12:08 +00:00
Yo Chiang
e6271f5c16 Add OWNERS file for packages/DynamicSystemInstallationService
Bug: 165925766
Test: No
Change-Id: I816bcfdaa960af08269ae6c864fd2d33b631bedd
2020-12-30 20:51:04 +08:00
Yo Chiang
0a63f5592c Refactor InstallationAsyncTask.Progress
Instead of passing a number around as the number of installed
partitions, track the number in a member field in InstallationAsyncTask.
This makes installing partitions after installImages() had returned
possible.

Bug: 165925766
Test: TH
Change-Id: Iec45c9fa1a39f0bcc4eeaa00e44d3394d55087d3
2020-12-30 20:08:42 +08:00
Bill Yi
d90f296dd0 Import translations. DO NOT MERGE ANYWHERE
Auto-generated-cl: translation import
Change-Id: Ib4c485293281b1588e90ae799afcd1b8d4528c66
2020-12-05 19:29:22 +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
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
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
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
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
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
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
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