Commit Graph

9971 Commits

Author SHA1 Message Date
TreeHugger Robot
f86b4b4974 Merge "Go to sleep on fold for foldable devices." 2021-11-16 04:09:38 +00:00
Makoto Onuki
a6a60b7750 Cache more users in UserHandle.of()
We pass around more and more UserHandle these days because of mainline
modules, because even @SystemApi are not allowed to use integer user
IDs.

So let's make sure even in extreme cases we don't keep allocating
new UserHandle's for the same user.

Test: atest $ANDROID_BUILD_TOP/frameworks/base/core/tests/coretests/src/android/os/UserHandleTest.java
Test: atest $ANDROID_BUILD_TOP/cts/tests/app/src/android/app/cts/UserHandleTest.java
Change-Id: Iae34e1d11638ced53246d68d310ad62e058dba93
2021-11-10 15:42:19 -08:00
Donald Chai
a67a245111 Merge "Fix some obvious typos and copy-paste bugs." am: 1cfd0c7546 am: b78ad69fa0 am: 9378d318f4 am: 13b24677c2 am: b5217cf799
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1851673

Change-Id: Ic3f9eea675bc6c17eca035146b0fc948846191f3
2021-11-10 23:04:50 +00:00
Hao Ke
f0b2d8e383 Merge "Adding typed Parcel readMap and readHashMap APIs." am: c1f406eb81 am: 4c669c6685 am: 9bc154843f am: eb937f4dc2 am: fd018845a0
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1882888

Change-Id: I3f8a04dd92d7fa0c6d3efe750a9ab9c5cccbf1d8
2021-11-10 23:04:01 +00:00
Donald Chai
b5217cf799 Merge "Fix some obvious typos and copy-paste bugs." am: 1cfd0c7546 am: b78ad69fa0 am: 9378d318f4 am: 13b24677c2
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1851673

Change-Id: I426f2f418a371a60a5ed6bf752190536d35dd5c6
2021-11-10 22:46:44 +00:00
Hao Ke
fd018845a0 Merge "Adding typed Parcel readMap and readHashMap APIs." am: c1f406eb81 am: 4c669c6685 am: 9bc154843f am: eb937f4dc2
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1882888

Change-Id: I1edee63ffcef1140016e96beab414028ff00eedc
2021-11-10 22:45:49 +00:00
Donald Chai
13b24677c2 Merge "Fix some obvious typos and copy-paste bugs." am: 1cfd0c7546 am: b78ad69fa0 am: 9378d318f4
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1851673

Change-Id: I6023e92cb9c6b338f96fbb85c9df51b81286e0a1
2021-11-10 22:24:56 +00:00
Hao Ke
eb937f4dc2 Merge "Adding typed Parcel readMap and readHashMap APIs." am: c1f406eb81 am: 4c669c6685 am: 9bc154843f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1882888

Change-Id: Ica5ee4975ff02abcd126372d6372db4ea3ace057
2021-11-10 22:24:30 +00:00
Donald Chai
1cfd0c7546 Merge "Fix some obvious typos and copy-paste bugs." 2021-11-10 21:16:52 +00:00
Hao Ke
c1f406eb81 Merge "Adding typed Parcel readMap and readHashMap APIs." 2021-11-10 21:14:41 +00:00
Hao Ke
446144c9a8 Adding typed Parcel readMap and readHashMap APIs.
Added typed read API of `readMap` and `readHashMap`,
that takes extra clazz parameters check that the class written
on the wire is the same or a descendant from the one provided
as the key and value arguments.

Doing so could enhance the security of Parcel deserialization,
as it would prevent unexpected types of objects being deserialized.
More details can be found at go/safer-parcel.

Test: atest -d android.os.cts.ParcelTest
Bug: 195622897
Change-Id: Ife9d1d7277b6345a6e11856179c301339b2dc087
2021-11-10 15:45:12 +00:00
Santos Cordon
4f7ca41f6f Go to sleep on fold for foldable devices.
Allow configuration of foldable states to indicate the device
should sleep when entering certain states.

Test: Check that device still wakes up on unfold, and sleeps on fold.
Bug: 180154690
Change-Id: I179d93ec506deee7e9da7d9190934c52a0bc188f
2021-11-10 14:26:16 +00:00
Jooyung Han
03e6f7969f Merge "Parcel: add new methods for interface list/array" am: 2500e149bc am: ef7ca34bbe am: 90d9045ad5 am: ecc29bfce7 am: 1d52ea1455
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1881006

Change-Id: I225b171275ae178b655483f8994c2f53dfc3fe94
2021-11-10 02:09:07 +00:00
Jooyung Han
1d52ea1455 Merge "Parcel: add new methods for interface list/array" am: 2500e149bc am: ef7ca34bbe am: 90d9045ad5 am: ecc29bfce7
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1881006

Change-Id: I5f809b781cf8e62624840183659c25ce1bcb31d1
2021-11-10 01:51:11 +00:00
Jooyung Han
ecc29bfce7 Merge "Parcel: add new methods for interface list/array" am: 2500e149bc am: ef7ca34bbe am: 90d9045ad5
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1881006

Change-Id: I375c7a2dfe80addbc4cf8dcb1dfcd4455aa31c1a
2021-11-10 01:31:48 +00:00
Dmitri Plotnikov
7582c4accc Merge "Add process state to BatteryUsageStats atoms" 2021-11-09 19:24:22 +00:00
Jooyung Han
bbacfde150 Parcel: add new methods for interface list/array
New methods are to write a list/array of interface objects and to read
them again.

Basically these methods are quite similar to those for IBinder objects.
But when reading IInterface objects, we need to create an array of the
exact type and need a way of converting IBinder into IInterface value.

Two functional interfaces (newArray and asInterface) are just like
while Parcelable.Creator does. We could pass "Stub" class which is
generated by the AIDL compiler and use reflection to create a typed
array instance and call `asInterface` method. But rather than relying on
reflection, passing `IMyInterface[]::new` and
`IMyInterface.Stub::asInterface` would be simple enough to use.

Bug: 205195901
Test: atest -d android.os.cts.ParcelTest
Change-Id: I275db9ebf52d3b9713fa105d81da3a1d289d96a8
2021-11-09 10:26:29 +09:00
Bernardo Rufino
3690f92461 Merge "Refactor Bundle for thread-safety of Bundle.hasFileDescriptors()" am: f5cc73d25f am: adcfd2f940 am: f509e2d9b7 am: 7ceb94a294 am: 7e83fa172f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1878339

Change-Id: Idefb8a2b014d08da48ae9fb30368c718546020cd
2021-11-05 21:24:16 +00:00
Roopa Sattiraju
b39c550a58 Merge "Change getEnabledComponentOverrides return type" am: 30cd5df67f am: 3374e0478a am: 27d3253e54 am: 802dd06c6b am: c11076edb3
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1853043

Change-Id: Icf59fba3efa0a665198066c1f813746a0489d1ea
2021-11-05 21:23:39 +00:00
Bernardo Rufino
734f31df16 Merge "Improve @hide Parcel.hasFileDescriptors(Object)" am: 41d4be0fef am: e927d812de am: c823dcac51 am: e0c9e8a87c am: 317e1a51f9
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1878338

Change-Id: I5be5af1ed3a7aa3cbcbc7cde015332a784eaa53f
2021-11-05 21:21:46 +00:00
Steven Moreland
9550ee9455 Merge "Binder: correction of javadoc formatting" am: a83307fbd8 am: 0784bb4330 am: 7ebf0a92ff am: cd045eb0ff am: 0e2cef8556
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1877757

Change-Id: I1b20e1df574639df7796b1ce64055c07f8173b92
2021-11-05 21:15:57 +00:00
Bernardo Rufino
7e83fa172f Merge "Refactor Bundle for thread-safety of Bundle.hasFileDescriptors()" am: f5cc73d25f am: adcfd2f940 am: f509e2d9b7 am: 7ceb94a294
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1878339

Change-Id: I16160df17d88600d73549e07027a14634fc3ddbb
2021-11-05 19:05:29 +00:00
Roopa Sattiraju
c11076edb3 Merge "Change getEnabledComponentOverrides return type" am: 30cd5df67f am: 3374e0478a am: 27d3253e54 am: 802dd06c6b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1853043

Change-Id: I6f6c146f5ccf98c2d63b5d49e9478eac9922c697
2021-11-05 19:05:07 +00:00
Bernardo Rufino
317e1a51f9 Merge "Improve @hide Parcel.hasFileDescriptors(Object)" am: 41d4be0fef am: e927d812de am: c823dcac51 am: e0c9e8a87c
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1878338

Change-Id: Ia8dab5d1475d47d8491d81f2ac81312b550c5727
2021-11-05 19:04:27 +00:00
Steven Moreland
0e2cef8556 Merge "Binder: correction of javadoc formatting" am: a83307fbd8 am: 0784bb4330 am: 7ebf0a92ff am: cd045eb0ff
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1877757

Change-Id: Id40a2d6958a2c4456f0dc299c3c1fadf248b1d29
2021-11-05 18:54:58 +00:00
Bernardo Rufino
7ceb94a294 Merge "Refactor Bundle for thread-safety of Bundle.hasFileDescriptors()" am: f5cc73d25f am: adcfd2f940 am: f509e2d9b7
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1878339

Change-Id: I3c96c9db67d902b63cb376f19e642454635fab43
2021-11-05 18:29:50 +00:00
Roopa Sattiraju
802dd06c6b Merge "Change getEnabledComponentOverrides return type" am: 30cd5df67f am: 3374e0478a am: 27d3253e54
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1853043

Change-Id: Icfb0808c72c573d51f4ca16c477bb7b903a9cb20
2021-11-05 18:29:07 +00:00
Bernardo Rufino
f5cc73d25f Merge "Refactor Bundle for thread-safety of Bundle.hasFileDescriptors()" 2021-11-05 17:43:00 +00:00
Roopa Sattiraju
30cd5df67f Merge "Change getEnabledComponentOverrides return type" 2021-11-05 17:33:00 +00:00
Bernardo Rufino
e0c9e8a87c Merge "Improve @hide Parcel.hasFileDescriptors(Object)" am: 41d4be0fef am: e927d812de am: c823dcac51
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1878338

Change-Id: Ifd22d79f5bedb021e59345e9290979fe099be9c4
2021-11-05 15:40:33 +00:00
Bernardo Rufino
41d4be0fef Merge "Improve @hide Parcel.hasFileDescriptors(Object)" 2021-11-05 14:51:18 +00:00
Steven Moreland
cd045eb0ff Merge "Binder: correction of javadoc formatting" am: a83307fbd8 am: 0784bb4330 am: 7ebf0a92ff
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1877757

Change-Id: Iedb0de534dce1df8eb37c6b07a9e5141cc69a09a
2021-11-05 05:53:07 +00:00
Dima
0d9bb37a9a Binder: correction of javadoc formatting
Fixed javadoc formatting, namely references to methods that were typoed and displayed incorrectly in Android Studio.

Change-Id: I190eab35bc7ec6e162cb6d614b2c74523ff86c1c
2021-11-03 08:10:04 +00:00
Stephanie Bak
c7df912336 Merge "Adding a new user restriction DISALLOW_WIFI_TETHERING" 2021-11-03 00:02:42 +00:00
Dmitri Plotnikov
79978c195f Add process state to BatteryUsageStats atoms
Bug: 191921016
Test: atest BatteryUsageStatsProtoTests:BatteryUsageStatsPulledTest

Change-Id: Id047aa2e1fcf5318c3fd6620e6d41bcb172c6b31
2021-11-02 11:10:59 -07:00
Bernardo Rufino
7c296d7514 Refactor Bundle for thread-safety of Bundle.hasFileDescriptors()
After aosp/1878338, I realized Bundle.hasFileDescriptors() was accessing
mParcelledData and mMap without a lock. So, to avoid locking
there, I made mParcelledData volatile (since after mParcelledData is
null, it can never be non-null again and mMap is guaranteed to be
non-null). So, moved assignments to mParcelledData to be last wrt mMap
and mParcelledByNative to ensure visibility of those fields.

While refactoring copyInternal(), realized that method was always used
after constructing an uninitialized Bundle, so to avoid mistakes with
objects not properly initialized, I created a constructor in Bundle,
PersistableBundle & BaseBundle that does that copyInternal() did.

Bug: 195622897
Test: atest -d android.os.cts.ParcelTest android.os.cts.BundleTest android.os.BundleTest android.os.ParcelTest
Change-Id: I5c9337496da7ecf87f10370726099dcb247a6789
2021-11-02 11:42:11 +00:00
Bernardo Rufino
31d70842e0 Improve @hide Parcel.hasFileDescriptors(Object)
Addressing Jeff's comment on aosp/1787847 to support List<> in
Parcel.hasFileDescriptor(), also added support for Map (+ArrayMap) and
Object[] that were missing. Made the checks recursive since it's
possible to put nested containers in bundle. Since that's @hide and only
used by bundle, included Parcel as a supported type too and clarified in
the javadoc.

That allowed to clean up Bundle.hasFileDescriptors().

Bug: 195622897
Test: atest -d android.os.cts.ParcelTest android.os.cts.BundleTest android.os.BundleTest android.os.ParcelTest
Change-Id: I6acf358763d8f544fc6ff1a5b0c8bdff567d50be
2021-11-02 10:54:58 +00:00
Hao Ke
0c7e522154 Merge "Adding typed Parcel read APIs for Serializable." am: bce40e7c6e am: 9a6145139a am: ff54e8149a am: 1c9ca7b8a9 am: c48eeadf56
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1870153

Change-Id: Ia5d8f946e4fbb6670ea41f54328a844e33bdad4f
2021-11-02 03:20:31 +00:00
Hao Ke
c48eeadf56 Merge "Adding typed Parcel read APIs for Serializable." am: bce40e7c6e am: 9a6145139a am: ff54e8149a am: 1c9ca7b8a9
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1870153

Change-Id: I33d3078eacec37b33708d6b8c74637f410178435
2021-11-02 03:02:42 +00:00
Hao Ke
1c9ca7b8a9 Merge "Adding typed Parcel read APIs for Serializable." am: bce40e7c6e am: 9a6145139a am: ff54e8149a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1870153

Change-Id: I9a866ff3c3b232199ee311f93a50abe3e92930d0
2021-11-02 02:50:39 +00:00
Hao Ke
bce40e7c6e Merge "Adding typed Parcel read APIs for Serializable." 2021-11-02 02:08:29 +00:00
Dmitri Plotnikov
47e5825623 Use per process state CPU Active time in CpuPowerCalculator
Bug: 191921016
Test: atest FrameworksCoreTests:BatteryStatsTests
Change-Id: I6ebbbacb35815fa30392628f7e5a30add365b21f
2021-11-01 17:05:06 +00:00
Dmitri Plotnikov
3b367873a0 Merge "Update CpuPowerCalculator to do per process state attribution" 2021-11-01 17:04:29 +00:00
Bernardo Rufino
691c5c516d Merge "Add range-based Parcel.compareData()" am: 98a4a1b8b9 am: e9eb2ecff1 am: dcfad1498f am: bddf602aca am: 28826f285c
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1854184

Change-Id: I9727a2f96cf5ead533c1f3d050d6385bc08ee404
2021-11-01 12:25:46 +00:00
Bernardo Rufino
28826f285c Merge "Add range-based Parcel.compareData()" am: 98a4a1b8b9 am: e9eb2ecff1 am: dcfad1498f am: bddf602aca
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1854184

Change-Id: Ia79e802b1efb2068bc00cb7266dd5b6ff5433d92
2021-11-01 12:17:16 +00:00
Bernardo Rufino
bddf602aca Merge "Add range-based Parcel.compareData()" am: 98a4a1b8b9 am: e9eb2ecff1 am: dcfad1498f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1854184

Change-Id: Ic4f0f52f688bfa95ffe820103cd59b437edd9132
2021-11-01 12:13:44 +00:00
Bernardo Rufino
98a4a1b8b9 Merge "Add range-based Parcel.compareData()" 2021-11-01 11:27:05 +00:00
Stephanie Bak
32d0ee5618 Adding a new user restriction DISALLOW_WIFI_TETHERING
Bug: 197558754
Test: atest UserRestrictionsTest
Change-Id: I9ef1c4427259c2633df69ab808c4f4912bd20e75
2021-10-29 21:34:26 +00:00
Hao Ke
ec4b60c1ad Adding typed Parcel read APIs for Serializable.
Added typed read API of `readSerializable`, that takes
an extra Class<T> parameter to check that the class written
on the wire is the same or a descendant from the one provided
as argument.

Doing so could enhance the security of Parcel deserialization,
as it would prevent unexpected types of objects being deserialized.
More details can be found at go/safer-parcel.

Test: atest -d android.os.cts.ParcelTest
Bug: 195622897
Change-Id: I94e48ac7fe8f5d3ba4c54100cb76ce3e4aacdd09
2021-10-29 14:44:32 +00:00
Dmitri Plotnikov
f4f9528352 Update CpuPowerCalculator to do per process state attribution
Bug: 191921016
Test: atest FrameworksCoreTests:BatteryStatsTests

Change-Id: I6c69f2b2aa03a61ade6c087e17891c079bc3e054
2021-10-28 18:16:57 -07:00