Loading services/tests/wmtests/src/com/android/server/wm/AppTransitionControllerTest.java +12 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import static android.view.WindowManager.TRANSIT_TASK_OPEN; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.doCallRealMethod; import android.platform.test.annotations.Presubmit; import android.util.ArraySet; Loading Loading @@ -56,6 +57,14 @@ public class AppTransitionControllerTest extends WindowTestsBase { mAppTransitionController = new AppTransitionController(mWm, mDisplayContent); } @Override ActivityRecord createActivityRecord(DisplayContent dc, int windowingMode, int activityType) { final ActivityRecord r = super.createActivityRecord(dc, windowingMode, activityType); // Ensure that ActivityRecord#setOccludesParent takes effect. doCallRealMethod().when(r).fillsParent(); return r; } @Test @FlakyTest(bugId = 131005232) public void testTranslucentOpen() { Loading Loading @@ -191,6 +200,9 @@ public class AppTransitionControllerTest extends WindowTestsBase { @Test public void testGetAnimationTargets_exitingBeforeTransition() { // Create another non-empty task so the animation target won't promote to task display area. WindowTestUtils.createTestActivityRecord( mDisplayContent.getDefaultTaskDisplayArea().getOrCreateRootHomeTask()); final ActivityStack stack = createTaskStackOnDisplay(mDisplayContent); final ActivityRecord activity = WindowTestUtils.createTestActivityRecord(stack); activity.setVisible(false); Loading services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java +5 −1 Original line number Diff line number Diff line Loading @@ -158,6 +158,7 @@ public class AppWindowTokenTests extends WindowTestsBase { mActivity.removeImmediately(); } @UseTestDisplay(addWindows = W_ACTIVITY) @Test @FlakyTest(bugId = 131005232) public void testLandscapeSeascapeRotationByApp() { Loading Loading @@ -188,6 +189,7 @@ public class AppWindowTokenTests extends WindowTestsBase { appWindow.removeImmediately(); } @UseTestDisplay(addWindows = W_ACTIVITY) @Test public void testLandscapeSeascapeRotationByPolicy() { // This instance has been spied in {@link TestDisplayContent}. Loading Loading @@ -295,6 +297,7 @@ public class AppWindowTokenTests extends WindowTestsBase { mWm.mDisplayFrozen = false; } @UseTestDisplay @Test public void testRespectTopFullscreenOrientation() { final Configuration displayConfig = mActivity.mDisplayContent.getConfiguration(); Loading @@ -316,6 +319,7 @@ public class AppWindowTokenTests extends WindowTestsBase { assertEquals(Configuration.ORIENTATION_LANDSCAPE, activityConfig.orientation); } @UseTestDisplay @Test public void testReportOrientationChange() { mActivity.setOrientation(SCREEN_ORIENTATION_LANDSCAPE); Loading Loading @@ -343,7 +347,7 @@ public class AppWindowTokenTests extends WindowTestsBase { @Test public void testAddRemoveRace() { // There was once a race condition between adding and removing starting windows final ActivityRecord appToken = mAppWindow.mActivityRecord; final ActivityRecord appToken = createIsolatedTestActivityRecord(); for (int i = 0; i < 1000; i++) { appToken.addStartingWindow(mPackageName, android.R.style.Theme, null, "Test", 0, 0, 0, 0, null, true, true, false, true, Loading services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java +25 −5 Original line number Diff line number Diff line Loading @@ -133,6 +133,7 @@ import java.util.List; @RunWith(WindowTestRunner.class) public class DisplayContentTests extends WindowTestsBase { @UseTestDisplay(addAllCommonWindows = true) @Test public void testForAllWindows() { final WindowState exitingAppWindow = createWindow(null, TYPE_BASE_APPLICATION, Loading @@ -159,6 +160,7 @@ public class DisplayContentTests extends WindowTestsBase { mNavBarWindow)); } @UseTestDisplay(addAllCommonWindows = true) @Test public void testForAllWindows_WithAppImeTarget() { final WindowState imeAppTarget = Loading @@ -180,6 +182,7 @@ public class DisplayContentTests extends WindowTestsBase { mNavBarWindow)); } @UseTestDisplay(addAllCommonWindows = true) @Test public void testForAllWindows_WithChildWindowImeTarget() throws Exception { mDisplayContent.mInputMethodTarget = mChildAppWindowAbove; Loading @@ -197,6 +200,7 @@ public class DisplayContentTests extends WindowTestsBase { mNavBarWindow)); } @UseTestDisplay(addAllCommonWindows = true) @Test public void testForAllWindows_WithStatusBarImeTarget() throws Exception { mDisplayContent.mInputMethodTarget = mStatusBarWindow; Loading @@ -214,6 +218,7 @@ public class DisplayContentTests extends WindowTestsBase { mNavBarWindow)); } @UseTestDisplay(addAllCommonWindows = true) @Test public void testForAllWindows_WithNotificationShadeImeTarget() throws Exception { mDisplayContent.mInputMethodTarget = mNotificationShadeWindow; Loading @@ -231,6 +236,7 @@ public class DisplayContentTests extends WindowTestsBase { mNavBarWindow)); } @UseTestDisplay(addAllCommonWindows = true) @Test public void testForAllWindows_WithInBetweenWindowToken() { // This window is set-up to be z-ordered between some windows that go in the same token like Loading @@ -252,6 +258,7 @@ public class DisplayContentTests extends WindowTestsBase { mNavBarWindow)); } @UseTestDisplay(addAllCommonWindows = true) @Test public void testComputeImeTarget() { // Verify that an app window can be an ime target. Loading @@ -271,6 +278,7 @@ public class DisplayContentTests extends WindowTestsBase { assertEquals(childWin, imeTarget); } @UseTestDisplay(addAllCommonWindows = true) @Test public void testComputeImeTarget_startingWindow() { ActivityRecord activity = createActivityRecord(mDisplayContent, Loading Loading @@ -775,6 +783,7 @@ public class DisplayContentTests extends WindowTestsBase { .setDisplayInfoOverrideFromWindowManager(dc.getDisplayId(), null); } @UseTestDisplay @Test public void testClearLastFocusWhenReparentingFocusedWindow() { final DisplayContent defaultDisplay = mWm.getDefaultDisplayContentLocked(); Loading Loading @@ -808,6 +817,7 @@ public class DisplayContentTests extends WindowTestsBase { assertFalse(isOptionsPanelAtRight(landscapeDisplay.getDisplayId())); } @UseTestDisplay(addWindows = W_INPUT_METHOD) @Test public void testInputMethodTargetUpdateWhenSwitchingOnDisplays() { final DisplayContent newDisplay = createNewDisplay(); Loading Loading @@ -921,6 +931,7 @@ public class DisplayContentTests extends WindowTestsBase { assertEquals(dc.getImeContainer().getParentSurfaceControl(), dc.computeImeParent()); } @UseTestDisplay(addWindows = W_ACTIVITY) @Test public void testComputeImeParent_app_notMatchParentBounds() { spyOn(mAppWindow.mActivityRecord); Loading Loading @@ -978,6 +989,7 @@ public class DisplayContentTests extends WindowTestsBase { assertNotEquals(dc.mInputMethodInputTarget, dc.computeImeControlTarget()); } @UseTestDisplay(addWindows = W_ACTIVITY) @Test public void testComputeImeControlTarget_notMatchParentBounds() throws Exception { spyOn(mAppWindow.mActivityRecord); Loading Loading @@ -1096,6 +1108,7 @@ public class DisplayContentTests extends WindowTestsBase { win.setHasSurface(false); } @UseTestDisplay(addWindows = { W_ABOVE_ACTIVITY, W_ACTIVITY}) @Test public void testRequestResizeForEmptyFrames() { final WindowState win = mChildAppWindowAbove; Loading Loading @@ -1135,6 +1148,7 @@ public class DisplayContentTests extends WindowTestsBase { is(Configuration.ORIENTATION_PORTRAIT)); } @UseTestDisplay(addWindows = { W_ACTIVITY, W_WALLPAPER, W_STATUS_BAR, W_NAVIGATION_BAR }) @Test public void testApplyTopFixedRotationTransform() { final DisplayPolicy displayPolicy = mDisplayContent.getDisplayPolicy(); Loading Loading @@ -1234,7 +1248,9 @@ public class DisplayContentTests extends WindowTestsBase { @Test public void testFinishFixedRotationNoAppTransitioningTask() { final ActivityRecord app = mAppWindow.mActivityRecord; unblockDisplayRotation(mDisplayContent); final ActivityRecord app = createActivityRecord(mDisplayContent, WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD); final Task task = app.getTask(); final ActivityRecord app2 = new ActivityTestsBase.ActivityBuilder(mWm.mAtmService) .setTask(task).build(); Loading @@ -1255,6 +1271,7 @@ public class DisplayContentTests extends WindowTestsBase { assertFalse(mDisplayContent.hasTopFixedRotationLaunchingApp()); } @UseTestDisplay(addWindows = W_ACTIVITY) @Test public void testRotateSeamlesslyWithFixedRotation() { final DisplayRotation displayRotation = mDisplayContent.getDisplayRotation(); Loading @@ -1275,13 +1292,14 @@ public class DisplayContentTests extends WindowTestsBase { @Test public void testNoFixedRotationWithPip() { final DisplayContent displayContent = mDefaultDisplay; unblockDisplayRotation(displayContent); // Make resume-top really update the activity state. setBooted(mWm.mAtmService); // Speed up the test by a few seconds. mWm.mAtmService.deferWindowLayout(); doNothing().when(mWm).startFreezingDisplay(anyInt(), anyInt(), any(), anyInt()); final DisplayContent displayContent = mWm.mRoot.getDefaultDisplay(); final Configuration displayConfig = displayContent.getConfiguration(); final ActivityRecord pinnedActivity = createActivityRecord(displayContent, WINDOWING_MODE_PINNED, ACTIVITY_TYPE_STANDARD); Loading Loading @@ -1324,11 +1342,13 @@ public class DisplayContentTests extends WindowTestsBase { @Test public void testRecentsNotRotatingWithFixedRotation() { unblockDisplayRotation(mDisplayContent); final DisplayRotation displayRotation = mDisplayContent.getDisplayRotation(); doCallRealMethod().when(displayRotation).updateRotationUnchecked(anyBoolean()); // Skip freezing so the unrelated conditions in updateRotationUnchecked won't disturb. doNothing().when(mWm).startFreezingDisplay(anyInt(), anyInt(), any(), anyInt()); final ActivityRecord activity = createActivityRecord(mDisplayContent, WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD); final ActivityRecord recentsActivity = createActivityRecord(mDisplayContent, WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_RECENTS); recentsActivity.setRequestedOrientation(SCREEN_ORIENTATION_PORTRAIT); Loading @@ -1345,12 +1365,12 @@ public class DisplayContentTests extends WindowTestsBase { // Rotation can be updated if the recents animation is animating but it is not on top, e.g. // switching activities in different orientations by quickstep gesture. mDisplayContent.mFixedRotationTransitionListener.onStartRecentsAnimation(recentsActivity); mDisplayContent.setFixedRotationLaunchingAppUnchecked(mAppWindow.mActivityRecord); mDisplayContent.setFixedRotationLaunchingAppUnchecked(activity); displayRotation.setRotation((displayRotation.getRotation() + 1) % 4); assertTrue(displayRotation.updateRotationUnchecked(false)); // The recents activity should not apply fixed rotation if the top activity is not opaque. mDisplayContent.mFocusedApp = mAppWindow.mActivityRecord; mDisplayContent.mFocusedApp = activity; doReturn(false).when(mDisplayContent.mFocusedApp).occludesParent(); doReturn(ROTATION_90).when(mDisplayContent).rotationForActivityInDifferentOrientation( eq(recentsActivity)); Loading services/tests/wmtests/src/com/android/server/wm/DisplayPolicyInsetsTests.java +2 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,8 @@ import org.junit.runner.RunWith; @SmallTest @Presubmit @WindowTestsBase.UseTestDisplay( addWindows = { WindowTestsBase.W_STATUS_BAR, WindowTestsBase.W_NAVIGATION_BAR }) @RunWith(WindowTestRunner.class) public class DisplayPolicyInsetsTests extends DisplayPolicyTestsBase { Loading services/tests/wmtests/src/com/android/server/wm/DisplayPolicyLayoutTests.java +3 −10 Original line number Diff line number Diff line Loading @@ -49,7 +49,6 @@ import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertThat; import static org.mockito.Mockito.doCallRealMethod; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.spy; Loading @@ -65,14 +64,12 @@ import android.util.SparseArray; import android.view.DisplayCutout; import android.view.DisplayInfo; import android.view.InsetsState; import android.view.View; import android.view.WindowInsets.Side; import android.view.WindowInsets.Type; import android.view.WindowManager; import androidx.test.filters.SmallTest; import com.android.server.policy.WindowManagerPolicy; import com.android.server.wm.utils.WmDisplayCutout; import org.junit.Before; Loading @@ -90,6 +87,8 @@ import java.io.StringWriter; */ @SmallTest @Presubmit @WindowTestsBase.UseTestDisplay( addWindows = { WindowTestsBase.W_STATUS_BAR, WindowTestsBase.W_NAVIGATION_BAR }) @RunWith(WindowTestRunner.class) public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase { Loading Loading @@ -120,9 +119,6 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase { // Disabling this call for most tests since it can override the systemUiFlags when called. doReturn(0).when(mDisplayPolicy).updateSystemUiVisibilityLw(); mDisplayPolicy.mLastSystemUiFlags |= View.STATUS_BAR_TRANSPARENT; mDisplayPolicy.mLastSystemUiFlags |= View.NAVIGATION_BAR_TRANSPARENT; updateDisplayFrames(); } Loading @@ -146,10 +142,7 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase { mFrames = createDisplayFrames(); mDisplayBounds.set(0, 0, mFrames.mDisplayWidth, mFrames.mDisplayHeight); mDisplayContent.mDisplayFrames = mFrames; doReturn(mDisplayBounds).when(mStatusBarWindow).getBounds(); doReturn(mDisplayBounds).when(mNavBarWindow).getBounds(); doReturn(mDisplayBounds).when(mWindow).getBounds(); mDisplayContent.setBounds(mDisplayBounds); } private DisplayFrames createDisplayFrames() { Loading Loading
services/tests/wmtests/src/com/android/server/wm/AppTransitionControllerTest.java +12 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import static android.view.WindowManager.TRANSIT_TASK_OPEN; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.doCallRealMethod; import android.platform.test.annotations.Presubmit; import android.util.ArraySet; Loading Loading @@ -56,6 +57,14 @@ public class AppTransitionControllerTest extends WindowTestsBase { mAppTransitionController = new AppTransitionController(mWm, mDisplayContent); } @Override ActivityRecord createActivityRecord(DisplayContent dc, int windowingMode, int activityType) { final ActivityRecord r = super.createActivityRecord(dc, windowingMode, activityType); // Ensure that ActivityRecord#setOccludesParent takes effect. doCallRealMethod().when(r).fillsParent(); return r; } @Test @FlakyTest(bugId = 131005232) public void testTranslucentOpen() { Loading Loading @@ -191,6 +200,9 @@ public class AppTransitionControllerTest extends WindowTestsBase { @Test public void testGetAnimationTargets_exitingBeforeTransition() { // Create another non-empty task so the animation target won't promote to task display area. WindowTestUtils.createTestActivityRecord( mDisplayContent.getDefaultTaskDisplayArea().getOrCreateRootHomeTask()); final ActivityStack stack = createTaskStackOnDisplay(mDisplayContent); final ActivityRecord activity = WindowTestUtils.createTestActivityRecord(stack); activity.setVisible(false); Loading
services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java +5 −1 Original line number Diff line number Diff line Loading @@ -158,6 +158,7 @@ public class AppWindowTokenTests extends WindowTestsBase { mActivity.removeImmediately(); } @UseTestDisplay(addWindows = W_ACTIVITY) @Test @FlakyTest(bugId = 131005232) public void testLandscapeSeascapeRotationByApp() { Loading Loading @@ -188,6 +189,7 @@ public class AppWindowTokenTests extends WindowTestsBase { appWindow.removeImmediately(); } @UseTestDisplay(addWindows = W_ACTIVITY) @Test public void testLandscapeSeascapeRotationByPolicy() { // This instance has been spied in {@link TestDisplayContent}. Loading Loading @@ -295,6 +297,7 @@ public class AppWindowTokenTests extends WindowTestsBase { mWm.mDisplayFrozen = false; } @UseTestDisplay @Test public void testRespectTopFullscreenOrientation() { final Configuration displayConfig = mActivity.mDisplayContent.getConfiguration(); Loading @@ -316,6 +319,7 @@ public class AppWindowTokenTests extends WindowTestsBase { assertEquals(Configuration.ORIENTATION_LANDSCAPE, activityConfig.orientation); } @UseTestDisplay @Test public void testReportOrientationChange() { mActivity.setOrientation(SCREEN_ORIENTATION_LANDSCAPE); Loading Loading @@ -343,7 +347,7 @@ public class AppWindowTokenTests extends WindowTestsBase { @Test public void testAddRemoveRace() { // There was once a race condition between adding and removing starting windows final ActivityRecord appToken = mAppWindow.mActivityRecord; final ActivityRecord appToken = createIsolatedTestActivityRecord(); for (int i = 0; i < 1000; i++) { appToken.addStartingWindow(mPackageName, android.R.style.Theme, null, "Test", 0, 0, 0, 0, null, true, true, false, true, Loading
services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java +25 −5 Original line number Diff line number Diff line Loading @@ -133,6 +133,7 @@ import java.util.List; @RunWith(WindowTestRunner.class) public class DisplayContentTests extends WindowTestsBase { @UseTestDisplay(addAllCommonWindows = true) @Test public void testForAllWindows() { final WindowState exitingAppWindow = createWindow(null, TYPE_BASE_APPLICATION, Loading @@ -159,6 +160,7 @@ public class DisplayContentTests extends WindowTestsBase { mNavBarWindow)); } @UseTestDisplay(addAllCommonWindows = true) @Test public void testForAllWindows_WithAppImeTarget() { final WindowState imeAppTarget = Loading @@ -180,6 +182,7 @@ public class DisplayContentTests extends WindowTestsBase { mNavBarWindow)); } @UseTestDisplay(addAllCommonWindows = true) @Test public void testForAllWindows_WithChildWindowImeTarget() throws Exception { mDisplayContent.mInputMethodTarget = mChildAppWindowAbove; Loading @@ -197,6 +200,7 @@ public class DisplayContentTests extends WindowTestsBase { mNavBarWindow)); } @UseTestDisplay(addAllCommonWindows = true) @Test public void testForAllWindows_WithStatusBarImeTarget() throws Exception { mDisplayContent.mInputMethodTarget = mStatusBarWindow; Loading @@ -214,6 +218,7 @@ public class DisplayContentTests extends WindowTestsBase { mNavBarWindow)); } @UseTestDisplay(addAllCommonWindows = true) @Test public void testForAllWindows_WithNotificationShadeImeTarget() throws Exception { mDisplayContent.mInputMethodTarget = mNotificationShadeWindow; Loading @@ -231,6 +236,7 @@ public class DisplayContentTests extends WindowTestsBase { mNavBarWindow)); } @UseTestDisplay(addAllCommonWindows = true) @Test public void testForAllWindows_WithInBetweenWindowToken() { // This window is set-up to be z-ordered between some windows that go in the same token like Loading @@ -252,6 +258,7 @@ public class DisplayContentTests extends WindowTestsBase { mNavBarWindow)); } @UseTestDisplay(addAllCommonWindows = true) @Test public void testComputeImeTarget() { // Verify that an app window can be an ime target. Loading @@ -271,6 +278,7 @@ public class DisplayContentTests extends WindowTestsBase { assertEquals(childWin, imeTarget); } @UseTestDisplay(addAllCommonWindows = true) @Test public void testComputeImeTarget_startingWindow() { ActivityRecord activity = createActivityRecord(mDisplayContent, Loading Loading @@ -775,6 +783,7 @@ public class DisplayContentTests extends WindowTestsBase { .setDisplayInfoOverrideFromWindowManager(dc.getDisplayId(), null); } @UseTestDisplay @Test public void testClearLastFocusWhenReparentingFocusedWindow() { final DisplayContent defaultDisplay = mWm.getDefaultDisplayContentLocked(); Loading Loading @@ -808,6 +817,7 @@ public class DisplayContentTests extends WindowTestsBase { assertFalse(isOptionsPanelAtRight(landscapeDisplay.getDisplayId())); } @UseTestDisplay(addWindows = W_INPUT_METHOD) @Test public void testInputMethodTargetUpdateWhenSwitchingOnDisplays() { final DisplayContent newDisplay = createNewDisplay(); Loading Loading @@ -921,6 +931,7 @@ public class DisplayContentTests extends WindowTestsBase { assertEquals(dc.getImeContainer().getParentSurfaceControl(), dc.computeImeParent()); } @UseTestDisplay(addWindows = W_ACTIVITY) @Test public void testComputeImeParent_app_notMatchParentBounds() { spyOn(mAppWindow.mActivityRecord); Loading Loading @@ -978,6 +989,7 @@ public class DisplayContentTests extends WindowTestsBase { assertNotEquals(dc.mInputMethodInputTarget, dc.computeImeControlTarget()); } @UseTestDisplay(addWindows = W_ACTIVITY) @Test public void testComputeImeControlTarget_notMatchParentBounds() throws Exception { spyOn(mAppWindow.mActivityRecord); Loading Loading @@ -1096,6 +1108,7 @@ public class DisplayContentTests extends WindowTestsBase { win.setHasSurface(false); } @UseTestDisplay(addWindows = { W_ABOVE_ACTIVITY, W_ACTIVITY}) @Test public void testRequestResizeForEmptyFrames() { final WindowState win = mChildAppWindowAbove; Loading Loading @@ -1135,6 +1148,7 @@ public class DisplayContentTests extends WindowTestsBase { is(Configuration.ORIENTATION_PORTRAIT)); } @UseTestDisplay(addWindows = { W_ACTIVITY, W_WALLPAPER, W_STATUS_BAR, W_NAVIGATION_BAR }) @Test public void testApplyTopFixedRotationTransform() { final DisplayPolicy displayPolicy = mDisplayContent.getDisplayPolicy(); Loading Loading @@ -1234,7 +1248,9 @@ public class DisplayContentTests extends WindowTestsBase { @Test public void testFinishFixedRotationNoAppTransitioningTask() { final ActivityRecord app = mAppWindow.mActivityRecord; unblockDisplayRotation(mDisplayContent); final ActivityRecord app = createActivityRecord(mDisplayContent, WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD); final Task task = app.getTask(); final ActivityRecord app2 = new ActivityTestsBase.ActivityBuilder(mWm.mAtmService) .setTask(task).build(); Loading @@ -1255,6 +1271,7 @@ public class DisplayContentTests extends WindowTestsBase { assertFalse(mDisplayContent.hasTopFixedRotationLaunchingApp()); } @UseTestDisplay(addWindows = W_ACTIVITY) @Test public void testRotateSeamlesslyWithFixedRotation() { final DisplayRotation displayRotation = mDisplayContent.getDisplayRotation(); Loading @@ -1275,13 +1292,14 @@ public class DisplayContentTests extends WindowTestsBase { @Test public void testNoFixedRotationWithPip() { final DisplayContent displayContent = mDefaultDisplay; unblockDisplayRotation(displayContent); // Make resume-top really update the activity state. setBooted(mWm.mAtmService); // Speed up the test by a few seconds. mWm.mAtmService.deferWindowLayout(); doNothing().when(mWm).startFreezingDisplay(anyInt(), anyInt(), any(), anyInt()); final DisplayContent displayContent = mWm.mRoot.getDefaultDisplay(); final Configuration displayConfig = displayContent.getConfiguration(); final ActivityRecord pinnedActivity = createActivityRecord(displayContent, WINDOWING_MODE_PINNED, ACTIVITY_TYPE_STANDARD); Loading Loading @@ -1324,11 +1342,13 @@ public class DisplayContentTests extends WindowTestsBase { @Test public void testRecentsNotRotatingWithFixedRotation() { unblockDisplayRotation(mDisplayContent); final DisplayRotation displayRotation = mDisplayContent.getDisplayRotation(); doCallRealMethod().when(displayRotation).updateRotationUnchecked(anyBoolean()); // Skip freezing so the unrelated conditions in updateRotationUnchecked won't disturb. doNothing().when(mWm).startFreezingDisplay(anyInt(), anyInt(), any(), anyInt()); final ActivityRecord activity = createActivityRecord(mDisplayContent, WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD); final ActivityRecord recentsActivity = createActivityRecord(mDisplayContent, WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_RECENTS); recentsActivity.setRequestedOrientation(SCREEN_ORIENTATION_PORTRAIT); Loading @@ -1345,12 +1365,12 @@ public class DisplayContentTests extends WindowTestsBase { // Rotation can be updated if the recents animation is animating but it is not on top, e.g. // switching activities in different orientations by quickstep gesture. mDisplayContent.mFixedRotationTransitionListener.onStartRecentsAnimation(recentsActivity); mDisplayContent.setFixedRotationLaunchingAppUnchecked(mAppWindow.mActivityRecord); mDisplayContent.setFixedRotationLaunchingAppUnchecked(activity); displayRotation.setRotation((displayRotation.getRotation() + 1) % 4); assertTrue(displayRotation.updateRotationUnchecked(false)); // The recents activity should not apply fixed rotation if the top activity is not opaque. mDisplayContent.mFocusedApp = mAppWindow.mActivityRecord; mDisplayContent.mFocusedApp = activity; doReturn(false).when(mDisplayContent.mFocusedApp).occludesParent(); doReturn(ROTATION_90).when(mDisplayContent).rotationForActivityInDifferentOrientation( eq(recentsActivity)); Loading
services/tests/wmtests/src/com/android/server/wm/DisplayPolicyInsetsTests.java +2 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,8 @@ import org.junit.runner.RunWith; @SmallTest @Presubmit @WindowTestsBase.UseTestDisplay( addWindows = { WindowTestsBase.W_STATUS_BAR, WindowTestsBase.W_NAVIGATION_BAR }) @RunWith(WindowTestRunner.class) public class DisplayPolicyInsetsTests extends DisplayPolicyTestsBase { Loading
services/tests/wmtests/src/com/android/server/wm/DisplayPolicyLayoutTests.java +3 −10 Original line number Diff line number Diff line Loading @@ -49,7 +49,6 @@ import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertThat; import static org.mockito.Mockito.doCallRealMethod; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.spy; Loading @@ -65,14 +64,12 @@ import android.util.SparseArray; import android.view.DisplayCutout; import android.view.DisplayInfo; import android.view.InsetsState; import android.view.View; import android.view.WindowInsets.Side; import android.view.WindowInsets.Type; import android.view.WindowManager; import androidx.test.filters.SmallTest; import com.android.server.policy.WindowManagerPolicy; import com.android.server.wm.utils.WmDisplayCutout; import org.junit.Before; Loading @@ -90,6 +87,8 @@ import java.io.StringWriter; */ @SmallTest @Presubmit @WindowTestsBase.UseTestDisplay( addWindows = { WindowTestsBase.W_STATUS_BAR, WindowTestsBase.W_NAVIGATION_BAR }) @RunWith(WindowTestRunner.class) public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase { Loading Loading @@ -120,9 +119,6 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase { // Disabling this call for most tests since it can override the systemUiFlags when called. doReturn(0).when(mDisplayPolicy).updateSystemUiVisibilityLw(); mDisplayPolicy.mLastSystemUiFlags |= View.STATUS_BAR_TRANSPARENT; mDisplayPolicy.mLastSystemUiFlags |= View.NAVIGATION_BAR_TRANSPARENT; updateDisplayFrames(); } Loading @@ -146,10 +142,7 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase { mFrames = createDisplayFrames(); mDisplayBounds.set(0, 0, mFrames.mDisplayWidth, mFrames.mDisplayHeight); mDisplayContent.mDisplayFrames = mFrames; doReturn(mDisplayBounds).when(mStatusBarWindow).getBounds(); doReturn(mDisplayBounds).when(mNavBarWindow).getBounds(); doReturn(mDisplayBounds).when(mWindow).getBounds(); mDisplayContent.setBounds(mDisplayBounds); } private DisplayFrames createDisplayFrames() { Loading