Commit Graph

20964 Commits

Author SHA1 Message Date
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
Nate Myren
5d97f29218 Merge "Add attribution info to start callbacks" into sc-dev 2021-08-03 19:56:02 +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
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
Jeff DeCew
4203db854f Merge "Fix bug removing semantic colors of CallStyle notification actions." into sc-dev 2021-07-29 20:24:37 +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
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
Rubin Xu
28e4c5d57a Merge "Stop managed profile owner granting READ_SMS" into sc-dev 2021-07-27 08:51:15 +00:00
Ahaan Ugale
2db19f5679 Merge "Copy ContentCaptureOptions into derived Contexts" into sc-dev 2021-07-24 01:18:17 +00:00
Alex Johnston
7f632dca95 Stop managed profile owner granting READ_SMS
Reason: There is only one telephony stack shared
between the personal and work profile.

Bug: 194382185
Bug: 189942529
Test: atest com.android.cts.devicepolicy.MixedManagedProfileOwnerTest#testGrantOfSensorsRelatedPermissions
      atest com.android.cts.devicepolicy.MixedManagedProfileOwnerTest#testDenyOfSensorsRelatedPermissions
      atest com.android.cts.devicepolicy.MixedManagedProfileOwnerTest#testSensorsRelatedPermissionsNotGrantedViaPolicy
      atest com.android.cts.devicepolicy.MixedDeviceOwnerTest#testGrantOfSensorsRelatedPermissions
      atest com.android.cts.devicepolicy.MixedDeviceOwnerTest#testDenyOfSensorsRelatedPermissions
      atest com.android.cts.devicepolicy.MixedDeviceOwnerTest#testSensorsRelatedPermissionsNotGrantedViaPolicy
Change-Id: I99384d5713bb2d04f5b6fbe20c17bd72a39b57d7
2021-07-23 17:05:21 +01:00
Ahaan Ugale
0cfcde8d5e Copy ContentCaptureOptions into derived Contexts
When a new Context is created from the Activity Context and used to
inflate views, Content Capture is disabled for those views because the
new Context is missing ContentCaptureOptions.

Fix: 194321297
Test: atest CtsContentCaptureServiceTestCases
Test: manual - view appeared events come through
Change-Id: I934d41953c7668e371d5961b66187ecd15408e3e
2021-07-23 03:24:42 +00:00
Bo Liu
0b2ad9f70d Implement java PerformanceHintManager on top of native
Note some exceptions became silence errors in this conversion.

Test: None
Bug: 194204196
Change-Id: Ia3cc7f2396f2e307a23b40b3f104a2fa90352196
2021-07-22 11:33:13 -04:00
Evan Severson
2b11e7f25c Merge "Don't block intent if op is restricted due to toggles" into sc-dev 2021-07-21 17:10:21 +00:00
Evan Severson
7b6d643171 Don't block intent if op is restricted due to toggles
Test: Create sdk 22 and 30 test apps and use the MEDIASTORE intents
Bug: 192635623
Change-Id: I250a5e398e72919ec8217e87b76273082e781f63
2021-07-21 08:37:00 -07:00
Shuo Qian
2be8f7898d Change the doc to reflect the default status of preferential network service
Test: Build
Bug: 193913733
Change-Id: I648b85c39f9b4e66193188852d649e82371ee90c
2021-07-19 23:24:55 +00:00
TreeHugger Robot
e0c972a2be Merge "Don't allow PI crashes on unknown sender types" into sc-dev 2021-07-15 03:14:15 +00:00
Hongwei Wang
ebe8550d03 Fix letterbox issue when auto-enter-pip from landscape
Included in this CL
- Skip layout of window when in transition to PiP mode
- Pass display cutout info via TaskInfo
- Removed TaskInfoCompat

Video: http://recall/-/aaaaaabFQoRHlzixHdtY/bpKcGg1eoOo5Jz5U6IwBYK
Bug: 191310680
Test: manual, auto-enter-pip from landscape with source rect hint being
      turned on, see the video
Change-Id: Ie657d15d9edb9d07555bd166b5919bb12cb217e6
Merged-In: Ie657d15d9edb9d07555bd166b5919bb12cb217e6
2021-07-13 15:07:18 -07:00
TreeHugger Robot
d2dd630204 Merge "Apply pending AppInfo on Activity override change" into sc-dev 2021-07-12 23:46:03 +00:00
TreeHugger Robot
f59bf68628 Merge "Remove isAppStartModeDisabled binder entry point" into sc-dev 2021-07-12 22:14:30 +00:00
Ryan Mitchell
290e51fce3 Apply pending AppInfo on Activity override change
When the activity override configuration changes, we need to apply any
pending application info changes so that when the activity is
recreated, it will have updated overlays.

Bug: 193256671
Test: change live wallpaper and observe launcher colors
Change-Id: I6b8c25a6e6756f612a0f57c921625bc58ac1ecf6
2021-07-12 22:00:43 +00:00
Jeff DeCew
d14c60be51 Merge "Use SRC_ATOP instead of SRC_IN for blending the NotificationExpandButton" into sc-dev 2021-07-12 19:48:58 +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
Christopher Tate
6054148ef9 Remove isAppStartModeDisabled binder entry point
Obsolete: the use cases for which it was introduced now have a clean
internal API layer to use instead, and this reduces informational
exposure about package presence & states.

Bug: 185513355
Test: atest SyncManagerTest
Test: atest CtsSyncManagerTest
Change-Id: I4aa1848950061dce3a1378f7d0117364e62ba59f
2021-07-09 14:28:37 -07:00
Jeff DeCew
8d6f3cc158 Use SRC_ATOP instead of SRC_IN for blending the NotificationExpandButton
Bug: 191969252
Bug: 193157438
Test: check for number of layers in the scene
Change-Id: I65bd80c71b55582347da1559cf707e9d023b7f13
2021-07-09 15:40:31 -04:00
Soonil Nagarkar
8fba7cf989 Don't allow PI crashes on unknown sender types
Bug: 193207800
Test: presubmits
Change-Id: I2a674549f4cfe45841dc0094709666c25c2d743b
2021-07-09 09:08:47 -07:00
Amith Yamasani
9eed97ac10 Merge "Fix FGS notification mismatch" into sc-dev 2021-07-09 01:45:59 +00:00
Chris Li
a23a2bb5db Revert "Revert "Not show size compat UI when task is not visible""
This reverts commit 76370b6fe6.

Reason for revert: Fix the merge break in ShellTaskOrganizerTests.java

Fix: 193069342
Test: atest WMShellUnitTests:ShellTaskOrganizerTests
Change-Id: I02c4bddc407eaac0ebb7cd5abb0b394f242d4d6e
2021-07-08 12:09:40 -07:00
Chris Li
e7ed99bfc2 Merge "Remove TaskInfo#topActivityToken usage in size compat for security" into sc-dev 2021-07-08 18:05:40 +00:00
Chris Li
1245aefa49 Remove TaskInfo#topActivityToken usage in size compat for security
Security report shows that this can cause leak token of different app.

Replace the functionality with a callback to the TaskOrganizerController
to restart activity when size compat restart button is clicked.

Bug: 186776724
Test: manually verify the restart button still works
Change-Id: I097b9f02e8435e6765695b9d5a531a4e165bac66
Merged-In: I097b9f02e8435e6765695b9d5a531a4e165bac66
2021-07-07 21:09:24 -07:00
Christopher Tate
ac4c63c682 Fix FGS notification mismatch
Mistakenly matching against id alone, rather than the (id,tag) tuple,
led to some notifications mistakenly being flagged as FGS-related.

Bug: 191518901
Test: atest CtsAppTestCases:android.app.cts.ServiceTest
Test: atest CtsAppTestCases:android.app.cts.NotificationManagerTest
Test: manual
Change-Id: I11c3993c13ded7859a5a860dcc99728f3db9809f
2021-07-07 19:15:08 -07:00
Bernardo Rufino
224dd7ca0d Require proper permission for togglePanel()/handleSystemKey()
In S, we're preventing apps from closing notification shade unless they
fall into certain exemptions. The methods togglePanel() and
handleSystemKey() weren't properly protected, so fixing that.

These methods were @hide, only available in the AIDL and their only
usages were inside the system

Introducing @TestApis to be able to verify this in CTS.

Bug: 192946152
Test: atest -d CtsAppTestCases:android.app.cts.StatusBarManagerTest
Test: atest -d CtsLegacyNotification30TestCases:android.app.notification.legacy30.cts.StatusBarManagerApi30Test
Test: 1. adb shell input keyevent KEYCODE_SYSTEM_NAVIGATION_DOWN
      2. Verify status bar expands
      3. adb shell input keyevent KEYCODE_SYSTEM_NAVIGATION_UP
      4. Verify status bar collapses

Change-Id: I925e3570c8d275a1159e4b6912e4628c9528cb61
2021-07-07 11:12:50 +01:00
Alex Johnston
61a9cafe83 Merge "Update API contract PASSWORD_COMPLEXITY_LOW" into sc-dev 2021-07-05 08:56:48 +00:00
TreeHugger Robot
881dc456c8 Merge "Add OPSTR_RECORD_AUDIO_HOTWORD to TestApi" into sc-dev 2021-07-03 10:30:16 +00:00
Alex Johnston
abc113dccb Update API contract PASSWORD_COMPLEXITY_LOW
* Mention any PIN is allowed, not necessarily
  just ordered or repeating PINs.
* Mention alphanumeric and alphabetic passwords
  are allowed.

Bug: 181873824
Test: build
Change-Id: Iac75dbdde18de39e0b66ab03463830f5b4f28033
2021-07-02 22:20:19 +01:00
TreeHugger Robot
9b1891b428 Merge "Do not update RM config with previous sequence" into sc-dev 2021-07-02 20:34:13 +00:00
Nate Myren
1e1aef37c8 Merge "Create "trusted chain" mechanism for AttributionSource" into sc-dev 2021-07-02 20:03:33 +00:00
Ryan Mitchell
82549387c0 Do not update RM config with previous sequence
If an application info update is pending and
RM#applyConfigurationToResourcesLocked is called with a config
with an older sequence that RM's current global config, the application
info update should not be applied, nor should the global config be
updated with the older config.

Similarly, when an application is updated and there is a pending
application info change for the previous version of the package,
clear the currently pending application info updates for that package
to prevent the old overlays from being applied on top of the newly
updated application.

Bug: 189100984
Bug: 192449747
Test: toggle wallpaper and observe QS has correct colors
Change-Id: I4bab55960febdae16df7150ccac44e06245e8333
2021-07-02 11:32:22 -07:00
Nate Myren
590e699ce9 Add OPSTR_RECORD_AUDIO_HOTWORD to TestApi
Test: build
Bug: 192506494
Change-Id: If626f07ec4a04da60295f2f1210cb2e9bbd54f88
2021-06-30 19:32:45 -07:00
Jing Ji
dbd7bb2e0e Provide a system_server internal API to get isolated PIDs of an UID
Internal services within system_server can query the PID list of
the isolated processes with packages matching the given UID.

Also added a shell command to help the testing.

Bug: 191703385
Test: atest FrameworksServicesTests:ActivityManagerTest
Change-Id: I9749bc9c70902221f41945c7e785d13631acbae2
2021-06-30 16:23:05 -07:00
Nate Myren
4c426c4d03 Create "trusted chain" mechanism for AttributionSource
Add and populate a "trusted" attribution flag, that verifies the
attribution sources used to create it were trusted.

Fixes: 192270935
Test: atest RuntimePermissionsAppOpTrackingTest
Change-Id: Ifd8f825151bec55aa795da7bee0a3069509f5abe
2021-06-30 16:06:59 -07:00
Ryan Mitchell
b3659d36b0 Merge changes from topic "revert-15058002-SNQUARIDWJ" into sc-dev
* changes:
  Revert^2 "Apply overlay changes with config change"
  Revert^3 "Deprecate Context#createApplicationContext"
2021-06-30 20:58:43 +00:00
Ryan Mitchell
090d6e8865 Revert^2 "Apply overlay changes with config change"
This reverts commit fa5ab2d27b.

Reason for revert: Was not the cause of the test failure

Fixes: 189100984
Test: toggle wallpaper and observe QS has correct colors
Test: launch an app, navigate away from the app, change wallpapers, and
      observe app is relaunched and has correct colors when resumed
Change-Id: Ib3930c06b53f71749ec31784ebe6e8a735a1046d
2021-06-30 15:54:22 +00:00
Ryan Mitchell
350c2669d6 Revert^3 "Deprecate Context#createApplicationContext"
This reverts commit cb5a80ea57.

Reason for revert: Was not the cause of the test failure

Fixes: 186622527
Test: atest FrameworksCoreTests:ContextTest
Change-Id: I705854f080200f0465d94a7754e710f05a3ec92c
2021-06-30 15:53:45 +00:00
Paul Hobbs
8d440c0566 Merge changes from topic "revert-15058002-SNQUARIDWJ" into sc-dev
* changes:
  Revert^2 "Deprecate Context#createApplicationContext"
  Revert "Version LoadedApk cache using base code path"
  Revert "Apply overlay changes with config change"
2021-06-29 20:36:15 +00:00
Paul Hobbs
cb5a80ea57 Revert^2 "Deprecate Context#createApplicationContext"
Bug: 192242649

5a41b45a85

Change-Id: Idcebd68e0079e7e87de04ae25069b3a9ff72093c
2021-06-29 20:06:45 +00:00
Paul Hobbs
214bf65c95 Revert "Version LoadedApk cache using base code path"
Revert submission 15058002

Reason for revert: Causes crash in com.android.cts.splitapp, breaks android.appsecurity.cts.SplitTests#testFeatureWithoutRestart_full.
Bug: 192242649

Reverted Changes:
Icf81845da:Apply overlay changes with config change
Iea54abf38:Version LoadedApk cache using base code path
I986563142:Revert "Deprecate Context#createApplicationContext...

Change-Id: Iefd431eaddccab8ccbf33bdd701516e34118615f
2021-06-29 19:54:32 +00:00
Paul Hobbs
fa5ab2d27b Revert "Apply overlay changes with config change"
Revert submission 15058002

Reason for revert: Causes crash in com.android.cts.splitapp, breaks android.appsecurity.cts.SplitTests#testFeatureWithoutRestart_full.
Bug: 192242649

Reverted Changes:
Icf81845da:Apply overlay changes with config change
Iea54abf38:Version LoadedApk cache using base code path
I986563142:Revert "Deprecate Context#createApplicationContext...

Change-Id: Ifb30daa85d9de4587bc39e074341ebdefaf26f84
2021-06-29 19:54:32 +00:00
TreeHugger Robot
0ac141c3ba Merge "Add global app op restrictions" into sc-dev 2021-06-29 19:53:50 +00:00
TreeHugger Robot
1ebeff8939 Merge "Show mic/cam enable dialog for IME" into sc-dev 2021-06-29 00:04:21 +00:00