Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6b9b130c authored by Bryce Lee's avatar Bryce Lee Committed by Android (Google) Code Review
Browse files

Merge "Fix AppWindowTokenTests#testLandscapeSeascapeRotationByPolicy"

parents 43c43f2d 310de9e5
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -126,8 +126,6 @@ public class AppWindowTokenTests extends WindowTestsBase {
    }

    @Test
    @Ignore
    // TODO(b/35034729): Need to fix before re-enabling
    public void testLandscapeSeascapeRotationByPolicy() throws Exception {
        // Some plumbing to get the service ready for rotation updates.
        sWm.mDisplayReady = true;
@@ -145,15 +143,20 @@ public class AppWindowTokenTests extends WindowTestsBase {
        appWindowToken.addWindow(appWindow);

        // Set initial orientation and update.
        ((TestWindowManagerPolicy) sWm.mPolicy).rotationToReport = Surface.ROTATION_90;
        sWm.updateRotation(false, false);
        performRotation(Surface.ROTATION_90);
        appWindow.resizeReported = false;

        // Update the rotation to perform 180 degree rotation and check that resize was reported.
        ((TestWindowManagerPolicy) sWm.mPolicy).rotationToReport = Surface.ROTATION_270;
        sWm.updateRotation(false, false);
        sWm.mRoot.performSurfacePlacement(false /* recoveringMemory */);
        performRotation(Surface.ROTATION_270);
        assertTrue(appWindow.resizeReported);
        appWindow.removeImmediately();
    }

    private void performRotation(int rotationToReport) {
        ((TestWindowManagerPolicy) sWm.mPolicy).rotationToReport = rotationToReport;
        sWm.updateRotation(false, false);
        // Simulate animator finishing orientation change
        sWm.mRoot.mOrientationChangeComplete = true;
        sWm.mRoot.performSurfacePlacement(false /* recoveringMemory */);
    }
}
+4 −1
Original line number Diff line number Diff line
@@ -71,7 +71,10 @@ class WindowTestsBase {
    static TestWindowManagerPolicy sPolicy = null;
    private final static IWindow sIWindow = new TestIWindow();
    private final static Session sMockSession = mock(Session.class);
    private static int sNextDisplayId = Display.DEFAULT_DISPLAY + 1;
    // The default display is removed in {@link #setUp} and then we iterate over all displays to
    // make sure we don't collide with any existing display. If we run into no other display, the
    // added display should be treated as default.
    private static int sNextDisplayId = Display.DEFAULT_DISPLAY;
    static int sNextStackId = FIRST_DYNAMIC_STACK_ID;
    private static int sNextTaskId = 0;