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

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

Merge "Allow runtime-opaque activity to provide unspecified orientation" into main

parents 82817975 5bbf36c7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3055,7 +3055,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A

    @Override
    boolean providesOrientation() {
        return mStyleFillsParent;
        return mStyleFillsParent || mOccludesParent;
    }

    @Override
+7 −0
Original line number Diff line number Diff line
@@ -2627,6 +2627,13 @@ public class ActivityRecordTests extends WindowTestsBase {
        // Can specify orientation if the current orientation candidate is orientation behind.
        assertEquals(SCREEN_ORIENTATION_LANDSCAPE,
                activity.getOrientation(SCREEN_ORIENTATION_BEHIND));

        final ActivityRecord translucentActivity = new ActivityBuilder(mAtm)
                .setActivityTheme(android.R.style.Theme_Translucent)
                .setCreateTask(true).build();
        assertFalse(translucentActivity.providesOrientation());
        translucentActivity.setOccludesParent(true);
        assertTrue(translucentActivity.providesOrientation());
    }

    @Test
+12 −0
Original line number Diff line number Diff line
@@ -1184,6 +1184,7 @@ class WindowTestsBase extends SystemServiceTestsBase {
        private boolean mCreateTask = false;
        private Task mParentTask;
        private int mActivityFlags;
        private int mActivityTheme;
        private int mLaunchMode;
        private int mResizeMode = RESIZE_MODE_RESIZEABLE;
        private float mMaxAspectRatio;
@@ -1232,6 +1233,14 @@ class WindowTestsBase extends SystemServiceTestsBase {
            return this;
        }

        ActivityBuilder setActivityTheme(int theme) {
            mActivityTheme = theme;
            // Use the real package of test so it can get a valid context for theme.
            mComponent = ComponentName.createRelative(mService.mContext.getPackageName(),
                    DEFAULT_COMPONENT_CLASS_NAME + sCurrentActivityId++);
            return this;
        }

        ActivityBuilder setActivityFlags(int flags) {
            mActivityFlags = flags;
            return this;
@@ -1381,6 +1390,9 @@ class WindowTestsBase extends SystemServiceTestsBase {
            if (mTargetActivity != null) {
                aInfo.targetActivity = mTargetActivity;
            }
            if (mActivityTheme != 0) {
                aInfo.theme = mActivityTheme;
            }
            aInfo.flags |= mActivityFlags;
            aInfo.launchMode = mLaunchMode;
            aInfo.resizeMode = mResizeMode;