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

Commit d18f541b authored by wilsonshih's avatar wilsonshih
Browse files

Only skip transfer starting window if orientation is not undefined.

Allow transfer starting window to next activity if the requested
orientation is changed at runtime, because configuration change will
trigger rotation transition.
Only disallow transfer starting window if the requested orientation
is pre-defined with specific orientation, since there won't have
rotation transition.

Flag: EXEMPT bugfix
Bug: 379534938
Test: launch two activities to simulate transfer starting window in
opening transition with
A. set orientation at runtime and
B. pre-define orientation in manifest.
Verify no flicker for both case.

Change-Id: I84bf8f5bf6c2f553636d4fb890cfa5db0995e7d2
parent 6d657891
Loading
Loading
Loading
Loading
+14 −9
Original line number Diff line number Diff line
@@ -4575,10 +4575,22 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
                // at #postWindowRemoveCleanupLocked
                return false;
            }

            // Link the fixed rotation transform to this activity since we are transferring the
            // starting window.
            if (fromActivity.hasFixedRotationTransform()) {
                mDisplayContent.handleTopActivityLaunchingInDifferentOrientation(this,
                        false /* checkOpening */);
            }
            // Do not transfer if the orientation doesn't match, redraw starting window while it is
            // on top will cause flicker.
            if (fromActivity.getRequestedConfigurationOrientation()
                    != getRequestedConfigurationOrientation()) {
            final int fromOrientation = fromActivity.getConfiguration().orientation;
            final int requestedOrientation = getRequestedConfigurationOrientation();
            if (requestedOrientation == ORIENTATION_UNDEFINED) {
                if (fromOrientation != getConfiguration().orientation) {
                    return false;
                }
            } else if (fromOrientation != requestedOrientation) {
                return false;
            }
            // In this case, the starting icon has already been displayed, so start
@@ -4592,13 +4604,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A

            final long origId = Binder.clearCallingIdentity();
            try {
                // Link the fixed rotation transform to this activity since we are transferring the
                // starting window.
                if (fromActivity.hasFixedRotationTransform()) {
                    mDisplayContent.handleTopActivityLaunchingInDifferentOrientation(this,
                            false /* checkOpening */);
                }

                // Transfer the starting window over to the new token.
                mStartingData = fromActivity.mStartingData;
                mStartingSurface = fromActivity.mStartingSurface;