summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBookatz <bookatz@google.com>2019-03-29 10:40:10 -0700
committerBookatz <bookatz@google.com>2019-03-29 10:40:10 -0700
commit57908d9f2eff5b1e86d65d6bc556c90e7757c84a (patch)
treefe8f3022272ba55f3da50ce4cb6738d5bb04e263
parentb0ee8019bd7f55895fb859486d1f9dbbf31b4b0f (diff)
downloadandroid_frameworks_base-57908d9f2eff5b1e86d65d6bc556c90e7757c84a.tar.gz
android_frameworks_base-57908d9f2eff5b1e86d65d6bc556c90e7757c84a.tar.bz2
android_frameworks_base-57908d9f2eff5b1e86d65d6bc556c90e7757c84a.zip
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
-rw-r--r--apct-tests/perftests/multiuser/src/android/multiuser/UserLifecycleTests.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/apct-tests/perftests/multiuser/src/android/multiuser/UserLifecycleTests.java b/apct-tests/perftests/multiuser/src/android/multiuser/UserLifecycleTests.java
index 2fdba0af2c1..10b07ecaceb 100644
--- a/apct-tests/perftests/multiuser/src/android/multiuser/UserLifecycleTests.java
+++ b/apct-tests/perftests/multiuser/src/android/multiuser/UserLifecycleTests.java
@@ -188,6 +188,34 @@ public class UserLifecycleTests {
}
}
+ /** Tests starting an already-created, but no-longer-running, profile. */
+ @Test
+ public void managedProfileUnlock_stopped() throws Exception {
+ while (mRunner.keepRunning()) {
+ mRunner.pauseTiming();
+ final UserInfo userInfo = mUm.createProfileForUser("TestUser",
+ UserInfo.FLAG_MANAGED_PROFILE, mAm.getCurrentUser());
+ // Start the profile initially, then stop it. Similar to setQuietModeEnabled.
+ final CountDownLatch latch1 = new CountDownLatch(1);
+ registerBroadcastReceiver(Intent.ACTION_USER_UNLOCKED, latch1, userInfo.id);
+ mIam.startUserInBackground(userInfo.id);
+ latch1.await(TIMEOUT_IN_SECOND, TimeUnit.SECONDS);
+ stopUser(userInfo.id, true);
+
+ // Now we restart the profile.
+ final CountDownLatch latch2 = new CountDownLatch(1);
+ registerBroadcastReceiver(Intent.ACTION_USER_UNLOCKED, latch2, userInfo.id);
+ mRunner.resumeTiming();
+
+ mIam.startUserInBackground(userInfo.id);
+ latch2.await(TIMEOUT_IN_SECOND, TimeUnit.SECONDS);
+
+ mRunner.pauseTiming();
+ removeUser(userInfo.id);
+ mRunner.resumeTiming();
+ }
+ }
+
@Test
public void ephemeralUserStopped() throws Exception {
while (mRunner.keepRunning()) {