153 Commits

Author SHA1 Message Date
Yi-yo Chiang
404c27d323 Merge "DSU service: Log insufficient storage space error" am: 9b420e664a am: 1e43855f6c am: 8c48dc11cf
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2049806

Change-Id: Iee0a17c0517449a523aba8827915af79bc7b11eb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-01 08:46:36 +00:00
Yi-yo Chiang
8c48dc11cf Merge "DSU service: Log insufficient storage space error" am: 9b420e664a am: 1e43855f6c
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2049806

Change-Id: I7b12a1c5d2dfb833c5330c44a35b110fc18c1859
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-01 08:29:33 +00:00
Yi-Yo Chiang
c88a3d9be4 DSU service: Log insufficient storage space error
Log a specialized error message if installation task
failed due to insufficient storage space.
This helps the user to disgnose the source of error.

Bug: 200002443
Test: start DSU task and check logcat
Change-Id: Iabb3e0325ae99c343978ca6c35ab8378f20e0527
2022-03-31 18:38:00 +08:00
Yi-yo Chiang
329edd6026 Merge "DSU service: Pipeline the installation task to improve performance" am: 309fad06f6 am: 1991fbc73b am: 31de7473e8
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2045078

Change-Id: If1a1cc1ddcccc2fda857204b6e59a888a7b2ce62
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-03-30 03:41:26 +00:00
Yi-yo Chiang
31de7473e8 Merge "DSU service: Pipeline the installation task to improve performance" am: 309fad06f6 am: 1991fbc73b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2045078

Change-Id: I79b28d7273f81e741a32d2b77fd7901d7d4e8ef4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-03-30 03:19:57 +00:00
Yi-yo Chiang
ce0668a0bb Merge changes I81b41460,I81561c19 am: a0951c84a9 am: 742b305c1b am: 4beeab1a8e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2044810

Change-Id: I546543e2a2996d38c614efeae9191ff7f60624f7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-03-29 14:21:49 +00:00
Yi-Yo Chiang
8d629110c4 DSU service: Pipeline the installation task to improve performance
Right now the installation task does roughly this:

    while (has partition data left) {
      a. Copy partition data to write buffer.
      b. Copy write buffer to shared memory.
      c. Binder call submitFromAshmem() to inform the consumer of the
         shared memory.
    }

Both task (a) and (c) are I/O intensive and time consuming operations.
However (a) and (c) don't have a strong data dependency, and the only
consistency condition we need to maintain is "task (b) can only be
started once task (c) from the previous iteration is complete."
As soon as (b) is complete, (c) and *(a) of the next iteration* can be
started, pipelining task (a) & (c).

Also enlarge the default shared memory size because there are new
improvements after this change. The new default size (512K) is chosen
somewhat randomly, it's large enough to optimize the installation time
and small enough to not starve most devices' RAM.

Speedup:
  * physical device: 23s -> 18s (14s if shared memory buffer is 512K)
  * virtual device: 19s -> 15s

Bug: 225310919
Test: Install and boot DSU
Change-Id: If7093919762861d19d4fecaf997a699cc1b0fe41
2022-03-29 14:55:49 +08:00
Treehugger Robot
9da5004c56 Merge "Import translations. DO NOT MERGE ANYWHERE" 2022-03-28 06:23:01 +00:00
Bill Yi
2816aee9dc Import translations. DO NOT MERGE ANYWHERE
Auto-generated-cl: translation import
Change-Id: Iada7d093878c7fa6c4ba9e0438b78e7d6d2f29f7
2022-03-27 02:31:25 +00:00
Yi-Yo Chiang
9c074f0f78 DSU service: Show which partition is being installed in notification
Instead of showing "Install in progress", show which partition is being
installed and the total number of partitions, for example:
"Install in progress: system partition [2/3]"

Bug: 169036106
Test: Start a DSU installation and observe the system notification
Change-Id: I81b414606b1e18109ade5a3480931b162bd2a01f
2022-03-26 17:59:32 +08:00
Yi-Yo Chiang
3a9690c357 DSU service: Weighted progress bar
Weight progress of writable partitions less because they take much less
time to complete compared to readonly partitions. This is best effort
only and done only when we can deduce the total number of partitions
beforehand.
Also publish the weighted progress to events log so external tools can
use this value directly, instead of having to calculate this complex
progress weighting themselves.
Revise the events log field name to better reflect the "unit" the
metrics are in (size -> bytes, partition -> partition_name).
DynamicSystemInstallationService notification progress should use this
weighted progress if available.

Bug: 169036106
Bug: 224909776
Test: Start a DSU installation and observe the logcat and system notification
Change-Id: I81561c1994698387b275cab36ee058dd581f9879
2022-03-26 17:58:06 +08:00
Yi-yo Chiang
7aae11ac71 Merge changes from topic "dynamic_system.data_transfer.shared_memory.size" am: f76e45bf6f am: 304b980f44 am: 7f4dfc67e9
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2033045

Change-Id: I10cc178c3c894f0ee8831a34f4df93c20ee3aaa7
2022-03-22 03:23:15 +00:00
Yi-Yo Chiang
fb03539393 dynsystem: Enlarge default shared memory size and allow size override am: 6287488399 am: 8ee811c412 am: b426d136a5
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2033044

Change-Id: I740800b42d4d9dee7aeedf58102460d8601fde29
2022-03-22 03:22:46 +00:00
Yi-Yo Chiang
9b4f3eaf17 dynsystem.SparseInputStream: Implement read(buf, off, len)
InstallationAsyncTask calls SparseInputStream.read(buf, off, len),
however SparseInputStream didn't override that method, so the method
actually fallbacks to the default implementation, which is a for-loop
calling read() (single byte). This is a significant performance hit.

This modest fix boosts the DSU installation time significantly:
* physical device: 45s -> 15s
* virtual device: 30s -> 7s

Bug: 225310919
Test: start a Dynamic System installation
Change-Id: I5a61dc2e9554719aece43491b813f6647b4bcc65
2022-03-20 16:49:32 +08:00
Yi-Yo Chiang
6287488399 dynsystem: Enlarge default shared memory size and allow size override
This modest adjustment 8KiB -> 64KiB significantly boosts the DSU
installation time:

* physical device: 2m34s -> 45s
* virtual device: 46s -> 30s

Also make the shared memory size customizable for fine-tuning.

Bug: 225310919
Test: start a Dynamic System installation and check its execution time.
Change-Id: I0418ba19c3824d31feafce54a71c054061d010e8
2022-03-19 16:58:45 +08:00
Yi-yo Chiang
5ec218abb5 Merge "DSU installation service: Add event log tags" am: 172f4ac338 am: 5cc5036f0c am: 63470d1b22
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2028284

Change-Id: Idc034ce24ebad58253a6ce02834d8ccc8c987d38
2022-03-19 07:10:01 +00:00
Yi-Yo Chiang
d43cfe48e9 DSU installation service: Add event log tags
Log important events to the 'events' buffer so other tools can robustly
and progmatically parse the DSU logs.

Bug: 224909776
Test: adb logcat -b events -v descriptive \
  '*:S dsu_progress_update dsu_install_complete dsu_install_failed'
Change-Id: Iac8d3ec31f51eb9410eb631487e26b4ccb0ccf81
2022-03-17 17:14:46 +08:00
Treehugger Robot
1fd66a1e68 Merge "Fix unwanted sign-extention when converting byte -> int" am: dc59956478 am: ebf3f814e8 am: 4814db65ee
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1993170

Change-Id: I63dfd785beaa3c24418bf1dbfb7cae504f7b8972
2022-02-22 02:51:29 +00:00
Treehugger Robot
ebf3f814e8 Merge "Fix unwanted sign-extention when converting byte -> int" am: dc59956478
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1993170

Change-Id: Iae8390aca8aa53e758e3b82ef4f192bb19b483fe
2022-02-22 02:39:38 +00:00
Yi-Yo Chiang
428f499930 Fix unwanted sign-extention when converting byte -> int
byte(255) converts to int(-1). This is not what we want, we want
int(255), in other words unsigned conversion.

This bug is causing premature EOF when read() is called, because when a
byte(255) is returned, it gets sign-extend to int(-1), causing the
caller to think EOF is reached.

Bug: 217427392
Test: Presubmit
Change-Id: I8ee864816c77cfe2900f5e300d7d4411cce6753a
2022-02-21 21:07:22 +08:00
Bill Yi
c94621d086 Import translations. DO NOT MERGE ANYWHERE
Auto-generated-cl: translation import
Change-Id: Ie6a18d00feee0fff3358287bd65c6deb3c344ddc
2022-01-26 02:25:56 +00:00
Bill Yi
43a6c489e3 Import translations. DO NOT MERGE ANYWHERE
Auto-generated-cl: translation import
Change-Id: I8a0e3fa1236956e4f9315708315905465d427ce0
2022-01-10 15:06:31 +00:00
Julia Reynolds
ce8f496e21 Dynamic System Installation Service: post notifications permission
so the package can send notifications on T+

Bug: 194833441
Change-Id: I2e25730d70f35bca1df9ab41d29838d91230b6fc
2021-12-03 20:07:35 +00:00
John Wu
30dbf0e8df Merge "Update DynamicSystemInstallationService manifest" am: 703378f39c am: 2f6ec8e09e am: 266d79d0c1 am: eee1763bf9 am: 8bc1803c4f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1793447

Change-Id: I6fbc7ed167453210971e5801d123925ccb539df4
2021-08-11 18:28:51 +00:00
John Wu
266d79d0c1 Merge "Update DynamicSystemInstallationService manifest" am: 703378f39c am: 2f6ec8e09e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1793447

Change-Id: Ia3b0795a883fe21e030d82dcdac2c6a5d88fc725
2021-08-11 17:38:31 +00:00
John Wu
2508f7b926 Update DynamicSystemInstallationService manifest
Add additional data specifications in VerificationActivity's
<intent-filter>.

Bug: 195988279
Test: atest CtsOsTestCases:DynamicSystemClientTest
Change-Id: Iabe53ed421ce23f0f7062e9b9d92c29c47cc98ab
2021-08-11 10:06:38 +00:00
Bill Yi
96997be52a Import translations. DO NOT MERGE ANYWHERE
Auto-generated-cl: translation import
Change-Id: I68693811c7dba560b843030a3507c1da86a19ea2
2021-07-03 19:09:32 -07:00
Bill Yi
ca76df1d44 Import translations. DO NOT MERGE ANYWHERE
Auto-generated-cl: translation import
Change-Id: I36858729d3e726c65c2f2d5ae235f06647ede3fe
2021-06-11 10:45:32 +00:00
Treehugger Robot
42da036847 Merge "DSUService: Log verbose installation progress" am: 4463102095 am: b24386b51f am: f33515f618
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1662401

Change-Id: If040e47adf0805021253c74e3f564cd9b699fb24
2021-05-12 10:33:56 +00:00
Treehugger Robot
f33515f618 Merge "DSUService: Log verbose installation progress" am: 4463102095 am: b24386b51f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1662401

Change-Id: I622547967e10ae8b9363a560e6b1895612a5ea7b
2021-05-12 10:25:14 +00:00
Yo Chiang
00056f978e Merge "DSUService: Deduplicate InstallUserdata() and InstallScratch()" am: c2c3a3c7d4 am: 5f2f17fc4a am: 4730b8f002
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1662402

Change-Id: Id1623079f1dbf0fe8bb27d67720542fc57c872a1
2021-05-12 10:21:25 +00:00
Yo Chiang
4730b8f002 Merge "DSUService: Deduplicate InstallUserdata() and InstallScratch()" am: c2c3a3c7d4 am: 5f2f17fc4a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1662402

Change-Id: I08e9707a2a6ecf8b82c12595335aa22adc4ec165
2021-05-12 10:12:34 +00:00
Treehugger Robot
b24386b51f Merge "DSUService: Log verbose installation progress" am: 4463102095
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1662401

Change-Id: I948e7c49d857083d6e3aacfd38d992da557d998c
2021-05-12 10:10:37 +00:00
Yo Chiang
5f2f17fc4a Merge "DSUService: Deduplicate InstallUserdata() and InstallScratch()" am: c2c3a3c7d4
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1662402

Change-Id: Ifd3f768bd8fbda78a8909f0eca01da4fbf609cbf
2021-05-12 10:02:17 +00:00
Treehugger Robot
4463102095 Merge "DSUService: Log verbose installation progress" 2021-05-12 09:52:05 +00:00
Yi-Yo Chiang
677dfeae2d DSUService: Deduplicate InstallUserdata() and InstallScratch()
Factor out common code and some minor polishing.

Bug: 165471299
Test: Fire a DSU installation and observe logcat
Change-Id: Ia13db74c038e49d888e69e43b59ab0ad5b078464
2021-05-12 06:58:06 +00:00
Yi-Yo Chiang
a3f91296ce DSUService: Log verbose installation progress
Log the installation progress in logcat if feasible.

Bug: 181043054
Bug: 165471299
Test: Fire a DSU installation and observe logcat
Change-Id: Ib82783f2dfe310335725f39053eaa940d96e7198
2021-05-12 14:32:18 +08:00
Bill Yi
88feba2add Import translations. DO NOT MERGE ANYWHERE
Auto-generated-cl: translation import
Change-Id: I2e99f61b7383493f7f99275902d56defa27f1705
2021-04-22 09:03:02 -07:00
Bill Yi
b14fae8bf2 Import translations. DO NOT MERGE ANYWHERE
Auto-generated-cl: translation import
Change-Id: I5502c6423a240a71f2801fc43f803d2690ef3756
2021-04-16 15:05:11 +00:00
Bill Yi
ac157d0ff3 Import translations. DO NOT MERGE ANYWHERE
Auto-generated-cl: translation import
Change-Id: I3d5695ecd9099b9828123f66f2c3bf08093b1944
2021-04-09 12:20:10 -07:00
Bill Yi
f3a8a92908 Import translations. DO NOT MERGE ANYWHERE
Auto-generated-cl: translation import
Change-Id: Ie5521374f970652f02b0a0a7999ddfbf4f547530
2021-03-30 23:04:31 +00:00
Treehugger Robot
c3bd9def30 Merge "Refactor DynamicSystemInstallationService notifications" am: fe4b43da67 am: d41966bca6 am: 4eb4aa3a8a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1541269

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I9bd2504346685aaca8289af3d3a50e19a011d606
2021-03-12 09:07:42 +00:00
Treehugger Robot
fe4b43da67 Merge "Refactor DynamicSystemInstallationService notifications" 2021-03-12 07:48:51 +00:00
Yo Chiang
b3881305c5 Merge "Ignore InterruptedException from Thread.sleep()" am: ffdc8928ac am: 6fe70ef0c1 am: e9a848ea57
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1541644

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I34e7d3ec350fc88b18cce4df166761e2ec69e086
2021-03-11 13:00:40 +00:00
Yo Chiang
d110e02fad Ignore InterruptedException from Thread.sleep()
It's probably harmless that Thread.sleep() is interrupted, so ignore the
error.

Bug: 165471299
Test: None
Change-Id: I86e07fe82875172c84f96176b4368ead7b60d09d
2021-03-11 08:44:03 +00:00
Yo Chiang
c4f0b0099a Refactor DynamicSystemInstallationService notifications
Right now we use two flags to track the internal states of DSU
notifications, mJustCancelledByUser and mKeepNotification. This makes
the notification posting / dismissing logic very complicated, as any
method can potentially modify the flags.

This change refactors the logic around postStatus() and
resetTaskAndStop() and remove the two flags. After this change,
notification posting logic are consolidated within postStatus() and
dismissing logic are consolidated within resetTaskAndStop().

Bug: 165471299
Test: Start a DSU installation and test "cancel" & "discard"
Change-Id: I59548553e0e92399d322c301011dfd270e7bb0e9
2021-03-11 08:32:53 +00:00
Xin Li
1af6a12e98 Merge "Merge RQ2A.210305.007" 2021-03-03 21:41:39 +00:00
Yo Chiang
47b02fee45 Merge "DSUService: stopSelf() only if no ongoing installation" am: 0fb5c3f306 am: 3121af69d3 am: 7ec7d60f45
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1609094

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I07d45bb2ce07850d05d3bfaa798075a2ebbaa19e
2021-03-03 13:28:41 +00:00
Yo Chiang
3121af69d3 Merge "DSUService: stopSelf() only if no ongoing installation" am: 0fb5c3f306
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1609094

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I9ec7b60e0a5d964db91e84bb1ebb4c751eda5cf5
2021-03-03 08:21:05 +00:00
Yi-Yo Chiang
5991432043 DSUService: stopSelf() only if no ongoing installation
If you are fast and start a DSU installation before the BOOT_COMPLETE
broadcast receiver can start, than the executeNotifyIfInUseCommand()
would destroy the on-going installation session, which is mildly
irritating.

Bug: 165471299
Test: Presubmit
Change-Id: Iaf6a165ece7d2b4a531a78845122046c19d456a7
2021-02-26 20:02:08 +08:00