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

Commit c5268db2 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Rename DisplayContent fixed orientation method." into main

parents 577c19b9 376696fa
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -6519,10 +6519,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");