Commit Graph

10902 Commits

Author SHA1 Message Date
Dmitri Plotnikov
3416dc96f1 Merge "Add CPU time-in-state data to battery history" 2022-10-06 16:51:23 +00:00
Dmitri Plotnikov
c70cff6ad7 Add CPU time-in-state data to battery history
Bug: 244623253
Test: atest FrameworksServicesTests:BatteryStatsHistoryTest

Change-Id: I12ca7e8951e00bcc264f74b84b14b1c51cb095a8
2022-10-05 18:36:16 -07:00
Hao Ke
7c4f30abe0 Merge "Update Parcel readLazyValue to ignore negative object lengths" into tm-qpr-dev am: 1616c18830 am: a7af799f90
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20111891

Change-Id: I05cb905d2d9c18035b59d2232a25930c2ad8198e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-10-05 21:28:39 +00:00
Hao Ke
a7af799f90 Merge "Update Parcel readLazyValue to ignore negative object lengths" into tm-qpr-dev am: 1616c18830
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20111891

Change-Id: I4217009290de35449c380f6636838e5870674d54
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-10-05 20:36:26 +00:00
Hao Ke
1616c18830 Merge "Update Parcel readLazyValue to ignore negative object lengths" into tm-qpr-dev 2022-10-05 20:03:42 +00:00
T.J. Mercier
79825c6f2f Freeze package cgroup before killing
Apps are able to prevent their death by forking multiple processes
under different services and monitoring for the death of any of these.
When a child death is detected, the remaining process restarts the
terminating/terminated service before it's able to be killed itself.
This is now prevented by freezing the entire cgroup of the package to be
killed before killing the individual processes. After the kills are
completed synchronously, the cgroup can be unfrozen to allow for
restarts. Before freezing the cgroup, the binder interfaces of the
processes about to be frozen are also frozen to prevent indefinite
blocking by synchronous Binder callers.

Bug: 236708592
Bug: 148425913
Test: raven:/ $ monkey -p com.haok.nirvana 1
Test: bash arg: -p
Test: bash arg: com.haok.nirvana
Test: bash arg: 1
Test: args: [-p, com.haok.nirvana, 1]
Test: arg: "-p"
Test: arg: "com.haok.nirvana"
Test: arg: "1"
Test: data="com.haok.nirvana"
Test: Events injected: 1
Test: ## Network stats: elapsed time=14ms (0ms mobile, 0ms wifi, 14ms not connected)
Test: raven:/ $ ps -eo pid,uid,ppid,name|grep 10266
Test: 2499 10266   823 com.haok.nirvana
Test: 2577 10266   823 com.haok.nirvana:resident
Test: 2584 10266   823 android.media
Test: 2669 10266     1 app_d
Test: 2672 10266     1 app_d
Test: raven:/ $ am force-stop com.haok.nirvana
Test: raven:/ $ ps -eo pid,uid,ppid,name|grep 10266
Test: 1|raven:/ $
Test: atest PermissionControllerHostTest
Change-Id: I1718a9263a01d18da7e3d2e3771091cf8475e599
2022-10-05 00:49:39 +00:00
TreeHugger Robot
626dfc8928 Merge "Add proto output of battery usage stats" into tm-qpr-dev am: eb59079888
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20107348

Change-Id: I4edeb8faa2a1c6cd7d4c48522cece62645bfaaf7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-10-04 22:16:41 +00:00
Tim Murray
0b2c9f211f Merge "PowerManager: cleanup async traces" 2022-10-04 21:21:07 +00:00
Eric Biggers
fd8bf04f1f Merge changes from topic "sps-on-creation"
* changes:
  Make the CE key always be encrypted by the synthetic password
  Give all users SP-based credentials
  Unlock user keys from LockSettingsService only
2022-10-04 20:21:45 +00:00
Tim Murray
4bbe0cebf0 PowerManager: cleanup async traces
Merge WakeLock trace tracks into "WakeLocks" and SuspendBlocker tracks
into "SuspendBlockers" to create fewer tracks and make traces easier
to navigate.

Test: WakeLock/SuspendBlocker traces appear
Bug: 250614152
Change-Id: Ifadc31368d5ea3c5954aeef0d0d056a66ff94213
2022-10-04 10:55:38 -07:00
Hani Kazmi
8e01230dd2 Update Parcel readLazyValue to ignore negative object lengths
Addresses a security vulnerability where a (-8) length object would
cause dataPosition to be reset back to the statt of the value, and be
re-read again.

Bug: 240138294
Test: atest ParcelTest BundleTest AmbiguousBundlesTest
Test: manually ran PoC
Change-Id: I1ab1df6f2a802d8cdf02c89c12959b09d7b1a5c4
Merged-In: I1ab1df6f2a802d8cdf02c89c12959b09d7b1a5c4
2022-10-04 17:32:07 +00:00
Eric Biggers
d20b250477 Make the CE key always be encrypted by the synthetic password
Currently, whenever an LSKF isn't set, the CE key isn't encrypted by the
SP but rather by a non-auth-bound Keystore key.  This is inconsistent,
and it's preventing us from taking advantage of the secure deletion
support of Weaver (on devices that support Weaver), with the current
scheme relying entirely on rollback resistance support in Keystore.

Therefore, make the CE key always be encrypted by the SP-derived key.

To do this, encrypt the CE key by the SP-derived key when the SP is
initially created.  After the corresponding vold change, this will start
being the only time that the CE key is written to disk at all.

Also re-encrypt the CE key of existing users who don't have an LSKF, so
that we don't have to continue to support the legacy scheme.

Both operations are done via the new vold method setUserKeyProtection()
(accessed via StorageManagerService), which (re-)encrypts the CE key
using the given secret.  The CE key must be either not-yet-persisted or
default-encrypted.  This method replaces addUserKeyAuth(),
clearUserKeyAuth(), and fixateUserKeyAuth().

On the unlock side, make unlockUserKeyIfUnsecured() unwrap the SP and
unlock the CE key using it.  As this makes
tryDeriveVendorAuthSecretForUnsecuredPrimaryUser() no longer needed,
remove that too.

Test: atest com.android.server.locksettings && \
      atest com.android.server.am.UserControllerTest \
            com.android.server.pm.UserManagerServiceTest \
            com.android.server.pm.UserManagerTest
Test: Booted and rebooted Cuttlefish, both phone and auto builds
Test: Without the CLs in this topic, set up a Pixel 6 to have a user
      with an LSKF, a user with no LSKF or SP, and a user with an SP but
      no LSKF.  Upgraded to the CLs in this topic.  Checked log for
      the expected messages from LockSettingsService.  Verified that all
      the users can still be unlocked.  Verified that
      /data/system_de/$userId/spblob exists for all users, and that
      /data/misc/vold/user_keys/ce/$userId/encrypted_key exists but not
      a keymaster_key_blob file alongside it.  Verified that
      /data/system/locksettings.db contains
      migrated_all_users_to_sp_and_bound_ce=true.
Bug: 232452368
Change-Id: Ia753ea21bbaca8ef7a90c03fe73b66c896b1536e
2022-10-04 16:41:28 +00:00
Eric Biggers
3d5653e11e Unlock user keys from LockSettingsService only
In preparation for making the CE key of each user always be protected by
the user's synthetic password even when the user has no LSKF, make
LockSettingsService the sole caller of IStorageManager.unlockUserKey().

For the opportunistic secret-less unlock by UserController at user start
time, call a new method LSS.unlockUserKeyIfUnsecured().  For now this
method calls IStorageManager.unlockUserKey() with a null secret.  Later
it will unwrap the user's synthetic password if needed.

For the unlock via credential verification that is triggered by LSS,
make LSS call IStorageManager.unlockUserKey() before calling
IActivityManager.unlockUser(), rather than passing the SP-derived secret
to IActivityManager.unlockUser() for it to do the unlockUserKey().

Since neither the secret nor the token arguments to
IActivityManager.unlockUser() are used anymore, add a new method
IActivityManager.unlockUser2() that lacks these arguments.  Note that
method name overloading cannot be used because AIDL doesn't support it.

Test: atest com.android.server.locksettings && \
      atest com.android.server.am.UserControllerTest \
            com.android.server.pm.UserManagerServiceTest \
            com.android.server.pm.UserManagerTest
Test: Boot and reboot Cuttlefish
Bug: 232452368
Change-Id: I8971b92bb5055fca8e19e0f9d14e8f0a7022b453
2022-10-04 16:41:23 +00:00
Dmitri Plotnikov
eb91d0c6cd Add proto output of battery usage stats
Bug: 245832387
Test: adb shell dumpsys batterystats --usage --proto | \
      gqui from rawproto:- proto $ANDROID_BUILD_TOP/frameworks/base/core/proto/android/os/batteryusagestats.proto:android.os.BatteryUsageStatsAtomsProto --protoprint_annotations=no
Change-Id: I297f09892accf0d2adef41d4cbd384a505c9c189
(cherry picked from commit db0d388e48)
2022-10-04 01:01:45 +00:00
Jeff Sharkey
8ccb8be42f Handle accidental null arguments to Trace APIs.
We have @NonNull annotations, but not everyone is watching the warning
messages related to them.  Make the implementation a bit more robust
by swapping in the "(null)" literal when someone accidentally leaks
one through.

Bug: 249325721
Test: atest FrameworksCoreTests:TraceTest
Change-Id: Ic0f5a0236fbce88e086f3d68b2e5c6ed6b0aa33c
2022-10-03 15:34:51 -06:00
Michael Wright
5e009b253c Merge "Reconcile WorkSource parcel and unparcel code." 2022-10-01 12:32:04 +00:00
Nikhil Kumar
d4a001386b Remove associated profiles when removing a user
Modified remove user flow to delete the associated profiles when
deleting the user.

Test: atest UserManagerTest

Bug: 217758779
Change-Id: If0943cedd3892789f41cacbd4e0311fb9061b719
2022-09-30 14:51:03 +01:00
Steven Moreland
ccfc86ed79 Merge "Parcel: more stacks printed when recycle twice." am: 31075f2951 am: 97b1f3149b am: 72b727c7c7 am: f24decea67 am: 4d78aee579
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2237374

Change-Id: I6554b3261b9f88e5e60e6bf8f8963d7d8f62f055
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-29 23:38:29 +00:00
Steven Moreland
4d78aee579 Merge "Parcel: more stacks printed when recycle twice." am: 31075f2951 am: 97b1f3149b am: 72b727c7c7 am: f24decea67
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2237374

Change-Id: Icc979e323fecac342eb5cd82d16895f81ddf0d7f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-29 22:55:12 +00:00
Steven Moreland
72b727c7c7 Merge "Parcel: more stacks printed when recycle twice." am: 31075f2951 am: 97b1f3149b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2237374

Change-Id: I186d0998a0dda2eb4eff7ee334c83a33a7c60625
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-29 21:44:29 +00:00
Steven Moreland
31075f2951 Merge "Parcel: more stacks printed when recycle twice." 2022-09-29 20:48:15 +00:00
Steven Moreland
cdb5f00ecb Parcel: more stacks printed when recycle twice.
We can print the second stack by default.

Bug: 243768096
Test: N/A
Change-Id: I49d4e72f87c15fc04ddf94a19ff8f76512b6ebbc
2022-09-29 01:00:47 +00:00
Juan Yescas
25b673f920 Merge changes from topic "ddr_size_api" am: c12a383385 am: a4ed6716da am: 12ffdf5523 am: 4b3bbca1c6 am: 1713d59d14
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2193505

Change-Id: Ic19697f393bdde52e463eeb6b1f00c2cfb6dea53
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-27 22:07:12 +00:00
Juan Yescas
ee06f03d35 Add method to parse the size in FileUtils am: 71e11ae9ba am: ab61310d91 am: 7158f0deaa am: 86b3d4dd2e am: 4a61cdf513
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2192359

Change-Id: I39ec1d099c0fb27f91810b442e011f682f2a455f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-27 22:06:29 +00:00
Juan Yescas
1713d59d14 Merge changes from topic "ddr_size_api" am: c12a383385 am: a4ed6716da am: 12ffdf5523 am: 4b3bbca1c6
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2193505

Change-Id: I539c176132222b3a024cb789ea7808dc386e6fe2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-27 22:00:06 +00:00
Juan Yescas
4a61cdf513 Add method to parse the size in FileUtils am: 71e11ae9ba am: ab61310d91 am: 7158f0deaa am: 86b3d4dd2e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2192359

Change-Id: I5eb67f191d7cf4406a35fb52aa73be893cffc396
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-27 21:59:56 +00:00
Juan Yescas
12ffdf5523 Merge changes from topic "ddr_size_api" am: c12a383385 am: a4ed6716da
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2193505

Change-Id: I872060fbb5e3d4ba311ed83c7be539e9925e573c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-27 21:02:01 +00:00
Juan Yescas
7158f0deaa Add method to parse the size in FileUtils am: 71e11ae9ba am: ab61310d91
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2192359

Change-Id: I01b5f1e175b412c67e0ada83bcd45be22e3af85a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-27 21:01:54 +00:00
Juan Yescas
7afbbec42f Add new field in MemoryInfo to get advertised memory size.
This API will get the advertised memory size from the bootloader parameter
passed to the kernel. The advertised memory size might be different from
the MemTotal value in /proc/meminfo. This could be due the original design
manufacturer (ODM) reserved part of the memory for the Trusted Execution
Environment.

Test: Run test caes
Bug: 231718727
Change-Id: I06494cb9013048d73a83f2180a9241c2259d46eb
2022-09-27 15:11:52 +00:00
Juan Yescas
71e11ae9ba Add method to parse the size in FileUtils
The method parseSize() will parse the strings that match
the regular expression:

  "^((\\s*[-+]?[0-9]+)\\s*(B|K|KB|M|MB|G|GB|Ki|KiB|Mi|MiB|Gi|GiB)\\s*)$"

For example: 12GB, +100MB, 23MiB.

It will return the size in bytes.

Test: atest
Bug: 231718727
Change-Id: Id4b9084d2ff8a0a8bd23ddb8a7e10dcf17391c49
2022-09-27 15:11:05 +00:00
Felipe Leme
b9e759bb68 Merge "Disabled support for profiles on secondary displays." 2022-09-26 22:36:11 +00:00
Michael Wright
63a336737a Reconcile WorkSource parcel and unparcel code.
Prior to this CL, WorkSources would Parcel their list of WorkChains as
-1 if null, or the size of the list followed by the list itself if
non-null. When reading it back in, on the other hand, they would check
if the size was positive, and only then read the list from the Parcel.
This works for all cases except when the WorkSource has an empty but
non-null list of WorkChains as the list would get written to the parcel,
but then never read on the other side.

If parceling a list was a no-op when empty this wouldn't be an issue,
but it must write at least its size into the parcel to know how many
elements to extract. In the empty list case, this single element is left
unread as the size is not positive which essentially corrupts any future
items read from that same parcelable.

Bug: 220302519
Test: atest android.security.cts.WorkSourceTest#testWorkChainParceling
Change-Id: I2fec40dfced420ca38e717059b0e95ee8ef9946a
2022-09-26 20:37:33 +01:00
Kweku Adams
9acefa4233 Merge "Drop invalid data." 2022-09-24 00:50:03 +00:00
Kweku Adams
666e8ac60a Drop invalid data.
Drop invalid data when writing or reading from XML. PersistableBundle
does lazy unparcelling, so checking the values during unparcelling would
remove the benefit of the lazy unparcelling. Checking the validity when
writing to or reading from XML seems like the best alternative.

Bug: 246542285
Test: install test app with invalid job config, start app to schedule job, then check logcat and jobscheduler persisted file
Change-Id: Ie817aa0993e9046cb313a750d2323cadc8c1ef15
2022-09-23 21:24:33 +00:00
Steven Moreland
028f966593 Merge "Fix Parcel::readTypedList javadoc." 2022-09-23 16:15:32 +00:00
Felipe Leme
39f761d00e Disabled support for profiles on secondary displays.
Test: atest UserManagerInternalTest UserControllerTest \
  FrameworksMockingServicesTests:UserManagerServiceTest \
  android.multiuser.cts.UserManagerTest MultipleUsersOnMultipleDisplaysTest

Bug: 245963156

Change-Id: I1b44bed725e05b27a167f8a1e4bde3621f805c40
2022-09-23 15:11:34 +00:00
Zimuzo Ezeozue
8c878f6b9e Merge "Populate binder trace txn names lazily" 2022-09-23 09:53:26 +00:00
Zim
915e6c11af Populate binder trace txn names lazily
Previously, for each binder interface, we populated a cache of all
txn codes to names on the first binder txn to that interface. This
skewed the binder txn latency significantly for the first txn to an
interface.

Now, we lazily populate the cache on each new binder txn.

Test: atest open-prebuilt-calculator --rebuild-module-info
--tf-template metric_post_processor=
google/template/postprocessors/metric-file-aggregate.xml
(neglible startup time diff locally)
Bug: 246650647

Change-Id: Ib569ebe34e7ef6bb4fa6e53defedcb33ed824308
2022-09-22 01:02:26 +01:00
Tetiana Meronyk
16c011fa72 Merge "Move part of UserManager method isUserSwitcherEnabled to UserManagerService" 2022-09-21 20:42:29 +00:00
Himanshu Gupta
e775b14da7 Merge "Fixing Storage Volume listing for Cloned User." 2022-09-21 16:47:21 +00:00
Himanshu Gupta
4e65c53b43 Fixing Storage Volume listing for Cloned User.
Current implementation only returns the Volumes for the current user.
In case of Cloned user this causes issues as Cloned user uses Media
Provider of User 0, thereby returning only Volume 0, causing problems in
assigning projectIds, and affecting storage calculation.
The projectId assignement happens via
MediaProvider.updateExternalStorageFileQuota.

Bug: 235321217
Test: atest android.appsecurity.cts.StorageHostTest
Change-Id: I617bae9b201fd66d7b62b6cbd1c48b9f276f1924
2022-09-21 15:44:23 +01:00
Tetiana Meronyk
2e00a28567 Move part of UserManager method isUserSwitcherEnabled to UserManagerService
Bug: 242812503
Test: atest UserManagerServiceTest
Change-Id: I513ba7a9060e3fd5bca365f8354850ca1cfce542
2022-09-21 13:58:29 +00:00
Kunal Malhotra
b0af2f9b9f Merge "Removing the word "default" from JavaDocs as these do not seem to be the default policy" 2022-09-20 16:49:30 +00:00
Martijn Coenen
5388eecf70 Fix Parcel::readTypedList javadoc.
It does not have a return value.

Bug: 204035706
Test: N/A
Change-Id: Ia821cbd7ebac9a2d51a1af7c9c27d6450a90f998
2022-09-20 07:16:43 +00:00
TreeHugger Robot
404b70e411 Merge "Makes UM.isUsersOnSecondaryDisplaysSupported() @TestApi" 2022-09-20 02:59:22 +00:00
Kunal Malhotra
cc4d2a3bda Removing the word "default" from JavaDocs as these do not seem to be the
default policy

Test: manual
Change-Id: I7a3b0cadfd5d6220b5667ef7e244d55b7c3499ba
2022-09-20 00:09:12 +00:00
Treehugger Robot
8f49373913 Merge "Clarify method names and improve debug" am: 1ab7ac7f56 am: 1d74b8207b am: a6a8219798 am: f1f8a7519c am: dd2eed7053
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2217306

Change-Id: I35466159e53b25b3b00c0b2afd540a265b43f482
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-17 12:35:25 +00:00
Lais Andrade
864d640e8d Merge "Remove VibrationEffect javadocs to methods not available in public APIs." into tm-dev am: 40739d5379 am: 6c9ae0c881
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19927366

Change-Id: Ic1f5ba8452dd775377d3e60400f274cc8747f9d7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-16 15:33:10 +00:00
Treehugger Robot
dd2eed7053 Merge "Clarify method names and improve debug" am: 1ab7ac7f56 am: 1d74b8207b am: a6a8219798 am: f1f8a7519c
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2217306

Change-Id: I0139bcffa3e11a90e36e228d371f478ae851d5c9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-16 13:58:32 +00:00
Treehugger Robot
a6a8219798 Merge "Clarify method names and improve debug" am: 1ab7ac7f56 am: 1d74b8207b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2217306

Change-Id: I922d2d8012d82ce7dfa8a1c70e2582b60e98761e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-16 12:47:39 +00:00