diff options
| author | 2023-12-08 13:27:06 +0000 | |
|---|---|---|
| committer | 2023-12-08 13:27:06 +0000 | |
| commit | 943986f8028fdcb2900a8d74b47efad344055a2a (patch) | |
| tree | 05f40d43083f0df56813327e1ac6064af64eeb4f | |
| parent | d31ed40ac676b949fd383a6a0c3b0b6e5157c7d7 (diff) | |
| parent | 3afbdae8203e6c173fb2b138e1b44b8803704dbb (diff) | |
Merge "Add GWPC test for user not allowed to launch." into main
| -rw-r--r-- | services/tests/servicestests/src/com/android/server/companion/virtual/GenericWindowPolicyControllerTest.java | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/services/tests/servicestests/src/com/android/server/companion/virtual/GenericWindowPolicyControllerTest.java b/services/tests/servicestests/src/com/android/server/companion/virtual/GenericWindowPolicyControllerTest.java index 33559107dfbb..18e6f0a2cc57 100644 --- a/services/tests/servicestests/src/com/android/server/companion/virtual/GenericWindowPolicyControllerTest.java +++ b/services/tests/servicestests/src/com/android/server/companion/virtual/GenericWindowPolicyControllerTest.java @@ -151,6 +151,19 @@ public class GenericWindowPolicyControllerTest { } @Test + public void userNotAllowlisted_launchIsBlocked() { + GenericWindowPolicyController gwpc = createGwpcWithNoAllowedUsers(); + gwpc.setDisplayId(DISPLAY_ID, /* isMirrorDisplay= */ false); + + ActivityInfo activityInfo = getActivityInfo( + NONBLOCKED_APP_PACKAGE_NAME, + NONBLOCKED_APP_PACKAGE_NAME, + /* displayOnRemoteDevices */ true, + /* targetDisplayCategory */ null); + assertActivityIsBlocked(gwpc, activityInfo); + } + + @Test public void openNonBlockedAppOnVirtualDisplay_isNotBlocked() { GenericWindowPolicyController gwpc = createGwpc(); gwpc.setDisplayId(DISPLAY_ID, /* isMirrorDisplay= */ false); @@ -702,6 +715,26 @@ public class GenericWindowPolicyControllerTest { /* customHomeComponent= */ null); } + private GenericWindowPolicyController createGwpcWithNoAllowedUsers() { + return new GenericWindowPolicyController( + 0, + 0, + /* allowedUsers= */ new ArraySet<>(), + /* activityLaunchAllowedByDefault= */ true, + /* activityPolicyExemptions= */ new ArraySet<>(), + /* crossTaskNavigationAllowedByDefault= */ true, + /* crossTaskNavigationExemptions= */ new ArraySet<>(), + /* permissionDialogComponent= */ null, + /* activityListener= */ mActivityListener, + /* pipBlockedCallback= */ mPipBlockedCallback, + /* activityBlockedCallback= */ mActivityBlockedCallback, + /* secureWindowCallback= */ mSecureWindowCallback, + /* intentListenerCallback= */ mIntentListenerCallback, + /* displayCategories= */ new ArraySet<>(), + /* showTasksInHostDeviceRecents= */ true, + /* customHomeComponent= */ null); + } + private GenericWindowPolicyController createGwpcWithCustomHomeComponent( ComponentName homeComponent) { return new GenericWindowPolicyController( |