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

Commit 4e1562a9 authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Report non-fixed orientation for resizable locked orientation" into main

parents 6d3ea7d0 6136d4e1
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -7233,6 +7233,12 @@ final class ActivityRecord extends WindowToken {
                return belowCandidate.getRequestedConfigurationOrientation(forDisplay);
            }
        }
        // Although isRestrictedFixedOrientation excludes "locked" orientation, the configuration
        // orientation should not be restricted to portrait or landscape.
        if (requestedOrientation == ActivityInfo.SCREEN_ORIENTATION_LOCKED
                && isUniversalResizeable()) {
            return ORIENTATION_UNDEFINED;
        }
        return super.getRequestedConfigurationOrientation(forDisplay, requestedOrientation);
    }

+13 −0
Original line number Diff line number Diff line
@@ -5443,6 +5443,19 @@ public class SizeCompatTests extends WindowTestsBase {
        makeDisplayLargeScreen(mDisplayContent);
        assertTrue(mActivity.isUniversalResizeable());
        assertFitted();

        // Though "locked" orientation is respected to keep current display orientation, it should
        // not be treated as fixed in portrait or landscape.
        setUpApp(mDisplayContent, new ActivityBuilder(mAtm)
                .setResizeMode(RESIZE_MODE_UNRESIZEABLE)
                .setScreenOrientation(ActivityInfo.SCREEN_ORIENTATION_LOCKED));
        assertEquals(ActivityInfo.SCREEN_ORIENTATION_LOCKED, mActivity.getOverrideOrientation());
        assertEquals("Must not be a specific orientation", Configuration.ORIENTATION_UNDEFINED,
                mActivity.getRequestedConfigurationOrientation());
        final Rect resizeBounds = new Rect(mActivity.getTask().getBounds());
        resizeBounds.scale(0.8f);
        mActivity.getTask().setBounds(resizeBounds);
        assertFitted();
    }

    @Test