236 Commits

Author SHA1 Message Date
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
TreeHugger Robot
117d17b96f Merge "MultiUserPerfTest - test restart profile" 2019-04-03 22:03:51 +00:00
TreeHugger Robot
12294a48ad Merge "MultiUserPerfTest test switch to pre-existing user" 2019-04-03 21:34:44 +00:00
Misha Wagner
ab922b13cd Merge "Add diffing to KernelCpuThreadReader" 2019-04-02 13:19:49 +00:00
Tony Mak
c78069aef7 Fix AndroidTest.xml
Test: Run run.sh

Change-Id: If9f088dccacd30313380bedba4f8731ca6b47477
2019-04-01 22:59:38 +00:00
Tony Mak
e5ee70516e Move TextClassifierPerfTest to a separate package
So, other tests in other package no longer affect us.
Currently, TextClassifierPerfTest is not run continuously because of
failures in other packages.

BUG: 129695635

Test: Run run.sh

Change-Id: I2253360d98404608193b53c8b34611c2ff1b231e
2019-04-01 21:15:57 +01:00
Bookatz
52b12ac7a1 MultiUserPerfTest test switch to pre-existing user
Creates two new MultiUserPerfTests, timing how long it takes to switch
to a pre-existing user, one for when the user is already-started, and
the other for when it is stopped.

Bug: 126745587
Test: make MultiUserPerfTests && adb install -r ${ANDROID_PRODUCT_OUT}/data/app/MultiUserPerfTests/MultiUserPerfTests.apk && adb shell am instrument -e class android.multiuser.UserLifecycleTests -w com.android.perftests.multiuser/androidx.test.runner.AndroidJUnitRunner
Change-Id: I734f4971ad992e906a0090f4ef328255ab2a0349
2019-03-29 10:46:09 -07:00
Bookatz
57908d9f2e MultiUserPerfTest - test restart profile
Creates a profile, starts it, stops it, then restarts it, timing how
long the restart takes. This gives an indication of how long it takes to
start a previously-initialized profile, and mimics toggling
setQuietModeEnabled.

Right now, this process is especially slow due to
RoleManagerService.onStartUser(), so it is worthwhile tracking this.

Bug: 129415917
Test: atest  android.multiuser.UserLifecycleTests#managedProfileUnlock_stopped
Change-Id: Ic7f3bdb6fa7daaab53cb23dbf8e8a68e293d23b2
2019-03-29 10:40:10 -07:00
Misha Wagner
2487d357a1 Add diffing to KernelCpuThreadReader
We want to not use WestWorld's diffing so that we can apply thresholds
on the diffs. This is further explained in the KernelCpuThreadReaderDiff
documentation.

Test: atest KernelCpuThreadReaderDiffTest
Bug: 129387487

Change-Id: I638ae92a28236830444dc80e470114a0e23d79a4
2019-03-27 10:58:42 +00:00
Misha Wagner
3989eb02bc Clean up KernelCpuThreadReader
This includes (as well as nits by IntelliJ):
- Removing getCurrentProcessCpuUsage, as it was only used in tests
- Updating class documentation
- Adding @Presubmit annotations to tests
- Reformat using google-java-format

Test: atest KernelCpuThreadReaderTest

Change-Id: I710773043b9e9ef40545c20667fe2f79e9915e43
2019-03-20 11:19:21 +00:00
TreeHugger Robot
3d61f89275 Merge "Address API council feedback" 2019-02-25 19:21:52 +00:00
John Reck
e57475e6c9 Address API council feedback
Bug: 125027187
Bug: 125026102
Bug: 125026678
Bug: 125026234
Bug: 125027586
Bug: 125026476
Bug: 125026103
Bug: 125026237
Bug: 125027248
Bug: 125026475
Bug: 125027487
Test: RenderNodeTests
Change-Id: Ic63ea7a3cfe359a7dff0c1b46e534e499f7e928b
2019-02-22 14:24:28 -08:00
Sudheer Shanka
c7dc355feb Merge "Don't change the order of test results." 2019-02-22 18:31:07 +00:00
TreeHugger Robot
4cac1f42f0 Merge "Move TextClassifier.getLocalTextClassifier() API." 2019-02-20 16:40:21 +00:00
Sasha Smundak
500db62bfa Convert Android.mk file to Android.bp
See build/soong/README.md for more information.

Bug: 122332340
Test: treehugger
Change-Id: I23d8d5a019155a0f3296f7ab75e9b44b7621f3c8
2019-02-19 13:46:51 -08:00
Misha Wagner
dc5beb50c8 Merge "Add KernelCpuThreadReader minimium CPU usage threshold" 2019-02-13 10:31:15 +00:00