Commit Graph

21750 Commits

Author SHA1 Message Date
Abhijeet Kaur
5a309a440c Merge "Fix getUserIdFromUri() call for checkUriPermissions" 2021-08-09 09:23:10 +00:00
Ruslan Tkhakokhov
0ee662a085 Merge "Handle empty <cloud-backup> section in android:dataExtractionRules" into sc-dev am: b72bf2927e am: bfa03a415f
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15462078

Change-Id: Id822ec4f62b48283a61582284e9f8a783ef0eec9
2021-08-06 22:21:40 +00:00
John Wu
1548f793fc Merge "Enforce intents to match intent filters." 2021-08-06 16:20:23 +00:00
Ruslan Tkhakokhov
21f45cd998 Handle empty <cloud-backup> section in android:dataExtractionRules
Currently the <cloud-backup> section in android:dataExtractionRules is
ignored unless it contains rules. Instead, we should interpret it as
'everything other than cache and no-backup dirs is eligible for cloud
backup'.

Bug: 195095045
Test: 1. atest BackupEligibilityHostSideTest
      2. Use a test app with empty <cloud-backup> section to manually
      test:
          2.1. Empty section - everything is backed up
	  2.2. Empty section but "disableIfNoEncryptionCapabilitites"
	  set to "true" - data only backed up if the transport supports
	  encryption.
Change-Id: Ic8066721a46bda688f9211c51a0f2497e9caf93b
2021-08-06 12:16:05 +00:00
Abhijeet Kaur
ce3007407f Fix getUserIdFromUri() call for checkUriPermissions
checkUriPermissions is an API to check Uri permissions on a list of
Uris. This is an optimisation over calling checkUriPermission separately
for each Uri in the list as each call is a binder call.

The bug is caused due to getContext.checkUriPermissions() for User 10
calling into ActivityManagerService(AMS) for User 0. The old APIs
(checkUriPermission for 1 Uri) resolves the user one step before
calling into AMS that is in ContextImpl class. But resolving the
calling user via context in AMS is not resolving the actual user (in
this case the calling user is user 10, and AMS context resolves the
userId to User 0).
Resolving the user in AMS was a conscious decision we made as we wanted
to resolve the user for each uri in the list separately.

Fixed the above issue by passing userId to AMS from ContextImpl and then
resolving the user for each uri.

Bug: 194700183
Test: atest --user-type secondary_user CtsScopedStorageDeviceOnlyTest:android.scopedstorage.cts.device.RedactUriDeviceTest#testSharedRedactedUri_openFileForRead -c
Change-Id: Ia4f0ba39a34c8ae4bd46d6f10bca1052f1331400
2021-08-06 12:29:00 +01:00
Ayush Sharma
422e9b4e25 Revert "Construct EnterpriseSpecificIdCalculator only once after the boot phase"
This reverts commit fa35b718fe.

Reason for revert: https://buganizer.corp.google.com/issues/195677820
Bug: 195677820

Change-Id: I4af72af53d047d1905abc109fae3478ca80db085
2021-08-06 11:15:21 +00:00
Riddle Hsu
1f54973a62 Fix NPE when calling recreate in onCreate am: 6c675a3a48 am: 36b8c779f6
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15435289

Change-Id: Ia4e5a22c171f703ebf9de005f2a79b1d28610cea
2021-08-04 05:52:48 +00:00
Andrii Kulian
9a6c91dc10 Merge "Intercept activity start requests in client organizer" into sc-v2-dev am: 94a6a10f90 am: 8a3e649655
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15411942

Change-Id: I375bb0707edfb319998bff3be95555b067076897
2021-08-04 02:57:28 +00:00
Andrii Kulian
8a3e649655 Merge "Intercept activity start requests in client organizer" into sc-v2-dev am: 94a6a10f90
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15411942

Change-Id: Ie5535035dc6fe2db01fc490b9c7aca18e87467d3
2021-08-04 02:43:26 +00:00
Andrii Kulian
94a6a10f90 Merge "Intercept activity start requests in client organizer" into sc-v2-dev 2021-08-04 02:23:59 +00:00
Riddle Hsu
6c675a3a48 Fix NPE when calling recreate in onCreate
ActivityClientRecord#activity is assigned after calling
Activity#onCreate. A use case is that the app uses
support library to set night mode in onCreate.

Bug: 195418295
Test: Invoke Activity#recreate() in Activity#onCreate.
Change-Id: I6319cd6ee94fc2603979da47303963d04168db04
2021-08-04 10:16:41 +08:00
John Wu
f41ff188a0 Enforce intents to match intent filters.
When an app registers an exported component in its manifest and adds an <intent-filter>, the component can be started by any intent - even those that do not match the intent filter. This has proven to be something that many developers find counterintuitive. Without checking the intent when the component is started, in some circumstances this can allow 3P apps to trigger internal-only functionality.

Bug: 161252188
Test: atest CtsContentTestCases:PackageManagerTest
Change-Id: I19e8ee0a529314b3417435471c6e68988a2ab897
2021-08-03 22:24:48 +00:00
Andrii Kulian
94354a9a7f Intercept activity start requests in client organizer
This allows applying split rules to activity start requests for
different processes and covers APIs like 'startActivityAsUser',
not requiring app developers to use dedicated APIs to start to side
instead.

When the client organizer observes a new activity being started, it
creates a new TaskFragment first and modifies the activity start
options to target that container.

Bug: 194140227
Bug: 190433398
Test: Manual, using reference implementation and sample app.
Change-Id: Ice3de8ec725d327266ec38052129b4158608855e
2021-08-03 14:38:02 -07:00
Nate Myren
e612997b53 Merge "Add attribution info to start callbacks" into sc-dev am: 5d97f29218 am: 9d1a9399b8
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15446590

Change-Id: Ib6fedf0b38bd88c3f6cd0aef6efa9529f17aaa44
2021-08-03 20:18:59 +00:00
Nate Myren
aad177261c Merge "Add attribution info to start callbacks" into sc-dev am: 5d97f29218 am: d1a82a7de8
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15446590

Change-Id: Ic800a8e11e6d8513629ec8e9b1f64ffef0c85645
2021-08-03 20:18:08 +00:00
Nate Myren
7ebbcf1685 Merge "Add attribution info to start callbacks" into sc-dev am: 5d97f29218
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15446590

Change-Id: If5ddeb244befcaea57a3e53f741b94ec5bfd6dd0
2021-08-03 20:06:56 +00:00
Nate Myren
9d1a9399b8 Merge "Add attribution info to start callbacks" into sc-dev am: 5d97f29218
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15446590

Change-Id: I42bdf188ec74c9d3a7179f717a08c7fec7f33833
2021-08-03 20:06:34 +00:00
Nate Myren
5d97f29218 Merge "Add attribution info to start callbacks" into sc-dev 2021-08-03 19:56:02 +00:00
Lee Shombert
b28f81512e Merge "Revert "Do not cache wildcard users (PackageManager)"" 2021-08-03 16:06:47 +00:00
Nate Myren
f8dd173528 Merge "Revert sync app op chain changes" into sc-dev am: 50ff5ac8b8 am: 17e6177ea9
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15424412

Change-Id: I5081e4f0f78783192f553b74936a15755895e045
2021-08-03 15:52:58 +00:00
Neil Fuller
c2e44a4a83 Merge "Remove simulated LTZP and enable replacement" 2021-08-03 15:51:42 +00:00
Nate Myren
dcc8041ac2 Merge "Revert sync app op chain changes" into sc-dev am: 50ff5ac8b8 am: f685a342c8
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15424412

Change-Id: I2561613cf775cd7107bba4011a9362c3d9b88cd9
2021-08-03 15:49:39 +00:00
Nate Myren
e2942cb666 Merge "Revert sync app op chain changes" into sc-dev am: 50ff5ac8b8
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15424412

Change-Id: I63c16fa22d36295b9992740ea95ae69342f22307
2021-08-03 15:34:46 +00:00
Nate Myren
f685a342c8 Merge "Revert sync app op chain changes" into sc-dev am: 50ff5ac8b8
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15424412

Change-Id: I362a049cc0e3a255796dc3481cbb153c734da76d
2021-08-03 15:33:04 +00:00
Nate Myren
06d07d54db Add attribution info to start callbacks
Add attribution flags and chain IDs to start callbacks, and have the
PermissionUsageHelper listen for starts. This ensures that, if another
start happens while an op is already running, and has chain information,
then this chain information will be recorded.

Test: manual
Bug: 194198234
Change-Id: I0ab1aa0969b70e18001f4a814ea5689f9329a019
2021-08-03 08:25:31 -07:00
Nate Myren
50ff5ac8b8 Merge "Revert sync app op chain changes" into sc-dev 2021-08-03 15:16:35 +00:00
Neil Fuller
9420adfd7b Remove simulated LTZP and enable replacement
Remove "simulated" location time zone provider mode and enable "fake"
location time zone providers. This allows for more realistic testing
with binder-based LTZPs.

Many of the changes in this commit are the removal of command-line infra
and test logic associated with "simulated" mode. The new
"start_with_test_providers" command is required to enable changes to how
providers are discovered, since test providers are not found on the
system image and will not have the full permissions expected (which are
requirements of "real" providers). As part of this change "state
recording", something only used in tests, can only be turned on by
"start_with_test_providers". A "clear_recorded_provider_states" has been
added to enable tests to clear the recorded state.

The new test mode config deliberately does not survive a reboot.

Bug: 188780558
Bug: 184947690
Test: atest CtsLocationTimeZoneManagerHostTest
Test: atest com.android.server.timezonedetector
Change-Id: I7d8fc217fa070aee791fb376efb398057320503a
2021-08-03 13:20:07 +01:00
Louis Chang
6f1b5890db Merge "Sending TaskFragment token to client for the launching activity" into sc-v2-dev am: 3acc328b12 am: 435fbc6921
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15407674

Change-Id: Ib181452014b3a9633e0f5ddc023dca8f0e71945e
2021-08-03 02:56:06 +00:00
Louis Chang
435fbc6921 Merge "Sending TaskFragment token to client for the launching activity" into sc-v2-dev am: 3acc328b12
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15407674

Change-Id: Iab5ddf47b82b128674ec3cc6c1017cf8417689af
2021-08-03 02:43:39 +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
Nate Myren
86c337659a Revert sync app op chain changes
These changes cause some noted app ops to be swallowed due to one-way
app ops.

Fixes: 187721493
Test: atest AppOpsLoggingTest
Change-Id: I3b761b65b2e06138fc1d130bf80587f8885bb1d5
2021-08-02 12:50:44 -07:00
“Ayush
fa35b718fe Construct EnterpriseSpecificIdCalculator only once after the boot phase
is completed.

Construct the EnterpriseSpecificIdCalculator object after boot phase is
complete, as some of the dependencies(telephony and wifi service) for
this class are not properly initialized before that.

Bug: 191741106
Test: atest com.android.cts.devicepolicy.MixedDeviceOwnerTest#testEnrollmentSpecificIdCorrectCalculation com.android.cts.devicepolicy.MixedManagedProfileOwnerTest#testEnrollmentSpecificIdCorrectCalculation com.android.cts.devicepolicy.MixedDeviceOwnerTest#testEnrollmentSpecificIdEmptyAndMultipleSet com.android.cts.devicepolicy.MixedManagedProfileOwnerTest#testEnrollmentSpecificIdEmptyAndMultipleSet

Change-Id: I20927cdc6844591f12d390ced7f1471733602a81
2021-08-02 10:05:39 +00:00
Louis Chang
332036a29e Sending TaskFragment token to client for the launching activity
Activity#onCreate is called before receiving the TaskFragment
appeared event in the client process. So, the client split
controller created another split and resulted in unexpected
behaviors.

Bug: 194860679
Test: start activity to side
Test: wm presubmit

Change-Id: Iac34bd39376940c5c0224c8687ad9858a4190e20
2021-08-02 09:42:36 +08:00
Mariia Sandrikova
438644871b Merge "Freeze live wallpaper for letterbox background." into sc-v2-dev am: 809e26fc6a am: f12299be1a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15360874

Change-Id: Ife9a312b135e13f4159dbe865237eca87638d350
2021-07-30 15:09:52 +00:00
Mariia Sandrikova
f12299be1a Merge "Freeze live wallpaper for letterbox background." into sc-v2-dev am: 809e26fc6a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15360874

Change-Id: I142561c76775ee52f2ffe898b97bbc495db8790b
2021-07-30 15:03:03 +00:00
Mariia Sandrikova
809e26fc6a Merge "Freeze live wallpaper for letterbox background." into sc-v2-dev 2021-07-30 15:00:37 +00:00
Mariia Sandrikova
a829124577 Freeze live wallpaper for letterbox background.
With this change, WallpaperController sends "freeze" / "unfreeze" commands when the app window is letterboxed / not letterboxed indicating that:
- "freeze": a screenshot of the wallpaper is taken by WallpaperServices and put on top of the main surface while the wallpaper host is notified through onVisibilityChanged(false) callback that it's no longer visible.
- "unfreeze": a screenshot of the wallpaper is removed and the wallpaper host is notified through onVisibilityChanged(true) callback if the wallpaper is visible again (e.g., if transitioned from an app to the Home screen).

Logic isn't applied to static wallpapers.

When wallpaper size changes while being frozen, the screenshot is scaled and cropped to adjust to the new size.

Fix: 177884751
Test: Manual, atest WallpaperServiceTest, WallpaperServiceTests
Change-Id: If0300478cdccc07d226117e01ce3d43aa0b432a0
2021-07-30 12:58:34 +01:00
Jeff DeCew
8f8facbbbc Merge "Fix bug removing semantic colors of CallStyle notification actions." into sc-dev am: 4203db854f
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15405173

Change-Id: If6c4a857e6cc322f8071256bc2645bae74f1274a
2021-07-30 00:48:48 +00:00
Chalard Jean
6bc441cc01 Merge "Fix: ConnectivityManager methods crashing with SecurityException" into sc-dev am: 4e7b1128a4
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15401698

Change-Id: Iad002e42bc2c436ad6a69ff61a3c1b0646dc7e9c
2021-07-30 00:44:45 +00:00
Jeff DeCew
730b4ffe99 Merge "Fix bug removing semantic colors of CallStyle notification actions." into sc-dev am: 4203db854f am: 9da83c7285
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15405173

Change-Id: Id7d9dc3cbce68a74060c901fb55fd2b0baaf0e09
2021-07-30 00:15:31 +00:00
Jeff DeCew
86d4294f37 Merge "Fix bug removing semantic colors of CallStyle notification actions." into sc-dev am: 4203db854f am: e38e044460
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15405173

Change-Id: I6834b60e83a3ddb086febd02416f4a4c8f0f97a5
2021-07-29 21:29:44 +00:00
Jeff DeCew
9da83c7285 Merge "Fix bug removing semantic colors of CallStyle notification actions." into sc-dev am: 4203db854f
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15405173

Change-Id: I0aab8ac3c1a29c22751f33e7f699db73ff8389e6
2021-07-29 20:37:09 +00:00
Jeff DeCew
4203db854f Merge "Fix bug removing semantic colors of CallStyle notification actions." into sc-dev 2021-07-29 20:24:37 +00:00
Adam He
499b4cf331 Merge "Fix FLAGS_ALL_CONTROL to match more recently added flags." 2021-07-29 18:18:07 +00:00
Chalard Jean
4db9916a3d Merge "Fix: ConnectivityManager methods crashing with SecurityException" into sc-dev am: 4e7b1128a4 am: c962260ff6
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15401698

Change-Id: I2fb4b4703f855e2bf63173bf48ff3ec2d1db5225
2021-07-29 15:55:11 +00:00
Jeff DeCew
5dae211842 Fix bug removing semantic colors of CallStyle notification actions.
* When we changed the default color of emphasized actions to an accent color instead of the notification background color, I didn't split the two into different locals, and this meant the accent color was used to enforce the color contrast of the custom color.  This led to color desaturation in an attempt to meet contrast (when in dark mode) and a failure to ensure sufficient contrast (in light mode).
* A piece of this that applies specifically to colorized notifications is that we used the 'night mode' state as a shortcut for whether the background was light or dark.  This led to 1) different foreground colors for the same background color, depending on dark mode state, and 2) frequently a failure to meet contrast (and/or extreme desaturation) in one of those modes.
* Also adding different night-mode colors for CallStyle actions, to meet spec.

Test: validated sufficient contrast of default and various colorized background/button combos using the accessibility scanner.
Bug: 194935539
Change-Id: I3a69eadc89f1d9d98a816c44a36873c7615a177e
2021-07-29 11:16:52 -04:00
Chalard Jean
f704b05986 Merge "Fix: ConnectivityManager methods crashing with SecurityException" into sc-dev am: 4e7b1128a4 am: b029e44129
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15401698

Change-Id: I85dcb34a88200484bd66689f7a67e93161b86871
2021-07-29 06:18:25 +00:00
Chalard Jean
c962260ff6 Merge "Fix: ConnectivityManager methods crashing with SecurityException" into sc-dev am: 4e7b1128a4
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15401698

Change-Id: I06737e036ff0a320b157929329d031ff036734fc
2021-07-29 06:06:00 +00:00
Chalard Jean
d90d6457fb Fix: ConnectivityManager methods crashing with SecurityException
Starting in R, some methods in ConnectivityManager like
getNetworkCapabilities started passing the package name from
the context stored in CM to check that the package is really
whom it pretends to be. Unfortunately, in some cases, the
context contains package "android" for an app, and since the
app is not the system, the check fails and crashes the app.

It seems the culprit is updateHttpProxy, which is called by
ProcessList when the PROXY_CHANGE_ACTION broadcast is sent.
If this happens to run between the time the process is created
and the activity thread is "bound", then the mInitialApplication
member is not set, and updateHttpProxy uses a system context.
Since ConnectivityManager caches the context forever in a
static, this leads to subsequent legitimate calls crashing.

Setting the proxy can be deffered until such a time that the
app is bound, as it can't run any code before then. The member
is never reset to null, so it's guaranteed to be non-null at
bind time.

An alternative would be to post a runnable on the handler
thread if the member is null to try again later. This
could however run the lambda a considerable number of times
as binding can be delayed, and risks causing an infinite loop
if some invariants are changed in the future.

See also b/73572062 and ag/4056059

Bug: 155549446
Bug: 189360509
Test: ActivityThreadTest FrameworksNetTests NetworkStackTests
Test: Manually set a proxy, observe the broadcast being sent and
      apps not crashing
Change-Id: I956f76be2e0a1a675576511fb394d7ed4354b28a
(cherry picked from commit b0d13e29515d5b7c82daed7533b78ac57e46bd93)
2021-07-29 11:55:37 +09:00
Adam He
1481996b33 Fix FLAGS_ALL_CONTROL to match more recently added flags.
* Also add a warning message for future flags being added.

Fixes: 177097561
Test: atest CtsAutoFillServiceTestCases
Change-Id: Ia2e78601dfb18a50c2a243936a210d5f372821cf
2021-07-28 16:56:22 -07:00