diff options
| author | 2024-08-30 09:46:58 -0700 | |
|---|---|---|
| committer | 2024-08-30 12:30:47 -0700 | |
| commit | 8eefa045c3653dba6d5801ff8b00f24385d1dad6 (patch) | |
| tree | 6ff1fa087001c71bf09826bf0dc6aa51237b3b77 | |
| parent | 116d632ed439e19b7eb3eac184fc52bcd28d9382 (diff) | |
Skip scheduleStopOfBgUser tests if visibleBg
Some devices support visible background full users. These users are
expected to run in the background and serve a valuable purpose. They
should not be scheduled for stopping just because they're in the
background. The UserController code already handles this, but the test
currently doesn't exempt such devices, so we update the test here.
Bug: 360920454
Test: atest FrameworksServicesTests:com.android.server.am.UserControllerTest
Flag: android.multiuser.schedule_stop_of_background_user
Change-Id: I8688caa87c880b5edbe863e99f8417b6c0bfb9e7
| -rw-r--r-- | services/tests/servicestests/src/com/android/server/am/UserControllerTest.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/services/tests/servicestests/src/com/android/server/am/UserControllerTest.java b/services/tests/servicestests/src/com/android/server/am/UserControllerTest.java index 1db46bf17655..2a55521ab329 100644 --- a/services/tests/servicestests/src/com/android/server/am/UserControllerTest.java +++ b/services/tests/servicestests/src/com/android/server/am/UserControllerTest.java @@ -55,6 +55,7 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; +import static org.junit.Assume.assumeFalse; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyBoolean; @@ -145,7 +146,6 @@ import java.util.stream.Stream; */ @SmallTest @Presubmit - public class UserControllerTest { // Use big enough user id to avoid picking up already active user id. private static final int TEST_USER_ID = 100; @@ -593,6 +593,7 @@ public class UserControllerTest { @Test public void testScheduleStopOfBackgroundUser_switch() { mSetFlagsRule.enableFlags(android.multiuser.Flags.FLAG_SCHEDULE_STOP_OF_BACKGROUND_USER); + assumeFalse(UserManager.isVisibleBackgroundUsersEnabled()); mUserController.setInitialConfig(/* userSwitchUiEnabled= */ true, /* maxRunningUsers= */ 10, /* delayUserDataLocking= */ false, @@ -642,6 +643,7 @@ public class UserControllerTest { @Test public void testScheduleStopOfBackgroundUser_startInBackground() throws Exception { mSetFlagsRule.enableFlags(android.multiuser.Flags.FLAG_SCHEDULE_STOP_OF_BACKGROUND_USER); + assumeFalse(UserManager.isVisibleBackgroundUsersEnabled()); mUserController.setInitialConfig(/* userSwitchUiEnabled= */ true, /* maxRunningUsers= */ 10, /* delayUserDataLocking= */ false, @@ -681,6 +683,7 @@ public class UserControllerTest { @Test public void testScheduleStopOfBackgroundUser_rescheduleWhenGuest() throws Exception { mSetFlagsRule.enableFlags(android.multiuser.Flags.FLAG_SCHEDULE_STOP_OF_BACKGROUND_USER); + assumeFalse(UserManager.isVisibleBackgroundUsersEnabled()); mUserController.setInitialConfig(/* userSwitchUiEnabled= */ true, /* maxRunningUsers= */ 10, /* delayUserDataLocking= */ false, @@ -736,6 +739,7 @@ public class UserControllerTest { @Test public void testScheduleStopOfBackgroundUser_rescheduleIfAlarm() throws Exception { mSetFlagsRule.enableFlags(android.multiuser.Flags.FLAG_SCHEDULE_STOP_OF_BACKGROUND_USER); + assumeFalse(UserManager.isVisibleBackgroundUsersEnabled()); mUserController.setInitialConfig(/* userSwitchUiEnabled= */ true, /* maxRunningUsers= */ 10, /* delayUserDataLocking= */ false, |