Loading services/core/java/com/android/server/wm/ActivityRecord.java +4 −3 Original line number Diff line number Diff line Loading @@ -7465,7 +7465,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A /** * Determines whether this ActivityRecord can turn the screen on. It checks whether the flag * {@link ActivityRecord#getTurnScreenOnFlag} is set and checks whether the ActivityRecord * should be visible depending on Keyguard state * should be visible depending on Keyguard and window state. * * @return true if the screen can be turned on, false otherwise. */ Loading @@ -7474,8 +7474,9 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A return false; } final ActivityStack stack = getRootTask(); return stack != null && stack.checkKeyguardVisibility(this, true /* shouldBeVisible */, return stack != null && !stack.inMultiWindowMode() && stack.checkKeyguardVisibility(this, true /* shouldBeVisible */, stack.topRunningActivity() == this /* isTop */); } Loading services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java +27 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ package com.android.server.wm; import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD; import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED; import static android.content.pm.ActivityInfo.CONFIG_ORIENTATION; import static android.content.pm.ActivityInfo.CONFIG_SCREEN_LAYOUT; Loading Loading @@ -65,9 +67,13 @@ import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.same; import static org.mockito.Mockito.clearInvocations; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.never; import android.app.ActivityManager.TaskSnapshot; Loading Loading @@ -405,7 +411,7 @@ public class ActivityRecordTests extends ActivityTestsBase { @Test public void ignoreRequestedOrientationInFreeformWindows() { mStack.setWindowingMode(WindowConfiguration.WINDOWING_MODE_FREEFORM); mStack.setWindowingMode(WINDOWING_MODE_FREEFORM); final Rect stableRect = new Rect(); mStack.getDisplay().mDisplayContent.getStableRect(stableRect); Loading Loading @@ -1657,6 +1663,26 @@ public class ActivityRecordTests extends ActivityTestsBase { .diff(wpc.getRequestedOverrideConfiguration())); } @Test public void testCanTurnScreenOn() { mStack.setWindowingMode(WINDOWING_MODE_FULLSCREEN); doReturn(true).when(mStack).checkKeyguardVisibility( same(mActivity), eq(true) /* shouldBeVisible */, anyBoolean()); doReturn(true).when(mActivity).getTurnScreenOnFlag(); assertTrue(mActivity.canTurnScreenOn()); } @Test public void testFreeformWindowCantTurnScreenOn() { mStack.setWindowingMode(WINDOWING_MODE_FREEFORM); doReturn(true).when(mStack).checkKeyguardVisibility( same(mActivity), eq(true) /* shouldBeVisible */, anyBoolean()); doReturn(true).when(mActivity).getTurnScreenOnFlag(); assertFalse(mActivity.canTurnScreenOn()); } /** * Creates an activity on display. For non-default display request it will also create a new * display with custom DisplayInfo. Loading Loading
services/core/java/com/android/server/wm/ActivityRecord.java +4 −3 Original line number Diff line number Diff line Loading @@ -7465,7 +7465,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A /** * Determines whether this ActivityRecord can turn the screen on. It checks whether the flag * {@link ActivityRecord#getTurnScreenOnFlag} is set and checks whether the ActivityRecord * should be visible depending on Keyguard state * should be visible depending on Keyguard and window state. * * @return true if the screen can be turned on, false otherwise. */ Loading @@ -7474,8 +7474,9 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A return false; } final ActivityStack stack = getRootTask(); return stack != null && stack.checkKeyguardVisibility(this, true /* shouldBeVisible */, return stack != null && !stack.inMultiWindowMode() && stack.checkKeyguardVisibility(this, true /* shouldBeVisible */, stack.topRunningActivity() == this /* isTop */); } Loading
services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java +27 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ package com.android.server.wm; import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD; import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED; import static android.content.pm.ActivityInfo.CONFIG_ORIENTATION; import static android.content.pm.ActivityInfo.CONFIG_SCREEN_LAYOUT; Loading Loading @@ -65,9 +67,13 @@ import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.same; import static org.mockito.Mockito.clearInvocations; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.never; import android.app.ActivityManager.TaskSnapshot; Loading Loading @@ -405,7 +411,7 @@ public class ActivityRecordTests extends ActivityTestsBase { @Test public void ignoreRequestedOrientationInFreeformWindows() { mStack.setWindowingMode(WindowConfiguration.WINDOWING_MODE_FREEFORM); mStack.setWindowingMode(WINDOWING_MODE_FREEFORM); final Rect stableRect = new Rect(); mStack.getDisplay().mDisplayContent.getStableRect(stableRect); Loading Loading @@ -1657,6 +1663,26 @@ public class ActivityRecordTests extends ActivityTestsBase { .diff(wpc.getRequestedOverrideConfiguration())); } @Test public void testCanTurnScreenOn() { mStack.setWindowingMode(WINDOWING_MODE_FULLSCREEN); doReturn(true).when(mStack).checkKeyguardVisibility( same(mActivity), eq(true) /* shouldBeVisible */, anyBoolean()); doReturn(true).when(mActivity).getTurnScreenOnFlag(); assertTrue(mActivity.canTurnScreenOn()); } @Test public void testFreeformWindowCantTurnScreenOn() { mStack.setWindowingMode(WINDOWING_MODE_FREEFORM); doReturn(true).when(mStack).checkKeyguardVisibility( same(mActivity), eq(true) /* shouldBeVisible */, anyBoolean()); doReturn(true).when(mActivity).getTurnScreenOnFlag(); assertFalse(mActivity.canTurnScreenOn()); } /** * Creates an activity on display. For non-default display request it will also create a new * display with custom DisplayInfo. Loading