Commit Graph

9446 Commits

Author SHA1 Message Date
Bernardo Rufino
18e5be7b98 Merge "Log.wtf in mismatch + tests" am: 1cdbc7cbd1 am: d60218eb45 am: 5d32036b41
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1837194

Change-Id: If1fa51158bfa1dd5fa901d907aea72a6c8379ddc
2021-09-30 11:04:34 +00:00
Bernardo Rufino
d60218eb45 Merge "Log.wtf in mismatch + tests" am: 1cdbc7cbd1
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1837194

Change-Id: I185410ce82ca057b6767d5ca0ff0368f046a1dff
2021-09-30 10:31:03 +00:00
Bernardo Rufino
95ace87925 Log.wtf in mismatch + tests
Log mismatches as wtf to be able track those. Also added unit tests
around kindofEquals() and r/w mismatches.

Test: atest -d android.os.cts.ParcelTest android.os.cts.BundleTest android.os.BundleTest android.os.ParcelTest
Bug: 195622897
Change-Id: I361dd144b23975eedc8b19ed65457a1c5405936e
2021-09-29 13:51:43 +01:00
Martijn Coenen
09c663fd4a Merge "Fix race condition around CE storage becoming available." into sc-qpr1-dev am: d172b787d3
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15879518

Change-Id: Ie35ae63d9cdcf0442ab216bfee52e61a1f1c7d23
2021-09-24 07:44:41 +00:00
Martijn Coenen
d172b787d3 Merge "Fix race condition around CE storage becoming available." into sc-qpr1-dev 2021-09-24 07:32:13 +00:00
Martijn Coenen
1db2e74252 Merge "Run a GC after killing a UID due to binder proxy limit." into sc-qpr1-dev am: 745bc36216
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15889363

Change-Id: I8431c90f63f11016f6ad592284c3599cfbed3203
2021-09-24 07:14:57 +00:00
Treehugger Robot
78cb6529fc Merge "VintfObject.getHalNamesAndVersions report AIDL version number." am: c39842abd9 am: 6b6d1da5f3 am: 2480509575
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1832955

Change-Id: If6021e99ed3fe3f21207a65abc2cb432763ad79a
2021-09-24 01:55:07 +00:00
Yifan Hong
bd38ae368e Merge "Add owners for VINTF." am: ec854a738f am: 8804125b5b am: f729ceacbf
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1835453

Change-Id: Ic99ead4a59f1c3f89aaffd64110f536b09b08ab1
2021-09-24 01:54:52 +00:00
Treehugger Robot
6b6d1da5f3 Merge "VintfObject.getHalNamesAndVersions report AIDL version number." am: c39842abd9
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1832955

Change-Id: Ib31bb867e346fb693b7c2c1aeace30f8946eb469
2021-09-24 01:20:43 +00:00
Yifan Hong
8804125b5b Merge "Add owners for VINTF." am: ec854a738f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1835453

Change-Id: I59ba7ecbdaf201d6ea66bdf003efe2510a3ee8ee
2021-09-24 01:19:55 +00:00
Yifan Hong
de452e49af VintfObject.getHalNamesAndVersions report AIDL version number.
Tests that rely on this API does not attempt
to parse it, but rather treat this as an opaque
string and upload them.

Test: pass
Bug: 200729012
Change-Id: I025e2602ab506ad009ce48d6329a230f12f1060c
2021-09-23 13:21:35 -07:00
Yifan Hong
4510a23652 Add owners for VINTF.
Test: pass
Change-Id: I24b73fd00bafd8a3c2fdfdecc1c00179a18b2e89
2021-09-23 13:21:35 -07:00
Bernardo Rufino
e807d7e73e Merge "Synchronize in LazyValue.get()" am: 92b71e564f am: 278a00a8d3 am: df6618821f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1829879

Change-Id: I31a81677f683dbf9183726ac2b66cd6565d4fa75
2021-09-23 17:32:01 +00:00
Bernardo Rufino
278a00a8d3 Merge "Synchronize in LazyValue.get()" am: 92b71e564f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1829879

Change-Id: I75902d42568bc7e7f18033ab8f228ff2cbc94058
2021-09-23 17:04:39 +00:00
Bernardo Rufino
92b71e564f Merge "Synchronize in LazyValue.get()" 2021-09-23 16:48:49 +00:00
Martijn Coenen
7d2da2c2d2 Run a GC after killing a UID due to binder proxy limit.
After we hit the per-UID proxy limit and kill the originating process,
there's actually no guarantee that the proxies to the (now dead)
processes are cleaned up immediately; if the processes get restarted and
start accumulating proxies again, we may go over the global proxy limit
(25k with this CL). Do a GC to make sure we clean them up.

Note that the GC here might not actually clean up all the proxies,
because the binder reference decrements will come in asynchronously; but
if new processes belonging to the UID keep adding proxies, we will get
another callback here, and run the GC again - this time cleaning up the
old proxies. Because of this potential delay, an app may temporarily
have many more outstanding proxies than the high watermark, so also
increase the global proxy limit to 25k proxies.

Bug: 198340142
Test: Manual
Change-Id: I75c7ea4f7aa4a5d448f610014770f1b9788cfb5b
Merged-In: I75c7ea4f7aa4a5d448f610014770f1b9788cfb5b
2021-09-23 14:48:52 +00:00
Devin Moore
32b7fc46f5 Merge "ServiceManagerNative: add getConnectionInfo" am: e731e209d3 am: 5ae740f8eb am: 5e69d9b1e9
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1823886

Change-Id: I50356d83f7e252296ee3e3f1eea5a3b833d2d04e
2021-09-22 17:11:57 +00:00
Devin Moore
5ae740f8eb Merge "ServiceManagerNative: add getConnectionInfo" am: e731e209d3
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1823886

Change-Id: Ib67c5cc25b23d8f75d96c845ffdc63d7a6e61ec9
2021-09-22 16:42:41 +00:00
Devin Moore
e731e209d3 Merge "ServiceManagerNative: add getConnectionInfo" 2021-09-22 16:25:48 +00:00
Martijn Coenen
6cc84a1415 Fix race condition around CE storage becoming available.
This fixes a race condition that exists around preparing CE storage, and
a package being reinstalled at the same time.

The normal CE data unlock procedure is something like this:

1. User state is RUNNING_LOCKED
2. UserController calls onBeforeUnlockUser()
3. onBeforeUnlockUser() prepares CE storage
4. onBeforeUnlockUser() calls PackageManagerService.reconcileAppsData()
5. reconcileAppsData() prepares app CE data directories, creating dirs
   when needed
6. UserController changes state to RUNNING_UNLOCKING

The race comes into the picture when an app is installed right between
step 5 and step 6; when a new app is installed, PMS does have a function
to create the CE app data directory; but that function only creates CE
data directories when the user state is RUNNING_UNLOCKING (or later); so
even though technically CE storage became available in step 3, other
parts of PMS will only use it after step 6 has completed.

To fix this, we use StorageManagerService to record the fact that CE
storage for a particular user is prepared; then, PackageManagerService
can query StorageManager to ask whether CE storage is prepared. That in
combination with the user key being unlocked is then used as a condition
for creating CE data directories from PackageManagerService.

Bug: 187103629
Test: manual
Change-Id: Ice81ae98441b9ed287e8db4196a041c3d47afce9
Merged-In: Ice81ae98441b9ed287e8db4196a041c3d47afce9
2021-09-22 16:28:19 +02:00
Bernardo Rufino
9293dca91c Synchronize in LazyValue.get()
When we use Bundle's copy constructor we perform a shallow copy of the
underlying map, so lazy values are the same across the original and the
clone. So, if we're accessing the same item backed by a lazy value in 2
different threads, each one accessing a different bundle (the original
and the clone), both would have to synchronize on a common lock.

Although Bundle is not thread-safe, we should keep the expectation that
the client only needs to properly synchronize access to one bundle, not
more. To achieve this, we synchronize on the original parcel held by
LazyValue in get(), this removes the need for the above.

Note that after we produce the lazy values and put them in the map, we
don't have a reference to mParcelledData anymore inside the Bundle, the
only objects holding a reference to that parcel are the lazy values.

Also fixed some stuff in LazyValue:
* Fixed condition inside LazyValue that used mObject == null as
  signal for "not deserialized" state since mObject can be null, so
  switched to mSource != null.
* Made mSource volatile and adjusted operations to always check it
  before, ensuring visibility of itself and mObject via happens-before.
  This works because after checking mSource, if that's null, mObject is
  guaranteed to be visible and valid, if it's not null, we can use it
  since we're in the serialized state and this works even if another
  thread deserializes in between as long as we hold on to a reference of
  mSource in a local because the parcel is still valid.
* Remove the recycling of mValueParcel, otherwise we'd need locking to
  ensure whatever was using it was still using a valid object. Decided
  to just remove recycling for now since the plan is to remove
  mValueParcel entirely when we add comparison and hasFileDescriptor()
  methods that operate on a range to Parcel.

Bug: 195622897
Test: atest -d android.os.cts.ParcelTest android.os.cts.BundleTest
      android.os.BundleTest android.os.ParcelTest
Test: More tests coming
Change-Id: I501c91f505950338b23e7837e55f89b2f63ff93a
2021-09-22 11:58:24 +01:00
TreeHugger Robot
4ff921f559 Merge "Check custom component names before aggregating BatteryUsageStats snapshots" into sc-qpr1-dev am: 0ef5152b17
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15872124

Change-Id: Ib40da10e9db2ee290e1c65681e25862b0c6b7e35
2021-09-20 20:51:11 +00:00
Dmitri Plotnikov
0c561475c3 Check custom component names before aggregating BatteryUsageStats snapshots
If the lists of custom power components do not match, a crash will occur.
Instead of causing a crash, simply skip incompatible snapshots.

Bug: 196040329
Bug: 200511361
Test: atest FrameworksCoreTests:com.android.internal.os.BatteryUsageStatsProviderTest

Change-Id: I87ba605371a5f3119dcff33f6109e94ee46ab57d
(cherry picked from commit a1ea9ecd56)
2021-09-20 18:35:09 +00:00
Treehugger Robot
056102f43b Merge "New API for getting enabledcomponent" am: bca93eafe5 am: 4f564346de am: 8e6a6a255f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1818892

Change-Id: I24c3825547cae6a96a9ad8a5f7cbd69a32f38ad4
2021-09-14 18:46:01 +00:00
Treehugger Robot
4f564346de Merge "New API for getting enabledcomponent" am: bca93eafe5
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1818892

Change-Id: I46736aedc7df2d8e6926414adb9b48748386393d
2021-09-14 18:34:16 +00:00
wescande
29dbede144 New API for getting enabledcomponent
Bluetooth can no longer call SystemConfig and need to use the manager.

Bug: 190440540
Bug: 199279027
Test: Manual
Tag: #refactor
Change-Id: I065ab407c83cd2edf2244e4170496b0979ac562c
2021-09-14 16:11:19 +00:00
Devin Moore
e7864e38d1 ServiceManagerNative: add getConnectionInfo
Check vintf manifest for connection info for a given service.

Test: build
Bug: 198207801

Change-Id: Ic9b4277de2bf13c429ba4921f1196b921b2a47de
2021-09-10 22:55:07 +00:00
Bernardo Rufino
c9a5661276 Merge "Use appendFrom in LazyValue.writeToParcel()" am: 730b6cfbc1 am: 075952fa51 am: ba8c45452a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1821492

Change-Id: Ie968bceefa0248f1923fed330d324e933a902f98
2021-09-09 10:46:25 +00:00
Bernardo Rufino
075952fa51 Merge "Use appendFrom in LazyValue.writeToParcel()" am: 730b6cfbc1
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1821492

Change-Id: I62192f0e179540552fec8e124581c717c867f09e
2021-09-09 10:06:40 +00:00
Bernardo Rufino
730b6cfbc1 Merge "Use appendFrom in LazyValue.writeToParcel()" 2021-09-09 09:48:13 +00:00
Treehugger Robot
e43a8dc3ca Merge "ServiceManager: doc comment" am: 882bac800d am: 2582d481d3 am: db80e61282
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1821336

Change-Id: I2a01565f685e0432e0771fcbe10ae3e8eae0d967
2021-09-09 00:43:49 +00:00
Treehugger Robot
2582d481d3 Merge "ServiceManager: doc comment" am: 882bac800d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1821336

Change-Id: If34eef18cf1586fe2fefdfe7e1e7666514c47108
2021-09-09 00:05:01 +00:00
Treehugger Robot
882bac800d Merge "ServiceManager: doc comment" 2021-09-08 23:44:36 +00:00
Steven Moreland
dc7cae65cf ServiceManager: doc comment
A couple words on this for ya!

Fixes: 197629711
Test: N/A
Change-Id: I4fbaacb6e123c042919c03f11a0403e041d23a56
2021-09-08 11:34:38 -07:00
Sarah Chin
e34b1b8735 Merge "Expose requestModemActivityInfo" 2021-09-08 16:12:28 +00:00
Bernardo Rufino
5e5d776906 Use appendFrom in LazyValue.writeToParcel()
Due to lazy bundle, we can now have bundles touching the original parcel
(used to create the bundle in the first place) during serialization.
This can lead to races within the same bundle or across bundles when
the same is copied.

Both these cases happen in notification manager when it's about to post
notification for its listeners. In summary, it notifies all the
listeners in oneway calls and the listeners make a call back to
system_server to retrieve the notification. These calls back can race
and lead to the bug observed in http://b/198355758#comment12.

In order to avoid that we use appendFrom(mSource, mPosition) in
LazyValue.writeToParcel() since that method doesn't change or use the
cursor of mSource. We only ever write to mSource before creating all the
LazyValues, so there can't be any r/w races.

Test: 1. Attach debugger to system server and put log breakpoints in
         racy lines in Parcel$LazyValue.writeToParcel
      2. atest -d CtsHostsideNetworkTests:com.android.cts.net.HostsideRestrictBackgroundNetworkTests#testDozeModeMetered_enabledButWhitelistedOnNotificationAction
      3. Observe no crashes
Test: 1. Attach debugger as in previous "Test:" line
      2. Create a notification with a parcelable extra, post it
      3. Observe no crashes
Bug: 195622897
Bug: 198355758
Test: atest -d android.os.cts.ParcelTest android.os.cts.BundleTest android.os.BundleTest android.os.ParcelTest
Change-Id: I02f890d22910c69e29e791b55d3655962a6dddfd
2021-09-08 09:19:58 +01:00
Steven Moreland
00501a5f83 Merge "Parcel: markForBinder" am: 0f2729a96e am: ad22cbc2a1 am: cec19e3290
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1816536

Change-Id: I552c3d5049c72c5ae7bbcf217ee58041feb063e2
2021-09-08 01:07:37 +00:00
Steven Moreland
ad22cbc2a1 Merge "Parcel: markForBinder" am: 0f2729a96e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1816536

Change-Id: I50a013497eb5368d05fe05055a506f8de00f3890
2021-09-08 00:41:59 +00:00
Steven Moreland
0f2729a96e Merge "Parcel: markForBinder" 2021-09-08 00:29:29 +00:00
Hall Liu
1c8976b843 Expose requestModemActivityInfo
Expose requestModemActivityInfo in TelephonyManager using the Executor +
Consumer pattern, and modify clients to use it.

Test: atest TelephonyManagerTest#testRequestModemActivityInfo
Fixes: 170427831
Change-Id: I7e8134c8058017b888c324a9f85d473fc3cdd8f5
Merged-In: I7e8134c8058017b888c324a9f85d473fc3cdd8f5
2021-09-07 15:30:36 -07:00
Hall Liu
f4fe3ac665 Update and expose ModemActivityInfo
Update ModemActivityInfo to present a nicer API surface and expose it as
a SystemApi. Also change clients in BatteryStats to match the new
surface.

This is part 1. Part 2 will modify the methods in TelephonyManager to
use a more up-to-standards threading model.

Bug: 170427831
Test: atest ModemActivityInfoTest
Change-Id: I762ed949342861c75d94eafce88335e7bd8c9139
Merged-In: I762ed949342861c75d94eafce88335e7bd8c9139
2021-09-07 11:40:55 -07:00
Bernardo Rufino
7af9e4dc15 Merge "Don't throw for LazyValue in Parcel.hasFileDescriptors()" am: 6ae29f70d7 am: 82a0a22b30 am: 25cb1f4df7
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1818898

Change-Id: I03b92476dc2741931353bcc8bb5ffc261c65589b
2021-09-06 10:58:56 +00:00
Bernardo Rufino
82a0a22b30 Merge "Don't throw for LazyValue in Parcel.hasFileDescriptors()" am: 6ae29f70d7
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1818898

Change-Id: Ie6cb56a29e544e50803144a4ac533c29f35d6c06
2021-09-06 10:31:57 +00:00
Bernardo Rufino
c087f62482 Don't throw for LazyValue in Parcel.hasFileDescriptors()
In aosp/1819733 we extracted Parcel.hasFileDescriptor() for types
produced by Parcel.writeValue() and consumed by Parcel.readValue() out
of Bundle into Parcel. It's supposed to handle LazyValue too.

However, we put a check to verify that it was a type supported by
readValue()/writeValue() by retrieving the VAL_XXX type of the value via
Parcel.getValueType(), however, that method throws for LazyValue since
we don't actually write that special type on the wire. However, we still
want Parcel.hasFileDescriptor() to support it, so moving the check into
a last 'else' statement, making sure we don't throw in case the value is
a LazyValue.

Bug: 195622897
Bug: 198433827
Test: atest CtsNetTestCases android.net.cts.CaptivePortalTest#testCaptivePortalIsNotDefaultNetwork
Change-Id: I1e6ec122557c12e74db6890e1631fec3cefe31f6
2021-09-06 08:51:21 +01:00
Steven Moreland
580ab91411 Parcel: markForBinder
Allow Parcel data to be dependent on the binder in question. This
exposes the API in Java which is previously only available in native.

There are two main usecases for this:
- provide an alternative route to implement features like markSensitive
  (which requires only 1 function call per class, rather than a
  function call and flag per transaction type)
- support RPC format transactions

Bug: 175814583
Test: atest android.os.ParcelTest, boot, manual
Change-Id: I134b6e23da83699195a8f075b9f50b6409ecff86
2021-09-03 11:50:58 -07:00
Tim Van Patten
b5e834ae05 Merge "Enable ANGLE as a Game Dashboard Intervention" into sc-qpr1-dev am: 4de992c9cb
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15697303

Change-Id: Ie8e87583f02be4b7def95e355e39ac609dc18744
2021-09-01 00:34:07 +00:00
Tim Van Patten
08c3f5b379 Enable ANGLE as a Game Dashboard Intervention
Enable ANGLE as a Game Dashboard intervention via Phenotype.

Bug: b/188475576
Test: GameManagerServiceTests
Change-Id: I91894a76b8dcf7a97244cff679a501001734f671
Merged-In: I91894a76b8dcf7a97244cff679a501001734f671
(cherry picked from commit acf3851b8f)
2021-08-31 15:08:38 -06:00
Bernardo Rufino
36ff1cdd0e Merge "Lazy bundle" am: 93b4b55ee7 am: 872f7a88e5 am: f7dbfb7afc
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1787847

Change-Id: I0d3cab89cfe0a3f573688d5cfcb1edcc1aeccaf9
2021-08-31 11:12:18 +00:00
Bernardo Rufino
872f7a88e5 Merge "Lazy bundle" am: 93b4b55ee7
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1787847

Change-Id: I36812425c05b2849d15082f5c73c52a81ad1b423
2021-08-31 10:08:39 +00:00
Bernardo Rufino
93b4b55ee7 Merge "Lazy bundle" 2021-08-31 09:18:47 +00:00