diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2021-12-26 15:04:55 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2021-12-26 15:04:55 +0000 |
commit | 63cda5108f8143901d328790b09d95a8d67a5cb9 (patch) | |
tree | dab78e8008a8114937e8ee3aa49f29e245676a1a | |
parent | b3e480feaa38964dd0f589ab661dffa4b8bd59d5 (diff) | |
parent | 68fd0c45963a6ce565b972c7290869225c34425f (diff) | |
download | cts-android12-qpr1-d-release.tar.gz |
Merge cherrypicks of [16212023] into sc-qpr1-d-release.android-12.0.0_r32android-12.0.0_r29android-12.0.0_r27android12-qpr1-d-release
Change-Id: I01996ee6b20dccedceea46de7e70598b34506598
3 files changed, 21 insertions, 65 deletions
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/ActivityVisibilityTests.java b/tests/framework/base/windowmanager/src/android/server/wm/ActivityVisibilityTests.java index ec4903bcd84..aaeedc29721 100644 --- a/tests/framework/base/windowmanager/src/android/server/wm/ActivityVisibilityTests.java +++ b/tests/framework/base/windowmanager/src/android/server/wm/ActivityVisibilityTests.java @@ -205,18 +205,14 @@ public class ActivityVisibilityTests extends ActivityManagerTestBase { } final ActivitySessionClient activityClient = createManagedActivityClientSession(); testTurnScreenOnActivity(lockScreenSession, activityClient, - true /* useWindowFlags */, true /* showWhenLocked */); + true /* useWindowFlags */); testTurnScreenOnActivity(lockScreenSession, activityClient, - false /* useWindowFlags */, true /* showWhenLocked */); + false /* useWindowFlags */); if (notSupportsInsecureLock) { // In the platform without InsecureLock, we just test if the display is on with // TurnScreenOnActivity. mObjectTracker.close(lockScreenSession); } - testTurnScreenOnActivity(lockScreenSession, activityClient, - true /* useWindowFlags */, false /* showWhenLocked */); - testTurnScreenOnActivity(lockScreenSession, activityClient, - false /* useWindowFlags */, false /* showWhenLocked */); } @Test @@ -230,21 +226,20 @@ public class ActivityVisibilityTests extends ActivityManagerTestBase { // timeout should still notify the client activity to be visible. Then the relayout can // send the visible request to apply the flags and turn on screen. testTurnScreenOnActivity(lockScreenSession, activityClient, true /* useWindowFlags */, - true /* showWhenLocked */, 1000 /* sleepMsInOnCreate */); + 1000 /* sleepMsInOnCreate */); } private void testTurnScreenOnActivity(LockScreenSession lockScreenSession, - ActivitySessionClient activitySessionClient, boolean useWindowFlags, - boolean showWhenLocked) { + ActivitySessionClient activitySessionClient, boolean useWindowFlags) { testTurnScreenOnActivity(lockScreenSession, activitySessionClient, useWindowFlags, - showWhenLocked, 0 /* sleepMsInOnCreate */); + 0 /* sleepMsInOnCreate */); } private void testTurnScreenOnActivity(LockScreenSession lockScreenSession, ActivitySessionClient activitySessionClient, boolean useWindowFlags, - boolean showWhenLocked, int sleepMsInOnCreate) { + int sleepMsInOnCreate) { ActivitySession activity = sleepDeviceAndLaunchTurnScreenOnActivity(lockScreenSession, - activitySessionClient, useWindowFlags, showWhenLocked, sleepMsInOnCreate, + activitySessionClient, useWindowFlags, sleepMsInOnCreate, WINDOWING_MODE_FULLSCREEN); mWmState.assertVisibility(TURN_SCREEN_ON_ACTIVITY, true); @@ -263,21 +258,16 @@ public class ActivityVisibilityTests extends ActivityManagerTestBase { final ActivitySessionClient activityClient = createManagedActivityClientSession(); testFreeformWindowTurnScreenOnActivity(lockScreenSession, activityClient, - true/* useWindowFlags */, true/* showWhenLocked */); - testFreeformWindowTurnScreenOnActivity(lockScreenSession, activityClient, - true/* useWindowFlags */, false/* showWhenLocked */); - testFreeformWindowTurnScreenOnActivity(lockScreenSession, activityClient, - false/* useWindowFlags */, true/* showWhenLocked */); + true/* useWindowFlags */); testFreeformWindowTurnScreenOnActivity(lockScreenSession, activityClient, - false/* useWindowFlags */, false/* showWhenLocked */); + false/* useWindowFlags */); } private void testFreeformWindowTurnScreenOnActivity(LockScreenSession lockScreenSession, - ActivitySessionClient activityClient, boolean useWindowFlags, - boolean showWhenLocked) { + ActivitySessionClient activityClient, boolean useWindowFlags) { ActivitySession activity = sleepDeviceAndLaunchTurnScreenOnActivity(lockScreenSession, - activityClient, useWindowFlags, showWhenLocked, - 0 /* sleepMsInOnCreate */, WINDOWING_MODE_FREEFORM); + activityClient, useWindowFlags, 0 /* sleepMsInOnCreate */, + WINDOWING_MODE_FREEFORM); mWmState.waitForValidState( new WaitForValidActivityState.Builder(TURN_SCREEN_ON_ACTIVITY) .setWindowingMode(WINDOWING_MODE_FULLSCREEN) @@ -291,16 +281,13 @@ public class ActivityVisibilityTests extends ActivityManagerTestBase { private ActivitySession sleepDeviceAndLaunchTurnScreenOnActivity( LockScreenSession lockScreenSession, ActivitySessionClient activitySessionClient, - boolean useWindowFlags, boolean showWhenLocked, int sleepMsInOnCreate, - int windowingMode) { + boolean useWindowFlags, int sleepMsInOnCreate, int windowingMode) { lockScreenSession.sleepDevice(); return activitySessionClient.startActivity( getLaunchActivityBuilder().setUseInstrumentation().setIntentExtra(extra -> { extra.putBoolean(Components.TurnScreenOnActivity.EXTRA_USE_WINDOW_FLAGS, useWindowFlags); - extra.putBoolean(Components.TurnScreenOnActivity.EXTRA_SHOW_WHEN_LOCKED, - showWhenLocked); extra.putLong(Components.TurnScreenOnActivity.EXTRA_SLEEP_MS_IN_ON_CREATE, sleepMsInOnCreate); }).setTargetActivity(TURN_SCREEN_ON_ACTIVITY).setWindowingMode(windowingMode)); diff --git a/tests/framework/base/windowmanager/src/android/server/wm/KeyguardLockedTests.java b/tests/framework/base/windowmanager/src/android/server/wm/KeyguardLockedTests.java index 92368fb4e3b..62a5ac7d3ba 100644 --- a/tests/framework/base/windowmanager/src/android/server/wm/KeyguardLockedTests.java +++ b/tests/framework/base/windowmanager/src/android/server/wm/KeyguardLockedTests.java @@ -216,40 +216,6 @@ public class KeyguardLockedTests extends KeyguardTestBase { } @Test - public void testTurnScreenOnActivity_withSecureKeyguardAndAod() { - final AodSession aodSession = createManagedAodSession(); - final LockScreenSession lockScreenSession = createManagedLockScreenSession(); - lockScreenSession.setLockCredential(); - testTurnScreenOnActivity_withSecureKeyguard(aodSession, lockScreenSession, - false /* enableAod */); - testTurnScreenOnActivity_withSecureKeyguard(aodSession, lockScreenSession, - true /* enableAod */); - } - - private void testTurnScreenOnActivity_withSecureKeyguard(AodSession aodSession, - LockScreenSession lockScreenSession, boolean enableAod) { - if (enableAod) { - assumeTrue(aodSession.isAodAvailable()); - } - aodSession.setAodEnabled(enableAod); - lockScreenSession.sleepDevice(); - mWmState.computeState(); - assertTrue(mWmState.getKeyguardControllerState().keyguardShowing); - - final CommandSession.ActivitySessionClient activityClient = - createManagedActivityClientSession(); - final CommandSession.ActivitySession activity = activityClient.startActivity( - getLaunchActivityBuilder().setUseInstrumentation().setIntentExtra(extra -> { - extra.putBoolean(Components.TurnScreenOnActivity.EXTRA_SHOW_WHEN_LOCKED, false); - }).setTargetActivity(TURN_SCREEN_ON_ACTIVITY)); - mWmState.waitForKeyguardShowingAndNotOccluded(); - mWmState.assertVisibility(TURN_SCREEN_ON_ACTIVITY, false); - assertTrue(mWmState.getKeyguardControllerState().keyguardShowing); - assertFalse(isDisplayOn(DEFAULT_DISPLAY)); - activity.finish(); - } - - @Test public void testDismissKeyguardAttrActivity_method_turnScreenOn_withSecureKeyguard() { final LockScreenSession lockScreenSession = createManagedLockScreenSession(); lockScreenSession.setLockCredential().sleepDevice(); diff --git a/tests/framework/base/windowmanager/src/android/server/wm/KeyguardTests.java b/tests/framework/base/windowmanager/src/android/server/wm/KeyguardTests.java index 42139843c7e..dc7c30870c2 100755 --- a/tests/framework/base/windowmanager/src/android/server/wm/KeyguardTests.java +++ b/tests/framework/base/windowmanager/src/android/server/wm/KeyguardTests.java @@ -443,7 +443,7 @@ public class KeyguardTests extends KeyguardTestBase { } @Test - public void testTurnScreenOnOnActivityOnAod() { + public void testTurnScreenOnActivityOnAod() { final AodSession aodSession = createManagedAodSession(); assumeTrue(aodSession.isAodAvailable()); aodSession.setAodEnabled(true); @@ -460,10 +460,13 @@ public class KeyguardTests extends KeyguardTestBase { false); }).setTargetActivity(TURN_SCREEN_ON_ACTIVITY)); - mWmState.computeState(TURN_SCREEN_ON_ACTIVITY); - mWmState.assertVisibility(TURN_SCREEN_ON_ACTIVITY, true); - assertFalse(mWmState.getKeyguardControllerState().keyguardShowing); - assertTrue(isDisplayOn(DEFAULT_DISPLAY)); + mWmState.waitForAllStoppedActivities(); + // An activity without set showWhenLocked or dismissKeyguard cannot wakeup device and/or + // unlock insecure keyguard even if it has setTurnScreenOn, so the device should stay + // invisible and the display stay in dozing. + mWmState.assertVisibility(TURN_SCREEN_ON_ACTIVITY, false); + assertTrue(mWmState.getKeyguardControllerState().keyguardShowing); + assertFalse(isDisplayOn(DEFAULT_DISPLAY)); } /** * Tests whether a FLAG_DISMISS_KEYGUARD activity occludes Keyguard. |