Loading services/tests/servicestests/src/com/android/server/companion/virtual/GenericWindowPolicyControllerTest.java +33 −0 Original line number Diff line number Diff line Loading @@ -150,6 +150,19 @@ public class GenericWindowPolicyControllerTest { verify(mPipBlockedCallback, after(TIMEOUT_MILLIS).never()).onEnteringPipBlocked(TEST_UID); } @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(); Loading Loading @@ -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( Loading Loading
services/tests/servicestests/src/com/android/server/companion/virtual/GenericWindowPolicyControllerTest.java +33 −0 Original line number Diff line number Diff line Loading @@ -150,6 +150,19 @@ public class GenericWindowPolicyControllerTest { verify(mPipBlockedCallback, after(TIMEOUT_MILLIS).never()).onEnteringPipBlocked(TEST_UID); } @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(); Loading Loading @@ -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( Loading