Commit Graph

11179 Commits

Author SHA1 Message Date
JW Wang
dabef7a8de Expose ROLLBACK_DATA_POLICY_* as system api
The constants will be used by phonesky and CTS
to replace hardcoded values.

Bug: 194981157
Test: m
Change-Id: I4567334be554055ef2a5c20ef7160d991674cb9e
2021-08-06 10:58:06 +08:00
Winson Chiu
ce3f4fcd24 Merge "Add parsing class parcelling tests" 2021-08-05 21:43:58 +00:00
Winson
593df2ce1e Add parsing class parcelling tests
Uses reflection to read all of the getters for each of the data classes
and finds their setters to input test data, serialize it, deserialize
it, and compare the before and after values.

Also records all of the methods available in the class, to ensure that
any new fields/methods are caught by the test.

Bug: 178852754

Test: atest com.android.server.pm.test.parsing.parcelling

Change-Id: I642fd43a3ff2e5675129f0f4ad3646c97e3f0e22
2021-08-05 10:41:19 -07:00
Nate Myren
3bc2043efc Merge "Remove calling UID check from ContentProvider" into sc-dev am: c2c1c0341b am: c87216da9b
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15463733

Change-Id: Ic896a659ffe69a9eb7f3ddefa757de602e59e1f3
2021-08-05 17:19:05 +00:00
Nate Myren
e758539f02 Remove calling UID check from ContentProvider
AttributionSource checks calling UID on unparcel (so the check is not
necessary), and some ContentProviders may clear calling identity.

Test: Manual
Fixes: 188755312
Change-Id: If629eea3ba8c1a57fd4b7aff0fec2c0acb5f69be
2021-08-04 20:25:21 +00:00
Jeff Sharkey
931fb035af Merge "Consider Intent.setPackage() for "leaving"." 2021-08-04 19:09:10 +00:00
Adam Bookatz
44fc75b36e Merge "Intent.java EXTRA_USER clarifications" 2021-08-04 17:44:09 +00:00
Jeff Sharkey
e1191ecf71 Consider Intent.setPackage() for "leaving".
When deciding if an intent is "leaving" the package, consider both
Intent.setComponent() and Intent.setPackage().

Bug: 195405741
Test: manual
Change-Id: I3c9460579242dcd874f3bb85fad46e1273306baa
2021-08-03 21:29:28 +00:00
Lee Shombert
a9c35b3e01 Revert "Do not cache wildcard users (PackageManager)"
This reverts commit 8d6900e011.

Reason for revert: The UIDs in this CL are Linux UIDs, which are never
negative.  The @UserIdInt annotation is incorrect and the bypass()
override is unnecessary.  See the comments on ag/15339446 for another
instance of this issue.

Change-Id: I79ccbb40c3f0ab1a3bb48f55da5a72696d4fb2b1
2021-08-02 20:53:14 +00:00
Rhed Jao
07c00b7532 Merge "Apply a maximum char count to the load label api" 2021-08-02 04:58:06 +00:00
Rhed Jao
b02bae5d5a Apply a maximum char count to the load label api
The system is overwhelmed by an enormous label string returned by
the load label api. This cl truncates the label string if it exceeds
the maximum safe length.

Bug: 67013844
Test: atest PackageManagerTest
Change-Id: Ia4d768cc93a47cfb8b6f7c4b6dc73abd801809bd
2021-07-30 16:42:43 +08:00
Jackal Guo
26c4887117 Merge "Refactor PackageParser (13/n)" 2021-07-29 00:58:27 +00:00
Alex Buynytskyy
a556d75169 Merge "Check for invalid (negative) string pool pos." into sc-dev am: 59bad728e2 am: bb0bd225a1
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15390628

Change-Id: I20f2eabdf8b9cbfd8d0f9e6436d5890eebefe5eb
2021-07-27 15:13:40 +00:00
Tom Natan
33b42865aa Merge "Add an 'android.software.app_compat_overrides' feature" into sc-v2-dev am: 3c3deaed91 am: 7a09808f68
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15328593

Change-Id: Id0434010c57cf2b8742f4f242ee69baa8896c10d
2021-07-27 08:15:52 +00:00
Tom Natan
7a09808f68 Merge "Add an 'android.software.app_compat_overrides' feature" into sc-v2-dev am: 3c3deaed91
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15328593

Change-Id: Ifac10503adc49a5c512c8a70d8dc9d6d4922bf41
2021-07-27 07:50:56 +00:00
Tom Natan
3c3deaed91 Merge "Add an 'android.software.app_compat_overrides' feature" into sc-v2-dev 2021-07-27 07:32:45 +00:00
Jackal Guo
26ea21c65c Refactor PackageParser (13/n)
Some constants or utils in the PackageParser are still used by the
other classes. This CL moves them into the individual class.

Bug: 174723245
Test: m docs
Test: atest -p core/java/android/content/pm \
        services/core/java/com/android/server/pm
Change-Id: I9b733c8e70ace583055b959daa1cfb5a132ee4a4
2021-07-27 10:55:05 +08:00
Alex Buynytskyy
b2a831ac3c Check for invalid (negative) string pool pos.
Parcel implementation would crash the system server otherwise.
Any exception is OK as it'll cause the cache to be invalidated.
Crash is not OK.

Bug: 194632313
Fixes: 194632313
Test: atest PackageParserCacheHelperTest
Change-Id: I58a4496b4646e172e6c3aee9ea17854a7ef55eaa
2021-07-26 18:51:02 +00:00
TreeHugger Robot
dd7d13ca1f Merge "Add dumping functionality." 2021-07-23 23:54:49 +00:00
Adam Bookatz
46a438271e Intent.java EXTRA_USER clarifications
In Intent.java:
* Clarifies userId vs. UserHandle vs. uid.
* Fixes javadoc links to EXTRA_USER_HANDLE and UserHandle
* Updates javadoc to mention that EXTRA_USER is available
for some SystemApis.

Bug: 189409989
Test: Compiles (just comments)
Change-Id: I63496ddb5ed4ddc7bc26540c6dad7cbe7911520d
2021-07-22 16:11:51 -07:00
TreeHugger Robot
eb2e459ecb Merge "Encapsulate parsing class fields" 2021-07-22 17:24:20 +00:00
Jackal Guo
1ce663dd30 Merge "Refactor PackageParser (12/n)" 2021-07-22 01:47:08 +00:00
Lee Shombert
1171265b9d Merge changes I68868b7f,I092d1385
* changes:
  Do not cache wildcard users (UserManager)
  Do not cache wildcard users (PackageManager)
2021-07-21 23:07:00 +00:00
Kweku Adams
fb2a998910 Add dumping functionality.
Add the glue to be able to dump tare state.

Bug: 158300259
Test: adb shell dumpsys tare
Change-Id: If4fd4355611b4ce697834c2124f387b288f54fd2
2021-07-21 15:48:48 -07:00
Lee Shombert
8d6900e011 Do not cache wildcard users (PackageManager)
Bug: 186778818

PropertyInvalidatedCache queries that contain wildcard user IDs are no
longer cached.  Some simple multi-user tests show that no current
caches use wildcard user IDs, so the change has no effect on
performance.  The bypass() mechanism is used to avoid the cache when
necessary.

Test: atest
 * FrameworksServicesTests:UserManagerServiceCreateProfileTest

Change-Id: I092d1385cc254b3f595ae3d0322f77dbaf456b65
2021-07-20 10:52:51 -07:00
Rhed Jao
f04429b935 Merge "Enforce package visibility to the callbacks of the sync status" 2021-07-20 05:22:38 +00:00
Jackal Guo
3feacd996c Merge "Migrate the usage of sCompatibilityModeEnabled" 2021-07-20 01:47:00 +00:00
tomnatan
ee126f0404 Add an 'android.software.app_compat_overrides' feature
This feature will allow OEMs to opt-in specific devices/builds to per-app compat overrides.

Bug: 188500456
Test: N/A
Change-Id: I00108d163f752d23c380496ccac971cf0fcfe0f6
2021-07-19 14:00:26 +00:00
Jackal Guo
2821e5d46f Refactor PackageParser (12/n)
Replace PackageParser.PackageParserException by either using the
PraseResult or throwing a more generic Exception in order to move
away from PackageParser.

Bug: 174723245
Test: m docs
Test: atest -p core/java/android/content/pm \
        core/java/android/util/apk \
        services/core/java/com/android/server/pm \
	services/core/java/com/android/server/integrity
Change-Id: I7ba3e693e636caa869641141ed83383326c67809
2021-07-16 13:49:16 +08:00
Winson
b3884d53eb Encapsulate parsing class fields
This hides all fields as private in preparation for exposing as
interfaces for mainline-ability and for automatic getter/setter testing
through kotlin-reflect.

Bug: 178852754

Test: atest com.android.server.pm.test.parsing.parcelling

Change-Id: I8f36898694368ce60b7efd4b099986c0ea29aba0
2021-07-14 18:05:21 -07:00
Jeff Sharkey
57a8f9431e Merge "Root UID can synthesize AttributionSource values." into sc-dev am: 9d0ddef67b am: e4f4fa91e2
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15285879

Change-Id: I967ed6c8b891e0ba03e10f001ef108ced62572b8
2021-07-14 23:49:43 +00:00
Jeff Sharkey
5d6be79488 Merge "Root UID can synthesize AttributionSource values." into sc-dev am: 9d0ddef67b
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15285879

Change-Id: Id4254922cb486ba49eebe55caa74249583c4d5bd
2021-07-14 23:37:58 +00:00
Jeff Sharkey
38ffbde17e Root UID can synthesize AttributionSource values.
We trust any incoming value from the system UID, so we should also
trust values coming from the root UID, which includes many shell
commands such as "svc".

Bug: 193659633
Test: atest BluetoothInstrumentationTests:com.android.bluetooth.btservice.AdapterServiceTest --rerun-until-failure 100
Change-Id: Ied07731345f08fc3c4df465a3773e35c8df7c59a
2021-07-14 14:35:17 -06:00
TreeHugger Robot
20b74d19a9 Merge "Validate AttributionSource during unparceling." into sc-dev am: fee338118c am: 0a31518cc0
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15275356

Change-Id: Ie29230201b4455228f10c3ea8128294faad6596b
2021-07-13 21:16:51 +00:00
TreeHugger Robot
2fa0bc50f2 Merge "Validate AttributionSource during unparceling." into sc-dev am: fee338118c
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15275356

Change-Id: Ia6de0ea0abf38ece5ca1e6fb8f9ebad91fd07bd9
2021-07-13 21:01:47 +00:00
TreeHugger Robot
fee338118c Merge "Validate AttributionSource during unparceling." into sc-dev 2021-07-13 20:57:17 +00:00
Jeff Sharkey
4025c6e7ae Validate AttributionSource during unparceling.
The Bluetooth stack is just one example of an application that makes
self-calls through public APIs, which makes it very difficult to
unconditionally validate AttributionSource arguments.

(The AttributionSource is correctly defined the first time a remote
caller enters the Bluetooth stack, but we've found many cases where
Bluetooth stack calls back into itself without clearing the Binder
identity, causing validation chaos.)

This change is an attempt at gracefully solving this by performing
validation automatically as part of unparceling an AttributionSource
the first time it enters a process.  This strategy isn't perfect,
since transporting an instance inside a Bundle would risk
unparceling much later, possibly long after the calling UID
information has been discarded.  We're rationalizing that this risk
doesn't exist since AttributionSource was only added a few months
ago, and isn't being used in this way.

We still intend to circle back and provide a better strategy in a
future release for transporting AttributionSource across AIDL which
will handle the nuances of self-calls.

Bug: 188391719
Test: atest BluetoothInstrumentationTests
Change-Id: I10b198cfcd8f361e19d52f86deb7f10f05fec891
2021-07-13 12:34:14 -06:00
TreeHugger Robot
01f6847c8a Merge "Optimize AttributionSource tokens - base" into sc-dev am: 2b90cc827b
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15247205

Change-Id: Id2435469fff42a22018a0d08370a987a76eb42b4
2021-07-12 20:30:07 +00:00
Jeff Sharkey
30eb87d8e0 Merge "Bring Predicate<Intent> to IntentFilter." 2021-07-12 15:16:13 +00:00
Rhed Jao
650cb7a9da Enforce package visibility to the callbacks of the sync status
App can read installed sync content providers without requiring
any permission via the api ContentResolver#requestSync and
ContentResolver#addStatusChangeListener.

This cl enforces package visibility filter to the api
ContentResolver#addStatusChangeListener. Application without the
package visibility tag of the target applications in its manifest
cannot receive sync status callbacks of the target applications.

Bug: 190726121
Test: atest AppEnumerationTests
Test: atest CtsSyncManagerTestsCases
Test: atest ContentResolverSyncTestCaseatest
Test: atest SyncManagerTest
Test  atest SyncOperationTest
Test: atest SyncStorageEngineTest
Test: atest DeferSyncTest
Change-Id: I58d0baf5baefd942b454f06e1fa9d3b34d532a77
2021-07-12 07:34:27 +00:00
TreeHugger Robot
26bcb4a503 Merge "Optimize AttributionSource tokens - base" into sc-dev am: 2b90cc827b am: 5e1a6bc443
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15247205

Change-Id: Ida44135b60e19d97c24f79ba2ff4d019d830b908
2021-07-10 02:36:28 +00:00
Svet Ganov
1babd5bf51 Optimize AttributionSource tokens - base
For cases where the attribution soruce doesn't need to be
registered as trusted we are now using a shares static
token since the only purpose of the token in these cases
is for watching the source process dying as opposed to that
and security for registered cases.

bug: 192415943

Test: CtsPermissionTestCases
      CtsPermission2TestCases
      CtsPermission3TestCases
      CtsPermission4TestCases
      CtsPermission5TestCases

Change-Id: I93fde9ca1cacada7929761533dcae11b2736ce1e
2021-07-10 00:24:30 +00:00
Tom Natan
2a3edbf6aa Merge "Add support for always_constrain_display_apis flag" into sc-dev am: 28a6e9f973 am: 5ff31f2304 am: 7db1f9f309
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15216092

Change-Id: I2c17714aff53c40efc955c7aadbf8c1ff6dbe2ea
2021-07-08 10:41:17 +00:00
Tom Natan
7db1f9f309 Merge "Add support for always_constrain_display_apis flag" into sc-dev am: 28a6e9f973 am: 5ff31f2304
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15216092

Change-Id: I9a8a095b4b9b3874bd5e6c0041cc0189e4dfeb87
2021-07-08 10:36:37 +00:00
Tom Natan
887c796529 Merge "Add support for always_constrain_display_apis flag" into sc-dev am: 28a6e9f973
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15216092

Change-Id: I9df325234e3e01b59c0a17fc8109f1c90182613d
2021-07-08 10:30:09 +00:00
Tom Natan
28a6e9f973 Merge "Add support for always_constrain_display_apis flag" into sc-dev 2021-07-08 10:25:09 +00:00
TreeHugger Robot
c4c0b6251b Merge "Tag some "new Binder()" instances to detect leaks." into sc-dev am: c8955e0799 am: 7da4e4c89c
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15225384

Change-Id: I74e95d4f14d80e92405a5fc872978540838f5888
2021-07-08 00:58:51 +00:00
TreeHugger Robot
05d6c2b79a Merge "Tag some "new Binder()" instances to detect leaks." into sc-dev am: c8955e0799 am: 7b41a7b17a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15225384

Change-Id: I23a82fd99bc697285ae2ab9436e9f711f57c7c23
2021-07-08 00:50:18 +00:00
TreeHugger Robot
eed6b1b8d1 Merge "Tag some "new Binder()" instances to detect leaks." into sc-dev am: c8955e0799
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15225384

Change-Id: I97ad328303c4c297294400a74d887c9067d4f2ba
2021-07-08 00:45:01 +00:00
Jeff Sharkey
79b834d47c Tag some "new Binder()" instances to detect leaks.
We've seen evidence of a Binder leak, and our hunch is that it's
caused by one of these anonymous "new Binder()" sites.  Adding
descriptors will help us identify the leak cause.

Bug: 192415943
Test: atest BluetoothInstrumentationTests
Change-Id: I30cd15f084cf50f67edd833b27b853c4b22e1db1
2021-07-07 17:17:07 -06:00