diff options
Diffstat (limited to 'services/tests/wmtests/src/com/android')
-rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/LockTaskControllerTest.java | 3 | ||||
-rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/RootActivityContainerTests.java | 20 |
2 files changed, 21 insertions, 2 deletions
diff --git a/services/tests/wmtests/src/com/android/server/wm/LockTaskControllerTest.java b/services/tests/wmtests/src/com/android/server/wm/LockTaskControllerTest.java index 47c76fc28d15..9cc24a542efc 100644 --- a/services/tests/wmtests/src/com/android/server/wm/LockTaskControllerTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/LockTaskControllerTest.java @@ -446,8 +446,7 @@ public class LockTaskControllerTest { Settings.Secure.clearProviderForTest(); // AND a password is set - when(mLockPatternUtils.isSecure(anyInt())) - .thenReturn(true); + when(mLockPatternUtils.isSecure(TEST_USER_ID)).thenReturn(true); // AND there is a task record TaskRecord tr1 = getTaskRecord(TaskRecord.LOCK_TASK_AUTH_WHITELISTED); diff --git a/services/tests/wmtests/src/com/android/server/wm/RootActivityContainerTests.java b/services/tests/wmtests/src/com/android/server/wm/RootActivityContainerTests.java index baf1b0821982..99058865fede 100644 --- a/services/tests/wmtests/src/com/android/server/wm/RootActivityContainerTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/RootActivityContainerTests.java @@ -60,6 +60,7 @@ import android.content.pm.ApplicationInfo; import android.content.pm.ResolveInfo; import android.content.res.Resources; import android.graphics.Rect; +import android.os.UserHandle; import android.platform.test.annotations.Presubmit; import android.util.Pair; import android.view.DisplayInfo; @@ -818,6 +819,25 @@ public class RootActivityContainerTests extends ActivityTestsBase { assertEquals(infoFake1.activityInfo.name, resolvedInfo.first.name); } + @Test + public void testLockAllProfileTasks() { + // Make an activity visible with the user id set to 1 + final TaskRecord task = new TaskBuilder(mSupervisor).setStack(mFullscreenStack).build(); + final ActivityRecord activity = new ActivityBuilder(mService).setTask(task) + .setUid(UserHandle.PER_USER_RANGE + 1).build(); + + // Create another activity on top and the user id is 2 + final ActivityRecord topActivity = new ActivityBuilder(mService) + .setTask(task).setUid(UserHandle.PER_USER_RANGE + 2).build(); + + // Make sure the listeners will be notified for putting the task to locked state + TaskChangeNotificationController controller = + mService.getTaskChangeNotificationController(); + spyOn(controller); + mService.mRootActivityContainer.lockAllProfileTasks(1); + verify(controller).notifyTaskProfileLocked(eq(task.taskId), eq(1)); + } + /** * Test that {@link RootActivityContainer#getLaunchStack} with the real caller id will get the * expected stack when requesting the activity launch on the secondary display. |