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

Commit 376696fa authored by Vladimir Komsiyski's avatar Vladimir Komsiyski
Browse files

Rename DisplayContent fixed orientation method.

From isDisplayOrientationFixed to shouldRotateWithContent,
for consistency.

Bug: 292473307
Test: presubmit
Change-Id: I6aebdf1ddde2c4157faca34ac7bb1f0ca03541fc
parent cdc2faeb
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -6494,10 +6494,11 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
    }

    /**
     * @return whether the physical display has a fixed orientation and cannot be rotated.
     * @return whether the physical display orientation should change when its content rotates to
     *   match the orientation of the content.
     */
    boolean isDisplayOrientationFixed() {
        return (mDisplayInfo.flags & Display.FLAG_ROTATES_WITH_CONTENT) == 0;
    boolean shouldRotateWithContent() {
        return (mDisplayInfo.flags & Display.FLAG_ROTATES_WITH_CONTENT) != 0;
    }

    /**
+1 −1
Original line number Diff line number Diff line
@@ -435,7 +435,7 @@ public class DisplayRotation {
                PackageManager.FEATURE_LEANBACK);
        mDefaultFixedToUserRotation =
                (isCar || isTv || mService.mIsPc || mDisplayContent.forceDesktopMode()
                        || mDisplayContent.isDisplayOrientationFixed())
                        || !mDisplayContent.shouldRotateWithContent())
                // For debug purposes the next line turns this feature off with:
                // $ adb shell setprop config.override_forced_orient true
                // $ adb shell wm size reset
+4 −3
Original line number Diff line number Diff line
@@ -1194,12 +1194,12 @@ public class DisplayRotationTests {
    }

    @Test
    public void testIsFixedToUserRotation_displayContentOrientationFixed() throws Exception {
    public void testIsFixedToUserRotation_displayShouldNotRotateWithContent() throws Exception {
        mBuilder.build();
        when(mMockDisplayContent.isDisplayOrientationFixed()).thenReturn(true);
        when(mMockDisplayContent.shouldRotateWithContent()).thenReturn(false);

        assertFalse("Display rotation should respect app requested orientation if"
                + " the display has fixed orientation.", mTarget.isFixedToUserRotation());
                + " the display does not rotate with content.", mTarget.isFixedToUserRotation());
    }

    @Test
@@ -1453,6 +1453,7 @@ public class DisplayRotationTests {
                    .thenReturn(mock(TaskDisplayArea.class));
            when(mMockDisplayContent.getWindowConfiguration())
                    .thenReturn(new WindowConfiguration());
            when(mMockDisplayContent.shouldRotateWithContent()).thenReturn(true);

            Field field = DisplayContent.class
                    .getDeclaredField("mFixedRotationTransitionListener");