Commit Graph

20945 Commits

Author SHA1 Message Date
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
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
Evan Severson
1d096f209d Add global app op restrictions
Instead of managing across all users we can restrict globally and fast
fail if the restriction is set

Test: atest CtsSensorPrivacyTestCases
Bug: 191016260
Change-Id: Ida1a2d1734b7e3d40818485062bec0f96270bc4b
2021-06-28 22:22:59 +00:00
Ryan Mitchell
5a532f6eed Merge changes Icf81845d,Iea54abf3,I98656314 into sc-dev
* changes:
  Apply overlay changes with config change
  Version LoadedApk cache using base code path
  Revert "Deprecate Context#createApplicationContext"
2021-06-27 06:27:58 +00:00
Ahaan Ugale
e288fd3106 Merge "Fix finishOp for HotwordDetectionService" into sc-dev 2021-06-26 03:27:40 +00:00
Ahaan Ugale
c27cb748b1 Fix finishOp for HotwordDetectionService
We currently specially handle the HotwordDetectionService uid in
AppOpsPolicy. But CheckOpsDelegate doesn't currently include finishOp,
so that doesn't work for the hotword service. This change adds finishOp
to the interface and implements it in AppOpsPolicy to be consistent with
the other ops.

Bug: 190011174
Test: manual - no error in logs for finishOp
Test: manual - privacy indicator works as expected (with another wip
 change)
Change-Id: I77907092a917362aacd0d5562e54abd6f3c3d47b
2021-06-25 12:08:09 -07:00
Evan Severson
03b6c09259 Show mic/cam enable dialog for IME
If the IME is bound with capabilities it is considered to be in use by
the user so when they attempt to open the mic or camera we show the
dialog to renable.

Test: Disable microphone and use gboard
Bug: 187154145
Change-Id: Icf8d91f2a2b97068852c1b98d36916c07c42d3fa
2021-06-25 10:30:52 -07:00
Charles Chen
38b1683735 Obtain DisplayMetrics from DisplaymanagerGlobal directly
Previously we use cache to store value returned from
DisplayManagerGlobal#getAdjustedDisplay(int, DisplayAdjustments)
in RM#getAdjustedDisplay(int, DisplayAdjustments).
Since RM#getAdjustedDisplay(int, DisplayAdjustments) is just
used in RM#getDisplayMetrics(int, DisplayAdjustments), we can
furthur call getDisplayInfo(int) from DisplayManagerGlobal and call
DisplayInfo#getAppMetrics to obtain DisplayMetrics directly.

Also, #getDisplayInfo has binder cache, so we don't need another cache
to store returned DisplayMetrics value from DisplayManagerGlobal.

Before this CL
[1/1] android.app.ResourcesManagerPerfTest#getDisplayMetrics: PASSED
(10.844s)
	getDisplayMetrics_median: 1840
	perfetto_file_path:
/sdcard/test_results/android.app.ResourcesManagerPerfTest_getDisplayMetrics/PerfettoListener/perfetto_android.app.ResourcesManagerPerfTest_getDisplayMetrics-1.pb
	getDisplayMetrics_mean: 1857
	getDisplayMetrics_min: 1817
	getDisplayMetrics_standardDeviation: 35

After this CL,
com.android.perftests.core (1 Test)
[1/1] android.app.ResourcesManagerPerfTest#getDisplayMetrics: PASSED
(11.185s)
	getDisplayMetrics_median: 733
	perfetto_file_path:
/sdcard/test_results/android.app.ResourcesManagerPerfTest_getDisplayMetrics/PerfettoListener/perfetto_android.app.ResourcesManagerPerfTest_getDisplayMetrics-1.pb
	getDisplayMetrics_mean: 733
	getDisplayMetrics_min: 725
	getDisplayMetrics_standardDeviation: 5

Test: atest android.app.ResourcesManagerPerfTest#getDisplayMetrics
fixes: 191662456

Change-Id: I934ecae19431800a9a4e0f3e3821e80ef4b5d8cf
2021-06-24 09:38:27 +00:00
Ryan Mitchell
8a9a70615e Apply overlay changes with config change
In R, when overlay changes a configuration change event is triggered
within the app process affected by the overlay change immediately
after updating the overlay paths of resources objects. All activities
would be relaunched after the configuration changed occurred resulting
in activity life-cycle events occurring for activities running in the
background. Apps may assume that onResume is invoked while they are in
the foreground so we made a fix that triggered the activities to be
relaunched when they are brought to the foreground.

The fix involved storing the asset sequence in the AMS and triggering
a configuration change from the AMS for each process affected by the
overlay change. This created problems where the app may receive a
configuration from the AMS with an updated asset sequence before the
event to handle the application info changing actually updated
resources objects. This resulted in reinflating views with the updated
configuration before the overlays were updated in the underlying
resources objects.

This change allows allows RM to apply changes to application infos when
it sees the asset sequence increase during a configuration change,
rather than having to wait for handleApplicationInfoChanged to run.

Bug: 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: Icf81845da9890cda0fb38cf6fe51d1d66e5ea840
2021-06-24 05:27:47 +00:00
Zhen Zhang
bdac90593f Enforce permissions check in getLastTimeAnyComponentUsed
Enforce the permission check for both INTERACT_ACROSS_USERS and
PACKAGE_USAGE_STATS permissions.

Bug: 191382775
Test: atest CtsUsageStatsTestCases:UsageStatsTest
Change-Id: I1371070478306005b2b4a59a1bc794bc368ae0c4
2021-06-23 16:34:50 -07:00
Nate Myren
3e51f7cabd Merge "Create Attribution Chains in HistoricalOps" into sc-dev 2021-06-23 21:23:19 +00:00
TreeHugger Robot
56b4df6954 Merge "[pm] drop non-APK paths from LoadedApk makePath" into sc-dev 2021-06-23 20:19:32 +00:00
Nate Myren
fd49debdc0 Create Attribution Chains in HistoricalOps
Add a historical flag to signify that attribution chains should be
assembled. Assemble the chains, filter out middle nodes, and attach the
last visible node to the start as a proxy info

Bug: 158792096
Test: manual
Change-Id: I8fbd8f438c62b28fd90039440e86224c624dea79
2021-06-23 12:12:15 -07:00
Lucas Dupin
ebd663f556 Correctly serialize population
All populations were being set to 0, causing all colors to be wrong.

Test: manual
Bug: 191391779
Bug: 191374703
Change-Id: Id5bef180ca3e6f30e30631781a74b2efb4402ac5
2021-06-23 09:30:24 -07:00
Ryan Mitchell
25360a2f65 Version LoadedApk cache using base code path
When a context is requested through Context#createApplicationContext,
the underlying LoadedApk cached in ActivityThread#mResourcePackages is
updated using the ApplicationInfo passed in. This creates unexpected
problems when using APIs that expect to be able to read resources from
a previous version of a package after that package has been updated.

With this change, contexts requested through
Context#createPackageContext and Context#createApplicationContext will
will have an underlying LoadedAPK that is tied to the version of the
package represented by the ApplicationInfo. If createPackageContext
is invoked before a package updates and then after a package updates,
the two contexts will have different underlying LoaddApks.

The ActivityThread#mPackages and ActivityThread#mResourcePackages now
only hold LoadedAPKs of that were created using ApplicationInfos that
were sent to this process from system_server in order to run the
application. Whenever a newer version of  an ApplicationInfo is
delivered from system_server for one of these packages, the previously
cached LoadedAPK will be updated using the new ApplicationInfo. This
will usually be because of an overlay change or "don't kill" package
upgrade.

Bug: 188059515
Test: atest FrameworksCoreTests:ContextTest
Change-Id: Iea54abf38449c9d8ab9dae16d36d95cbb4d7d8b0
2021-06-22 22:31:20 -07:00
Ryan Mitchell
5a41b45a85 Revert "Deprecate Context#createApplicationContext"
This reverts commit c54ebba25b.

Bug: 188059515
Test: atest FrameworksCoreTests:ContextTest
Change-Id: I986563142dac135281889e811e6e5219d728d5d1
2021-06-22 22:30:38 -07:00
Songchun Fan
fece532bbf [pm] drop non-APK paths from LoadedApk makePath
After the introduction of the uses-native-library tag,
sharedLibraryFiles might contain native library names such as
"lib_aion_buffer.so". The old method makePath in the LoadedApk class was
looking for APK paths under the assumption that all the paths in
sharedLibraryFiles are APK paths. Parsing on the results of makePaths
could lead to app crashes because the results are not valid APK paths.
This CL fixes that.

BUG: 190787130
Test: manual
Change-Id: I2b3d439f8edda7ef27e1106046cf8c0b88d755d9
2021-06-22 11:22:31 -07:00
Jeff DeCew
f24e216a60 Merge "Fix a security exception breaking notification inflation." into sc-dev 2021-06-22 13:40:35 +00:00
James O'Leary
6aad992ea5 Merge "Update serialization of WallpaperColors" into sc-dev 2021-06-22 02:48:57 +00:00
Lee Shombert
c1ad465c8a Merge "Modify PropertyInvalidatedCache" into sc-dev 2021-06-21 23:03:18 +00:00
Lee Shombert
659dcc86a3 Modify PropertyInvalidatedCache
Bug: 186778818

This makes two changes to PropertyInvalidatedCache.

1. disableLocal() now disables all current and future caches that use
   the same name (not the necessarily the same property) , in the
   local process.  Previously, disableLocal() only disabled a single
   cache instance, but the intent was always to disable all instances
   of the same cache in the process.

   disableInstance() is available with the old behavior.

2. A bypass() method has been added.  If bypass() returns true,
   query() will skip the cache and go straight to the binder call as
   though the cache had been disabled.  The default implementation
   always returns false.  Caches can override the implementation to
   avoid caching selected queries.

These changes specifically address the problem of caches that are
created dynamically and which should be disabled in the local
process.

A unit-test is added for PropertyInvalidatedCache.  This is not a
complete test because test processes are not allowed to set system
properties.  The unit-test will be improved in the future by modifying
PropertyInvalidatedCache to use an invalidation mechanism other than
system properties.

Manual test: boot a phone with a baseline build and with the build
under test and verified that the list of disabled caches is the same.
Use 'dumpsys cacheinfo' to get the cache status.

Test: atest
 * FrameworksServicesTests:UserManagerServiceCreateProfileTest

Change-Id: I9f604b872911290e4e3d8a58b3e28e328b2000a9
2021-06-21 13:49:29 -07:00