451 Commits

Author SHA1 Message Date
Philip P. Moltmann
9c5226fe36 Activity start: Send featureId from context->AppOpsManager
The expected usage pattern for noteOp is to get the
Context#getOpPackageName() and Context#getFeatureId() in the calling app
and the call

noteOp(callingPackageName, Binder.getCallingUid(), callingFeatureId)

As the featureId parameter is new this parameter has to been piped all
through from the ...Manager classes running in the app all way deep into
the bowels of the system server.

There is a special featureId==null for the "default" feature. This is
used in two cases:
- In case the system server (packageName == null || packageName ==
  "android") makes a call
- In the case there is no caller. In this case I left annotations in the
  code to make clear that the default feature is used

Raw binder interfaces (defined in AIDL files) are not supposed to be
used by apps. Still historically this has happened and we ended up with
@UnsupportedAppUsage tags in these files. Also AIDL does not support
two methods with the same name but different parameters. I.e. in the
case when I had to add a paramater to a method tagged as UnsupportedAppUsage I
- created a new method ...WithFeature with the additional paramter
- set a maxTargetSDK for the old method and mention the public API to
  use in the deprecation method
This is really not pretty. Once there is no more app using the old
internal API this hack can be removed.

Additionally this change removed all internal calls to
AppOpsService.noteOperation and AppOpsService.checkOperation and
replaces them with the public API equivalent. This sometimes means to
move the resolution of the mAppOpsManager to be lazy.

Exempt-From-Owner-Approval:: Just piping through arguments
Bug: 136595429
Test: atest --test-mapping frameworks/base/services/core/java/com/android/server/am/
      atest CtsAppOpsTestCases added test to cover activity start
      atest WmTests
Change-Id: Ic7056b492cb1c9a79158e6c2b4864898a0eb5b2a
2020-02-08 22:53:43 +00:00
TreeHugger Robot
207454b9fa Merge "Adds app enumeration varations to perf tests" 2020-02-07 19:20:24 +00:00
Patrick Baumann
88c1e2acdf Adds app enumeration varations to perf tests
This change modifies the Package Manager tests to run on top of a device
with a complicated set of packages that declare visibility of one
another. New tests were added to test getInstalledPackages as well as a
new test for each existing to test with the app enumeration feature
turned on.

This change also fixes the PlatformCompatGating test to run with the
actual system and so adds the required permissions to the shell
manifest.

Bug: 141922841
Test: atest PackageManagerPerfTest PlatformCompatGatingTest
Change-Id: I386a6f82b05b4ea0b2a8885d55b6ca67a3f2dcf8
2020-02-07 08:50:09 -08:00
Felka Chang
489cf260aa To add new marker to support long edge cutout
Currently, the cutout only exists in short edge of a display. It means
that the cutout only locates in short edge of the display in portrait
mode. The method to parse the cutout only supports top boundary or bottom
boundary cutout.

To modify the parser of cutout specification supports the long edge cutout
feature. CutoutSpecification handles the parsing rulers extracted from
DisplayCutout.

In order to make parsing faster, it doesn't use regular expression to parse
specification and String.split.

Test: atest \
    FrameworksCoreTests:android.view.DisplayCutoutTest \
    FrameworksCoreTests:android.view.CutoutSpecificationTest \
    SystemUITests:com.android.systemui.ScreenDecorationsTest \
    CorePerfTests:android.view.CutoutSpecificationBenchmark

Bug: 146875639
Change-Id: Ice3ad28ef29a6f11875c4946cf4a60ee792f1270
2020-02-07 16:30:05 +08:00
Joanne Chung
f90cdd8f79 Merge "Ported TextClassificationManagerPerfTest from Settings to DeviceConfig." 2020-02-07 02:34:54 +00:00
Sudheer Shanka
25bfe747de Add a missing TODO.
Test: atest cts/tests/BlobStore/src/com/android/cts/blob/BlobStoreManagerTest.java
Change-Id: Ib7f48d845cf7984469c5f67e34f9cbca80823bf0
2020-02-06 10:29:10 -08:00
Riddle Hsu
64d8bcc891 Reduce unnecessary object creation in relayout test
Also change to use STAY_ON_WHILE_PLUGGED_IN for keeping
device awake. That eliminates the toggle of wakelock by
showing and hiding a window with FLAG_KEEP_SCREEN_ON.

Test: atest RelayoutPerfTest InternalWindowOperationPerfTest
Bug: 131727899
Change-Id: Ib4608aa1a60c7560b39011cfd2e4740680b3c884
2020-02-06 22:40:56 +08:00
Joanne Chung
ff33c168ec Ported TextClassificationManagerPerfTest from Settings to DeviceConfig.
We dropped legacy Settings after ag/9852595, we should change to use
DeviceConfig here. No performance issue observed after appling change.

Bug: 148831327
Test: frameworks/base/apct-tests/perftests/textclassifier/run.sh
and make sure the config is set to default after test.

Change-Id: I2c95d12561373f8711fc548a4a9050a0bc5a0377
2020-02-06 11:21:07 +08:00
Sudheer Shanka
d4ea5e142f Add perf test to measure duration of blob store digest computation.
+ Move BlobStoreTestUtils from cts/ to frameworks/base/tests/.

Bug: 148898557
Test: atest ./apct-tests/perftests/blobstore/src/com/android/perftests/blob/BlobStorePerfTests.java
Change-Id: I2de155d0c0c1fb602c57353ba4819bdc9cda8c0a
2020-02-05 16:30:44 -08:00
Ryan Mitchell
1e80cd76ed Merge changes from topic "res-loader"
* changes:
  Refactor ResourcesLoader Tests
  Refactor ResourcesLoader APIs
2020-01-29 06:57:47 +00:00
Ryan Mitchell
6115858c21 Refactor ResourcesLoader Tests
This change refactors the tests for ResourcesLoaders to support the
new concept of loaders owning providers.

Bug: 147359613
Test: atest ResourceLoaderTests
Change-Id: Id61dc27bf5876afe10c25ed57333541131e910b7
2020-01-28 15:35:17 -08:00
Robert Carr
2e20bcd65e WM: Defer transactions for BLAST Surfaces too.
For switching on BLAST we are implementing deferred transactions for
compatibility. Presently the BLAST Surface is constructed by the ViewRootImpl
and so the WM has no reference to pass when using it as a barrier layer for
deferTransactionUntil. To resolve this we construct and hold a reference to
the BLAST Surface on the server side, and pass it down to the client in relayoutWindow.
We don't use the WindowStateAnimator surface directly as both the BLAST Adapter and
the WindowStateAnimator would then be setting crops on it.

Bug: 146598493
Test: Builds, existing tests pass.
Change-Id: I6513e0442f5c75f01eb8dde5f1924dd7b636163c
2020-01-27 16:47:33 -08:00
Valerie Hau
3036055686 Preserve intended width/height for Blast adapter layers
Some surfaces may be a different size from the requested width/height.
Pass back calculated width/height from WindowStateAnimator back to
ViewRootImpl

Bug: 147674215, 147689472
Test: build, boot, manual
Change-Id: Ib557a4769d79e6414b9bebab8cb006adfb551e4d
2020-01-17 07:49:32 -08:00
jovanak
288a18ff21 Adding more granular startUser perf benchmarks.
Fixes: 146154399
Test: atest UserLifecycleTests
Change-Id: Ie781edc70a8a2fc0635e74350c139b5c09441dca
2019-12-19 14:34:35 -08:00
Jing Ji
8412131362 Add performance test for OomAdjuster
Bug: 140254153
Test: atest -c ActivityManagerPerfTests:OomAdjPerfTest#testOomAdj
Change-Id: Id12667c71300e6fe4dc063c83807834bbdb5e62a
2019-12-13 14:51:41 -08:00
Adam Bookatz
b9a57da94c Merge "Introduce user types" 2019-11-15 19:15:37 +00:00
Bookatz
029832a951 Introduce user types
Introduces the notion of 'user types' to UserManager.
Previously, users only had properties, set by UserInfo flags. We now
solidify some of these as formal user types. Each user must be of
precisely one user type. The configuration of each type is defined
in a UserTypeDetails object.

Prior 'types' - namely Guest, Restricted, ManagedProfiles, Demo, and
'normal' - that were set via UserInfo flags are now controlled via
UserType. Previous UserInfo flag methods for categorizing these are
still supported as long as no user of of more than one type.

If a user was (e.g.) previously both Guest and Demo, it is now
invalid and will be prevented from upgrading. This should not be a
problem in AOSP, where these 'types' were assumed mutually exclusive.

UserTypeDetails is sufficiently general to support future non-managed
profiles. To this end, the logic for specifying badges and their
colors/labels is contained by UserTypeDetails, and therefore
UserManager is responsible for delivering the corresponding badge
information.

Bug: 142151520

Test: added new test class UserManagerServiceUserTypeTest
Test: added additional tests in UserManagerServiceUserInfoTest
Test: added additional tests in UserManagerTest
Test: added additional tests in UserManagerServiceCreateProfileTest
Test: created UserTests to run the various pm.User*Test's

Test: atest \
  com.android.server.pm.UserTests \
  UserLifecycleTests \
  ManagedUserContentResolverTest \
  CtsDevicePolicyManagerTestCases \
  CtsMultiUserHostTestCases \
  com.android.server.devicepolicy.DevicePolicyManagerTest \
  com.android.server.am.UserControllerTest \
  CreateManagedProfileTaskTest

Test: atest com.android.server.pm.UserManagerServiceCreateProfileTest
   using adb shell getprop persist.sys.max_profiles # for 5 and -1

Change-Id: Id1183a76055e9a7610965cf40b256d1392afe6f8
2019-11-14 10:00:50 -08:00
Jorim Jaggi
5b80fbe00e Merge "Kill overscan insets and outsets" 2019-11-13 11:19:39 +00:00
Jorim Jaggi
f081f06a48 Kill overscan insets and outsets
Also remove WindowManagerStressTest because that has been replaced
with proper perf test.

Test: Boots
Bug: 143255833
Change-Id: I1d293cda7c82d0aa1c3a6cc694c74bf7d10cc974
2019-11-12 17:49:51 +01:00
Riddle Hsu
4a725004fc Capture method tracing for window test
It will generate method profiling trace data on the last 2
iterations that won't be counted in result metrics.

Bug: 131727899
Test: atest WindowAddRemovePerfTest

Change-Id: Ifd6f594481785deed2ebeb6e1d198f6f8728d3f4
2019-11-12 15:13:07 +08:00
Riddle Hsu
6df7f0aca5 Fix missing renaming of PerfTestActivity
1be1dd6 renamed StubActivity to PerfTestActivity.

Bug: 131727899
Test: atest PackageManagerPerfTest
      atest AutofillPerfTests:LoginTest

Change-Id: I90ad0f28ab6a3c152b16f7587c5434e6fddf18a3
2019-10-17 16:53:41 +08:00
Riddle Hsu
f5622d25a0 Add trace based window manager perf test
This may be temporary solution that parses the output of
atrace in text format on the device side. Once the perfetto
processing infrastructure is available (b/139542646) for
generic test environment, we can migrate to use that.

Bug: 131727899
Test: atest InternalWindowOperationPerfTest
Change-Id: Ic0304c292e42159fb11dee37152867290808f281
2019-10-15 22:19:51 +08:00
Riddle Hsu
1be1dd6bbf Rename StubActivity to PerfTestActivity
The activity is real.

Bug: 131727899
Test: atest CorePerfTests
Change-Id: I7fdb41aa5447329c0b1b6960f9e3d808be69648d
2019-10-15 22:10:25 +08:00
Ryan Mitchell
4043ca78ea Add Resources Perf Tests
This changes adds benchamrks for Resources, ResourcesManager,
OverlayManager, and Resources.Theme.

Bug: 136085555
Test: atest OverlayManagerPerfTest
Test: atest ResourcesManagerPerfTest
Test: atest ResourcesPerfTest
Test: atest ResourcesThemePerfTest

Change-Id: I6a3b3275399c161e55ff6ce34e7bc2ae5556edf1
2019-09-26 14:15:26 -07:00
TreeHugger Robot
be0f335f5a Merge "Whitelist packages for user types" 2019-09-25 18:45:13 +00:00
TreeHugger Robot
e8f66e22d5 Merge "Fix the script to run perf test" 2019-09-25 11:24:36 +00:00
Bookatz
04d7ae5c6f Whitelist packages for user types
Creates a new SystemConfig xml entry which allows a device to whitelist
system packages to be installed on users when they are created, based on
the type of user.

System packages will be installed on users when they are created, or
during OTAs, based on this whitelist. The whitelist can be
enabled/disabled via a Config resource.

For any user type, system packages can be whitelisted or blacklisted.
If it is both (for the same user type), the blacklist takes priority.
If it is neither, it won't be installed (since it isn't whitelisted).

If a system package isn't mentioned in the whitelist file at all, for
any user, then its behaviour depends on the Config resource value, which
can optionally implicitly whitelist all such apps on all users.

For now, the list is mostly empty and the default config is set to be
enabled but implicitly whitelist all system packages that are not
mentioned.

Test: atest FrameworksServicesTests:SystemConfigTest
Test: atest com.android.server.pm.UserManagerServicePackageWhitelistTest
Test: manually test user 0 by flashall -w and checking packages
Test: manually test OTA by setting setprop persist.pm.mock-upgrade 1
Bug: 134605778

Change-Id: Ia098c1f597f66a1c946cfcc9b7771c25e8ceabf7
2019-09-24 09:38:58 -07:00
Tony Mak
1643fca22a Fix the script to run perf test
Test: Run the script
Change-Id: I6696dafce8782173adbfebc3f5fca661223bd147
2019-09-24 15:05:38 +01:00
Winson Chung
d585219545 Add wallpaper leash for remote and recents animations
Bug: 140626334
Test: atest RecentsAnimationControllerTest
Test: atest RemoteAnimationControllerTest

Change-Id: Id638256983801e722b57da0abd22e3e480d5559d
Signed-off-by: Winson Chung <winsonc@google.com>
2019-09-20 17:20:12 +00:00
jovanak
6e6c6bfd92 Adding create user benchmark to UserLifecycleTests.
We already have createAndStartUser - but we should aim for more granular benchmarks as well, and this isolate create user timing only.

We'll keep createAndStartUser for now, since it contains all the historical data associated with it.

Bug: 140101272
Test: atest UserLifecycleTests
Change-Id: I0df72c90f7fd7bcdc8928d8510ffe36094a4d832
2019-09-04 14:40:18 -07:00
Tracy Zhou
8089ffaced Pass the captured snapshot data to Launcher when recents animation is
cancelled.

In the current implementation, when recents animation is cancelled due
to stack order change, window manager replaces the surface with a
snapshot before cancellation. Launcher needs to acquire the snapshot in
order to switch the live tile into snapshot mode, and yet because the
recents animation is cancelled, that snapshot can no longer be acquired
anymore. This change takes care of this "relay" process.

Fixes: 138683199
Test: N/A
Change-Id: I1c11af38c2bdc442e3b45d0b5f0c7e7e37c2b0f0
2019-08-11 17:00:38 +00:00
jovanak
5982cd90d0 Skipping managed profile tests for devices that don't support MANAGED_USERS.
Fixes: 13913456
Test: atest MultiUserPerfTests - on automotive, since it doesn't have managed users feature
Change-Id: I8dec1291ddeb6e1bfc6142fece08e1ab2779c89a
2019-08-08 11:27:56 -07:00
TreeHugger Robot
1639760252 Merge "Add performance test for operations of recents activity" 2019-07-30 05:24:37 +00:00
Riddle Hsu
5ef56dd6f3 Add performance test for operations of recents activity
Includes startRecentsActivity, startActivityFromRecents,
and IRecentsAnimationController.finish.

Also make the output stats of manual benchmark customizable.

Bug: 131727899
Test: atest RecentsAnimationPerfTest

Change-Id: I89a08248b4f215c990640aeb50800759d6dbcf22
2019-07-26 21:35:35 +08:00
Robert Horvath
5f47c59103 Pass callingPackage in UserLifecycleTest#startApp
Calling IActivityTaskManager#startActivity requires the callingPackage
to be set correctly as of ag/8668823, otherwise a SecurityException is
thrown.

Bug: 138095678
Test: Enable multi-user by declaring the
      "android.software.managed_users" feature and setting
      "config_multiuserMaximumUsers" to greather than 1. Then:
      `atest android.multiuser.UserLifecycleTests#managedProfileUnlockAndLaunchApp`

Change-Id: Iab7cf0198a02a976ef5c54e4b87fb127aa7eac9a
2019-07-24 16:33:37 +02:00
Riddle Hsu
54a86c6857 Add performance test of add/remove window
Also add support of multiple stats for manual benchmark.
So it can provide more details of separated steps.

Bug: 131727899
Test: atest WindowAddRemovePerfTest

Change-Id: Ia0b49c4a5e139449ee313c6ccbbe500e13327b8a
2019-07-18 22:45:20 +08:00
Riddle Hsu
b8d89f7a11 Add performance test for relayout
Bug: 131727899
Test: atest RelayoutPerfTest
Change-Id: Id9aa4929d3b80a5ba1e407b1411d54b8a313b85a
2019-06-21 16:17:52 +08:00
TreeHugger Robot
0f68f48b82 Merge "PerftestMultiuserDummyApp > MultiUserPerfDummyApp" 2019-06-03 18:57:01 +00:00
Bookatz
5f87019157 Multiuser perf test: re-launching app in profile
Times starting (unlocking) and launching a previously-launched app
in an already-created, but no-longer-running, profile. This represents
how long it would take to immediately start a profile and launch an app
within it for a re-used profile.

Bug: 129857107
Test: atest multiuser.UserLifecycleTests#managedProfileUnlockAndLaunchApp_stopped
Change-Id: I34cc9aeef07ea6481f4d168cda47b5dea69a5a74
2019-05-31 13:34:04 -07:00
Bookatz
8bdf3a63a7 PerftestMultiuserDummyApp > MultiUserPerfDummyApp
Renames PerftestMultiuserDummyApp to MultiUserPerfDummyApp.
This dummy app will be added to the platform testing, and it's useful
for the name of the dummy app to be alphabetically adjacent to the
test app (MultiUserPerfTests).

Also removes an unnecessary Android.mk file in an empty directory.

Bug: 133510429
Test: atest multiuser.UserLifecycleTests#managedProfileUnlockAndLaunchApp
Change-Id: Ifcdaa36e39b6d2a5e42decd9277d9afbf3a75d78
2019-05-30 11:36:22 -07:00
TreeHugger Robot
7d1f25b8ca Merge "Fix multiuser.UserLifecycleTests dummy app" 2019-05-22 05:32:58 +00:00
Bookatz
e525bae925 Fix multiuser.UserLifecycleTests dummy app
The dummy app (used in managedProfileUnlockAndLaunchApp and
managedProfileCreateUnlockInstallAndLaunchApp) wasn't compiling
properly, so we fix that here.

Test: atest multiuser.UserLifecycleTests#managedProfileUnlockAndLaunchApp
Test: atest multiuser.UserLifecycleTests#managedProfileCreateUnlockInstallAndLaunchApp
Change-Id: I3456824e2d31c6f2d2f9f6b892703a02c141d91c
2019-05-21 14:06:21 -07:00
Philip P. Moltmann
bfcffa0851 Whitelist all perms on installExistingPackage
The code allows to also whitelist only a select set of permissions, but
this is not yet exposed in the API.

Also: Fix up shell commands for restricted permissions

Fixes: 132368462
Test: - Enabled app via device admin in secondary profile
        -> verified that permissions were whitelisted
      - Installed existing and new app using --restrictpermissions and
        not
	-> verified that permissions were whitelisted or not
      atest AppRestrictionsHelperTest
            RestrictedPermissionsTest
Change-Id: I9787e63d8beb8f6b1ba2d15532d4c0f69dbdf863
2019-05-15 11:12:47 -07:00
Abodunrinwa Toki
182ea46d3f Merge "Lazy-load textclassifier settings." into qt-dev am: 9829cf5451
am: 772447f0bd

Change-Id: Ia1e191f134c94e0dcfd08b92e58f2f53b7a6eebe
2019-05-03 09:14:44 -07:00
Abodunrinwa Toki
0634af3875 Lazy-load textclassifier settings.
Re-enables reading settings from device_config.
See: I6b7ab56e4015448ee068deb49e7f6fa133fea53c
Updates tests.
Updates documentation.

Bug: 129934185
Test: atest android.view.textclassifier
Test: (Performance) Test: frameworks/base/apct-tests/perftests/textclassifier/run.sh
      Compare performance results with ConfigParser.ENABLE_DEVICE_CONFIG
      set to true vs false. Trivial regression recorded i.e. 1.03x.
Test: (Manual) Change flags and see them reflected. e.g.
      adb shell cmd device_config put textclassifier system_textclassifier_enabled false
      Verify that app no longer uses the OEM TCS but the AOSP TC.
Change-Id: I4c6ff781c97fc2e3d3da55dc49123fa1d759670a
2019-05-02 12:55:58 +01:00
Seigo Nonaka
56ae62ac07 Merge "Fix performance regression by fixing keys used in Typeface.Builder" into qt-dev am: 5f873a09a0
am: 995bf1e3e6

Change-Id: I2245df4205a28af10fa08eee592176bc6a73ae8e
2019-04-23 22:41:21 -07:00
Seigo Nonaka
37d181673b Fix performance regression by fixing keys used in Typeface.Builder
The key used in Typeface.Builder is different from the key used in
findFromCache method. The problem is key generation in Typeface.Builder
since the key should be created from requested parameters not the actual
font styles.

Here is the raw performance differences on walleye-userdebug

android.graphics.perftests.TypefaceCreatePerfTest(us):
  createFromResources: 248 -> 23: (-225, -90.7%)

Bug: 131167183
Test: manually collected perf test result.
Change-Id: Idea25095979707ac84b7f4bc1ede0c2daefd6127
2019-04-23 13:21:27 -07:00
Bookatz
312da055c2 Multi-user profile perf-tests
Tests that time how long it takes to
create/start/install-an-app/launch-an-app in a secondary profile.

Also, in the test, adds newly created users to the remove list, so that
even if the test crashes, the user will get removed by test cleanup.

Test: atest multiuser.UserLifecycleTests
Bug: 129857107
Change-Id: I13f7cb1628bf4a97771cb1b143ab524d7d0a2073
2019-04-16 16:31:31 -07:00
Bookatz
5df3c64c9b Reordering UserLifecycleTests in prep for more
Will add more tests. Want the profile tests together. To make review
easier, moving a test away from the profile tests.

Test: N/A
Change-Id: Idf757414dd35acb46a41701a3981cdf37a7779eb
2019-04-11 09:22:49 -07:00
Tony Mak
751afc9821 Add getTextClassifier perf test
This helps us to evaluate the fix.

BUG: 129695635

Test: frameworks/base/apct-tests/perftests/textclassifier/run.sh

Change-Id: I7d2d019faecb3721c044a43e24d86d98a08be64b
2019-04-04 17:09:58 +01:00