Commit Graph

40 Commits

Author SHA1 Message Date
Bill Yi
f9c3750022 Import translations. DO NOT MERGE ANYWHERE
Auto-generated-cl: translation import
Change-Id: Id288afdf011106f53544658afb564dfd659a7675
2020-11-23 09:04:40 +00:00
Bill Yi
f71dbc4559 Import translations. DO NOT MERGE ANYWHERE
Auto-generated-cl: translation import
Change-Id: Ifa519b1746e37bcd08cdbbce12fe0c05508b0b58
2020-09-14 10:33:03 +00:00
Bill Yi
02d2a3ff08 Import translations. DO NOT MERGE ANYWHERE
Auto-generated-cl: translation import
Change-Id: I6a51714afcd59431df5f33e2d03370944371a885
2020-07-25 01:51:37 -07:00
Po-Chien Hsueh
49db92b0fe 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
Merged-In: If57e0e0f301588f60744678f0ec942e8eb8e8a70
(cherry picked from commit 8f3bdb821c)
2020-04-27 17:10:51 +08:00
Po-Chien Hsueh
1f4f60b787 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
Merged-In: I5fdbcaf5ed28343f53d66b3f02ccb66d3c7920ff
(cherry picked from commit 7ba4d3945a)
2020-03-05 17:29:36 +08:00
Yo Chiang
9834448ca1 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

Merged-In: I52767dfefef394403c5e16fcfd40792b14ff9a71
Change-Id: I52767dfefef394403c5e16fcfd40792b14ff9a71
(cherry picked from commit f41e145480)
2020-02-24 17:13:20 +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
Po-Chien Hsueh
22c1f9ac9f Reduce parcel size to avoid binder transaction failure
Reduce buffer size to 8192 to avoid binder transaction failures.
According to our previous tests. Reducing the buffer size to 8K
doesn't show negative impact on performance.

Bug: 132923636
Test: Successfully install a DSU
Change-Id: Ibe51ab748b4f6c1d3c3ac8286519380ea8afc184
2019-05-21 01:17:30 +00:00
Po-Chien Hsueh
7687aaac1d Check if DSU is in use before feature flag
We are using a feature flag to protect DSU and the device. But when
a Dynamic System is in use, feature flag is set as false by default.

This CL makes DSU bypass feature flag and start GSI service on boot
completed, check if the device is currently running a Dynamic System,
then, stop GSI service if the device isn't.

Bug: 132575851
Test: restart into DSU, check if the "In Use" notification is shown.
Change-Id: I9dabf9bc1716ef18d513278415c6544a5467d510
2019-05-21 01:16:33 +00:00
Po-Chien Hsueh
dfd69d770c Add KEY_ENABLE_WHEN_COMPLETED for testing
Per design, we ask user's confirmation before enabling DSU when
install completed. To simplify the process of testing, this CL adds
a paramenter (intent key) "KEY_ENABLE_WHEN_COMPLETED". If the key is
set, the installation service will not ask user before enabling DSU.

Bug: 131866826
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 893841408
      --el KEY_USERDATA_SIZE 8589934592
      --ez KEY_ENABLE_WHEN_COMPLETED true

Change-Id: Id38c4c0525199594f6bd6704b5a575d4a42b7b61
2019-05-15 02:46:19 +00:00
Po-Chien Hsueh
02778f5712 Rename folder dynandroid to dynsystem
We previously renamed DynamicAndroid to DynamicSystem. Package name
was also changed to com.android.dynsystem. But the folder name was
unchanged. This CL fixes the inconsistency.

Bug: 126613281
Test: make and run the service with 'adb shell am'
Change-Id: Ib462aec1603a16179c8392b6d51a00d0855d9421
2019-04-22 03:15:25 +00:00
Po-Chien Hsueh
ea0a579127 String review follow-up
Rename "Android On Tap" to "Dynamic System Updates".
And, some string changes to follow review suggestions.

Bug: 129100345
Bug: 129330026
Test: make the package
Change-Id: I440e5beaa3831814d2f7f1063be16d073c5f2c38
2019-04-19 10:46:48 +08:00
Po-Chien Hsueh
67697394a2 stopSelf() if there is no installed system image
On BOOT_COMPLETED, the installation checks if there is an installed
system image and shows a notification if there is.

However, if there isn't. The installation should stop itself.

Bug: 128960337
Test: boot and adb shell ps
Change-Id: I422e308020cd5ec127ea265079926c1b74547d4b
2019-04-10 16:19:53 +08:00
Po-Chien Hsueh
9a1627f521 DynamicSystem string review followup
Some changes to follow string review suggestions:
- Simplify some messages.
- Replace 'Reboot' with 'Restart'.
- Notification action button order: 'Restart' button on the right.

Bug: 129100345
Test: verified with test app
Change-Id: I1ee97b0adbf74add68d3561fc647dc4923ee7237
2019-04-09 14:26:38 +08:00
Po-Chien Hsueh
91508ea20d Use setEnable() when there is an installed image
We can now use setEnable() to tell GsiService that we would like
run in DynamicSystem on the next restart, if there is a system
image installed.

Bug: 124613126
Test: Tap the button and setEnabe() is invoked.
Change-Id: I74312af0c87548981ecb4e1ac9a1f3814304a4d5
2019-04-03 07:54:54 +00:00
Po-Chien Hsueh
4167b42f89 Use FeatureFlagPersistent to guard DynamicSystem
Check persistent feature flag 'settings_dynamic_system' before
invoking the installation service. User can still use gsi_tool if
the device is unlocked.

Bug: 119647479
Test: Verified with 'adb shell am' and test app.
Change-Id: If2265d877bc7eedf9b7a107bba04d2e95cf1b89a
2019-04-03 10:29:31 +08:00
Po-Chien Hsueh
6762e2b661 Add a permission, INSTALL_DYNAMIC_SYSTEM
We already have a permission, MANAGE_DYNAMIC_SYSTEM, whose protection
level is signature. Only platform applications holding it can interact
directly with DynamicSystemService, a wrapper of native GsiService. In
our design, DynamicSystemInstallationService is the sole platform app
holding it.

Then we need another permission for non-platform but privileged apps.
This new permission doesn't give apps access to DynamicSystemService,
but only to system API DynamicSystemClient. DynamicSystemClient works
with underneath DynamicSystemInstallationService and allows privileged
apps to install DynamicSystem images and get status updates in our
designed manner.


Bug: 128982216
Test: verified using DynamicSystemClient.
Change-Id: I3e67322511e3ab08db87bfad40d8c3d3cf6fdfe5
2019-03-25 15:55:39 +00:00
Po-Chien Hsueh
c51cf0f76a Send URL using Uri instead of String
Per API review, send the system image file path to the installation
service using Uri.

Bug: 126613281
Test: adb shell am start-activity -d URL
Change-Id: Ib46d3604c16a981b4ae1a571afa96ffdda7a7262
2019-03-21 17:26:20 +08:00
Po-Chien Hsueh
a5bd084a44 Pass exception detail to API user
Per API review, DynamicSystem installation service will also pass
exceptions to users of DynamicSystemClient.

Bug: 126613281
Test: build and run, verified with test app.
Change-Id: I413d6137837eaa968f59550f110da34cea66d4d4
2019-03-21 17:26:09 +08:00
Po-Chien Hsueh
4e908c24ca API review followup: DynamicAndroidClient
Some API changes per API reivew:
- Move DynamicAndroidClient and ~Manager to android.os.image.
- Rename them to DynamicSystemClient and ~Manager.
- Rename permission MANAGE_DYNAMIC_ANDROID to MANAGE_DYNAMIC_SYSTEM
- Corresponding changes in the installation service.
- Corresponding changes in privapp-permissions-platform.xml.
- Add missing annotations.
- Change setOnStatusChangedListener's parameters order.
- Improve documentations.
- Re-generate api/system-current.txt.

Bug: 126613281
Test: adb shell am
Change-Id: Ia920e9ccf6de1dbbd38c52910cb72cb81b9b5b32
2019-03-21 17:25:59 +08:00