Commit Graph

19112 Commits

Author SHA1 Message Date
Joanne Chung
11f3fdf4e2 Made CacheQuotaHint testable.
Bug: 158762190
Test: atest android.app.usage.cts.CacheQuotaHintTest
Change-Id: I2b0a49e5199354972231c44c6956073bf714e2e4
2020-10-14 09:56:43 +08:00
Riddle Hsu
e839c2ca79 Move defer-process-config for cached process to client side
Previously the cached state highly depends on the path of oom-adj
update, that causes potential lock contention between WMS and AMS.

Because the original major problem might be the heavy IO operations
by accessing the resources when handling configuration change from
dozens of non-important processes. The client side config deferring
could be enough help for the case.

This is also the last removal of holding WM lock in the path of
oom-adj update.

Bug: 143432064
Bug: 159104503
Test: ActivityThreadTest# \
      testHandleProcessConfigurationChanged_DependOnProcessState
Change-Id: Iefc9e02aa374bc74f263cf0c10612f89b864530b
2020-10-07 23:42:00 +08:00
TreeHugger Robot
0572a76bc1 Merge "Addressing API review comments." 2020-10-06 15:24:53 +00:00
Eran Messeri
4634589e41 Refactoring: Use explicit methods for checking DO/PO
Do not use USES_POLICY_PROFILE_OWNER / USES_POLICY_DEVICE_OWNER.
Instead, use explicit methods for checking if the caller is
the Device Owner or Profile Owner.

USES_POLICY_PROFILE_OWNER is confusing since internally in the
DevicePolicyManagerService, it implied a Device Owner is also a
Profile Owner, which is not always what the caller expected.

This is the first phase of the refactoring, removing external calles'
dependency on these constants. The next phase will remove them
internally completely in favour of an implementation that
accesses mOwners directly.

There are no functional changes in this CL.

Bug: 163028934
Test: atest FrameworksServicesTests:DevicePolicyManagerTest
Change-Id: I57c8465d190a3b4b130d57fd622cc93eaeb9c717
2020-10-06 10:34:23 +01:00
Alex Buynytskyy
c40b4f2851 Addressing API review comments.
Fixes: 169153620
Fixes: 168601298
Test: atest ChecksumsTest
Change-Id: Ibe593ccd388ad56f01ba0e3f58fb5a17c86e5e5c
2020-10-05 20:39:39 -07:00
Louis Chang
d1b79549d2 Renaming Stacks APIs to RootTasks
This CL is aimed to refine the AM/ATM API surface. The other
stack naming internally spread in AM and ATM will be covered
in later CLs.

Also Consolidate #removeStack() with #removeTask().

Bug: 157876448
Test: existing tests

Change-Id: I1254f972dab3bbe66a736a0402eebce9d0fb1496
2020-10-06 08:39:18 +08:00
Riddle Hsu
fa97d47b01 Merge "Support latency metrics for recents gesture" 2020-10-05 14:13:16 +00:00
Neil Fuller
e7741e18a5 Merge "System API annotation and API .txt changes" 2020-10-05 13:36:17 +00:00
Riddle Hsu
613ba2d25e Support latency metrics for recents gesture
Accpet the event time from RecentsAnimation#startRecentsActivity.
Also remove unused method of recents animation in activity manager.

Bug: 169221287
Test: Enable statsd log: "adb shell cmd stats print-logs"
      Touch gesture navigation bar.
      adb logcat | grep statsd | grep "(48)"
      The line may contain 0x100000->4[I] 0x110000->20[I]
      that means 4=by recents and 20=latency 20ms.

Change-Id: Ia188a6a3b0dab9edaa0052df3b18508f8cc895d3
2020-10-05 15:56:01 +08:00
Hall Liu
151dd2b445 Merge "Rename RoleManager#getDefaultSmsPackage" 2020-10-01 20:23:57 +00:00
Hongwei Wang
1735c59a61 Merge "Improve PIP enter transition w/ gesture nav (1/N)" 2020-10-01 20:18:15 +00:00
Eran Messeri
9d505d1a4e Merge "Explicitly get org-owned admin in DPMS" 2020-10-01 09:38:55 +00:00
Hongwei Wang
8ea8dbe1a2 Improve PIP enter transition w/ gesture nav (1/N)
Add PictureInPictureParams to RemoteAnimationTarget, which would allow
Launcher to determine whether the current app can auto enter PiP.

Bug: 143965596
Test: N/A
Change-Id: I5bc8dd29e9e4e7f3acfe9b841e64344211f57758
2020-09-30 15:00:51 -07:00
Eran Messeri
80204fe75d Explicitly get org-owned admin in DPMS
Refactor the DevicePolicyManagerService such that every method
that requires the ActiveAdmin associated with a profile owner on
an organization-owned device does the following:
* Checks if the caller is a profile owner on an org-owned device, or a
  device owner.
* Get the ActiveAdmin associated with the profile owner or device owner.

This is instead of calling getActiveAdmin with the org_owned profile
owner policy, which is now removed.

For the most part, this change does not affect DPMS functionality.
The few methods that were specific to org-owned devices with a
managed profile are now properly restricted and cannot be called
by a device owner.

Bug: 163028934
Test: atest FrameworksServicesTests:DevicePolicyManagerTest
Test: atest com.android.cts.devicepolicy.OrgOwnedProfileOwnerTest com.android.cts.devicepolicy.MixedDeviceOwnerTest
Change-Id: I9463499d9e343b4e52d6f9cdbe1d618e58f59a49
2020-09-30 19:06:04 +01:00
Neil Fuller
9ec32ea534 System API annotation and API .txt changes
New APIs are being exposed for use by SetUp Wizard, which requires
System APIs.

The APIs enable the calling app to determine the capabilities for /
config of the current user that affect time zone detection and then
alter them.

This commit also contains changes to the Shell package needed for the
CTS tests being added to test the new APIs. See the associated CTS
commit for details.

The primary usecase:

The rules for who can do what and when for time zone detection are
becoming more complicated, and device and user capabilities will be
affected by compile time constants, device config (resources) and device
hardware. By exposing this API, the complex logic can be encoded in one
place (the system server), rather than duplicating them in multiple
client apps.

These APIs are also intended for use by SettingsUI (and the various form
factor versions of that), but settings apps do not require them to be
marked with @SystemApi.

Bug: 159891384
Test: atest CtsTimeTestCases
Change-Id: I1eb6a68a74217106f81cb9525ad9370c805eecf2
2020-09-30 13:34:10 +01:00
Neil Fuller
02d943f44d Get ready to add System APIs for use by SUW
This commit introduces the TimeManager API class. It is intended to
provide access to the time and time zone detector services, which
historically have had their own (internal) API classes to access them.

This commit contains various fixes to the listener handling logic
noticed while testing the APIs.

The first APIs on TimeManager are being exposed for use by SetUp Wizard,
which requires System APIs.

The APIs enable the calling app to determine the capabilities for /
config of the current user that affect time zone detection and then
alter them.

The primary usecase:

The rules for who can do what and when for time zone detection are
becoming more complicated, and device and user capabilities will be
affected by compile time constants, device config (resources) and device
hardware. By exposing this API, the complex logic can be encoded in one
place (the system server), rather than duplicating them in multiple
client apps.

These APIs are also intended for use by SettingsUI (and the various form
factor versions of that), but settings apps do not currently require
them to be marked with @SystemApi.

Bug: 159891384
Test: atest services/tests/servicestests/src/com/android/server/timezonedetector/
Test: atest android.app.time
Change-Id: I9b59099748e2391c180e124edf83fa521beb1b51
2020-09-30 13:34:05 +01:00
Ashwini Oruganti
127e497477 Update docs to hint when to use FLAG_MUTABLE
Any PI that needs to be used with inline reply or bubbles needs to keep
their PI mutable. This change updates the messaging around FLAG_MUTABLE
docs and logs at the mutability flag check to add this use
case.

Bug: 160794467
Test: docs change, green builds
Change-Id: I641b35f92de5843be2fad3ef4621ffc9c6456899
2020-09-29 12:40:24 -07:00
Ashwini Oruganti
3fb439536c Merge "Define FLAG_MUTABLE and add a compat change for explicit definition of PendingIntent mutability flags" 2020-09-29 14:37:41 +00:00
TreeHugger Robot
d20030e604 Merge "Implementing Lock contention API" 2020-09-29 14:04:32 +00:00
Ashwini Oruganti
0dbae32d23 Define FLAG_MUTABLE and add a compat change for explicit definition of PendingIntent mutability flags
For future releases, we will require that either FLAG_IMMUTABLE or
FLAG_MUTABLE is defined when a PendingIntent is created.

The check only results in a log.e() for now while we notify, identify,
and update major PendingIntents. We will add a stricter
IllegalArgumentException soon.

- Define FLAG_MUTABLE
- Add a check and log.e that either FLAG_IMMUTABLE or FLAG_MUTABLE is
  specified on creation for future releases
- Update api/current.txt and non-updatable-api/current.txt to include
  FLAG_MUTABLE

Test: atest PendingIntentTest
Bug: 160794467
Change-Id: I18b21903c7cd0946dce5d7ca7860258612d9f98f
2020-09-28 18:31:02 +00:00
Beverly Tai
7014861ff7 Merge "Add getLastInteraction API to PeopleManager" 2020-09-28 18:16:30 +00:00
Hall Liu
0b7bf46c4d Rename RoleManager#getDefaultSmsPackage
Rename to getSmsRoleHolder

Fixes: 169447001
Test: atest RoleManagerTest
Change-Id: I69382d460b6178e1bc229cfe5d0a613fa7bf0895
2020-09-28 10:13:02 -07:00
Beverly
feb12590d3 Add getLastInteraction API to PeopleManager
Retrieves the last interaction for a given conversation (provided
package, userId and shortcutId).

Test: atest DataManagerTest
Bug: 169412531
Change-Id: Ie6f6d87e9ade78b99a18deb2959d0c699579c5f2
2020-09-28 10:19:46 -04:00
Hall Liu
4998ea41b8 Merge "Expose RoleManager#getDefaultSmsPackage" 2020-09-25 21:37:39 +00:00
Philip P. Moltmann
d9141a9c6d Merge "Reduce the overhead of historical appops" 2020-09-25 18:13:11 +00:00
Julia Reynolds
ce302adbc6 Merge "Bulk process shortcut removals" 2020-09-25 14:19:52 +00:00
Hall Liu
eb0af2008f Expose RoleManager#getDefaultSmsPackage
Expose this method for module libraries. It's needed to support a public
method in TelephonyProvider that doesn't require any permissions.

Test: atest RoleManagerTest#smsRoleHolderAvailableWithoutObserveRoleHolders
Fixes: 169350676
Change-Id: Ia2725dc5aa0de74b2cf67ecd0666917ae27adda9
2020-09-24 13:56:54 -07:00
Hall Liu
155cb54ec8 Merge "Rename StatusBarManager#setDisabledForSimNetworkLock" 2020-09-24 20:52:29 +00:00
vadimt
8f16a6c96f Implementing Lock contention API
This API allows the test to create
contention on AM, PM and/or WM locks.

Test: a prototype lock contention test
Bug: 168630376
Change-Id: I656b6b412d517cb3b3b16367d8712f78ccbc33d8
2020-09-24 13:18:12 -07:00
Kweku Adams
f502b885b9 Merge "Revert "Allow package verifier to hide specific fgs notifications."" 2020-09-24 17:19:09 +00:00
Eugene Susla
c50a911daa Merge "Run shell commands reliably" 2020-09-24 16:46:12 +00:00
Riddle Hsu
340ce85572 Merge "Make process level rotated config and display metrics consistent" 2020-09-24 15:42:39 +00:00
Greg Kaiser
26702432de Merge "Revert "Define FLAG_MUTABLE and add a compat change for explicit..."" 2020-09-24 03:26:06 +00:00
Greg Kaiser
c55f2961ba Revert "Define FLAG_MUTABLE and add a compat change for explicit..."
Revert "Add a check for FLAG_MUTABLE and FLAG_IMMUTABLE being se..."

Revert submission 12627798-define-flag-mutable

Reason for revert: Makes wembley device unusable by killing UI, also kills Bluetooth repeatedly

Bug: 169241864, 169239341
Test: Locally reverted and wembley now has UI and no Bluetooth crashing messages
Reverted Changes:
I2ffbc6859:Add a check for FLAG_MUTABLE and FLAG_IMMUTABLE be...
I1f1f72c6c:Define FLAG_MUTABLE and add a compat change for ex...

Change-Id: I0b1f0eadce97a1f7bbd17768f5ee491b3871b10f
2020-09-24 00:52:45 +00:00
Eugene Susla
8fa2bdb099 Run shell commands reliably
Tests sometimes fail due to a shell command failing, bet we don't get the
appropriate result from the command run itself, which leads to confusing
states and challenging troubleshooting.
E.g. jobscheduler reports its failure only via stderr.

This introduces a utility that fails with the relevant command output,
should something be printed to stderr.

Test: atest AutoRevokeTest
Bug: 168843991
Change-Id: I5e354c1b88ca3ceeeda2d5500b62c421174fd57c
2020-09-23 17:02:55 -07:00
Kweku Adams
292f997f7d Revert "Allow package verifier to hide specific fgs notifications."
This reverts commit e49aa726f0.

Reason for revert: We've decided not to have this in the QPR.

Bug: 164440539
Change-Id: I72ca946f1a5be937b3f3bed746e4251fa9257891
2020-09-23 21:40:24 +00:00
Julia Reynolds
2b38187538 Bulk process shortcut removals
This will reduce file writes for notification history

Test: atest
Bug: 169100698
Change-Id: If6488808087ad06023a994d51e00fb739ef11bd1
2020-09-23 17:01:07 -04:00
Ashwini Oruganti
73faccb867 Merge "Define FLAG_MUTABLE and add a compat change for explicit definition of PendingIntent mutability flags" 2020-09-23 01:07:11 +00:00
Hall Liu
409c9893b4 Rename StatusBarManager#setDisabledForSimNetworkLock
Rename method to setExpansionDisabledForSimNetworkLock

Fix: 169152870
Test: atest StatusBarManagerTest
Change-Id: I7a555e6c501a0a5e98127a49bfbfe2c742806160
2020-09-22 16:39:19 -07:00
Ashwini Oruganti
571ed8dc58 Define FLAG_MUTABLE and add a compat change for explicit definition of PendingIntent mutability flags
For future releases, we will require that either FLAG_IMMUTABLE or
FLAG_MUTABLE is defined when a PendingIntent is created.

The check only results in a log.wtf for now while we notify, identify,
and update major PendingIntents. We will add a stricter
IllegalArgumentException soon.

- Define FLAG_MUTABLE
- Add a check and log.wtf that either FLAG_IMMUTABLE or FLAG_MUTABLE is
  specified on creation for future releases
- Update api/current.txt and non-updatable-api/current.txt to include
  FLAG_MUTABLE

Test: atest PendingIntentTest
Bug: 160794467
Change-Id: I1f1f72c6ce22358e98e9f38be2fb98b27e60898c
2020-09-22 14:59:31 -07:00
Philip P. Moltmann
fcd259d22c Reduce the overhead of historical appops
- Use cheaper round method

Fixes: 164465976
Test: TH
Change-Id: I2c661b94ee4a87f96620bde25b2dfae297dc1f5e
2020-09-22 14:32:23 -07:00
Philip P. Moltmann
faeec12c7d Merge changes from topic "revert-12439864-PermAppOpsCrossUserCheck-Fixed-DGFFMARPXU"
* changes:
  Revert "Give all non-package services the power to interact accr..."
  Revert "Check cross-user interactions for permissions and app-op..."
  Revert "Invalidate package/permission cache if cross-profile app..."
2020-09-22 15:20:22 +00:00
Louis Chang
6de0c0a56d Merge "Remove ATM#positionTaskInStack API" 2020-09-22 00:51:53 +00:00
Philip P. Moltmann
bbeed895f5 Revert "Check cross-user interactions for permissions and app-op..."
Revert "Add dedicated host side tests for permissions and appops"

Revert submission 12439864-PermAppOpsCrossUserCheck-Fixed

Reason for revert: Bug 169044600
Reverted Changes:
I95d015e01:Invalidate package/permission cache if cross-profi...
I2a8a84f57:Check cross-user interactions for permissions and ...
Ie8f0db231:Give all non-package services the power to interac...
I11af434a8:Test package/permission cache invalidation when IN...
Ib6d609a4d:Add dedicated host side tests for permissions and ...

Change-Id: Iea5eeded0ee5caf5383bb0e749133d4fef18d392
2020-09-21 22:26:18 +00:00
Charles Chen
a73d039aee Merge "Make a context dervied from an UI context as an UI context" 2020-09-21 10:43:30 +00:00
Riddle Hsu
d5c5a1b421 Make process level rotated config and display metrics consistent
The application may get Resources instance from Resources.getSystem()
and context.getApplicationContext().getResources(). Since fixed
rotation is introduced that allows an activity to start in a different
rotation than the current display, when using getConfiguration() and
getDisplayMetrics() of these Resources instances, the orientation
and metrics need to be the same as current display is rotated.
Otherwise the app may show unexpected UI layout.

Although it is not recommended to use global resources/config for
activity. One of the goal of fixed rotation transform is to simulate
the app is started in a rotated environment, so this CL makes the
configuration and display metrics of system resources are consistent
with application and activity for compatibility.

About WindowProcessController and ActivityStackSupervisor:
 The process configuration passed to LaunchActivityItem may be
 associated from activity. if the sequence number of configuration
 is overridden by activity, the configuration may be ignored when
 launching the activity because the sequence number isn't larger
 than the previous process configuration. Although there will be a
 ConfigurationChangeItem later to update correct state, the app may
 get the intermediate state with old configuration and metrics.

About ResourcesManager and DisplayAdjustments:
 There are 2 new fields appWidth and appHeight added to
 DisplayAdjustments#FixedRotationAdjustments because the display
 metrics from Resources.getSystem() is independent from activity
 configuration. Only window manager knows the rotated size, so
 the values need to send to client and then ResourcesManager takes
 the adjustment to change the global display metrics.

About WindowToken:
 When fixed rotation is applied on the token, send the
 FixedRotationAdjustmentsItem first so the later configuration
 change can pick the adjustment at ActivityThread. And because the
 registration of activity configuration only occurs on add/remove
 activity, if it is only switching to another existing activity in
 different orientation, the process configuration still needs to
 be updated.

About ActivityThread:
 The code flow for a rotated activity (DA = display adjustments):
 - Launch new activity
    handleLaunchActivity: override app DA
     handleConfigurationChanged: adjust global display metrics by DA
     performLaunchActivity
      createBaseContextForActivity: override activity DA
 - Resume existing activity
    handleFixedRotationAdjustments: override app and activity DA
    handleConfigurationChanged: adjust global display metrics by DA
    handleResumeActivity

Also some minor corrections:
- Set missing rotated max bounds.
- Fix wrong display metrics adjustment that xdpi and ydpi should
  not be swapped because they are physical attributes.

Bug: 167564038
Test: atest DisplayAdjustmentsTests
      AppConfigurationTests#testRotatedInfoWithFixedRotationTransform
      WindowProcessControllerTests#testProcessLevelConfiguration
      DisplayContenTests#testApplyTopFixedRotationTransform

Change-Id: I60bedc7e09f54683d5e857ccc51402d5d144cd9e
2020-09-21 06:54:00 +00:00
Chilun Huang
3dda8e66d3 Merge "Revert "Revert "Introduce ActivityTransactionItem and reduce null checks""" 2020-09-21 05:09:48 +00:00
Philip P. Moltmann
fa24a327ab Merge changes from topic "PermAppOpsCrossUserCheck-Fixed"
* changes:
  Invalidate package/permission cache if cross-profile app is is changed
  Check cross-user interactions for permissions and app-ops operations
  Give all non-package services the power to interact accross users
2020-09-20 03:22:25 +00:00
Hall Liu
780b2f753e Merge "Expose StatusBarManager#setDisabledForSimNetworkLock" 2020-09-18 19:12:58 +00:00
Winson Chiu
189a385fd7 Merge "Add getTargetSdkVersion without AppInfo" 2020-09-18 18:18:28 +00:00