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

Commit 08f6c9a1 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Update top fixed rotation launching app when linking new top" into...

Merge "Update top fixed rotation launching app when linking new top" into rvc-dev am: 5958828b am: 5333e13e am: f61e4a1a am: 17ecbded

Change-Id: I1123e7ae4e65e5616bfdd5fe46a3bf0df65ce185
parents 1ca9b68b 17ecbded
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1527,6 +1527,11 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
     */
    void setFixedRotationLaunchingApp(@NonNull ActivityRecord r, @Surface.Rotation int rotation) {
        final WindowToken prevRotatedLaunchingApp = mFixedRotationLaunchingApp;
        if (prevRotatedLaunchingApp != null && prevRotatedLaunchingApp == r
                && r.getWindowConfiguration().getRotation() == rotation) {
            // The given launching app and target rotation are the same as the existing ones.
            return;
        }
        if (prevRotatedLaunchingApp != null
                && prevRotatedLaunchingApp.getWindowConfiguration().getRotation() == rotation
                // It is animating so we can expect there will have a transition callback.
@@ -1536,6 +1541,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
            // the heavy operations. This also benefits that the states of multiple activities
            // are handled together.
            r.linkFixedRotationTransform(prevRotatedLaunchingApp);
            setFixedRotationLaunchingAppUnchecked(r, rotation);
            return;
        }

+4 −5
Original line number Diff line number Diff line
@@ -128,10 +128,10 @@ class WindowToken extends WindowContainer<WindowState> {
        final Configuration mRotatedOverrideConfiguration;
        final SeamlessRotator mRotator;
        /**
         * The tokens that share the same transform. Their end time of transform are the same as
         * {@link #mOwner}.
         * The tokens that share the same transform. Their end time of transform are the same. The
         * list should at least contain the token who creates this state.
         */
        final ArrayList<WindowToken> mAssociatedTokens = new ArrayList<>(1);
        final ArrayList<WindowToken> mAssociatedTokens = new ArrayList<>(3);
        final ArrayList<WindowContainer<?>> mRotatedContainers = new ArrayList<>(3);
        boolean mIsTransforming = true;

@@ -531,6 +531,7 @@ class WindowToken extends WindowContainer<WindowState> {
                mDisplayContent.getConfiguration().uiMode);
        mFixedRotationTransformState = new FixedRotationTransformState(info, displayFrames,
                insetsState, new Configuration(config), mDisplayContent.getRotation());
        mFixedRotationTransformState.mAssociatedTokens.add(this);
        onConfigurationChanged(getParent().getConfiguration());
        notifyFixedRotationTransform(true /* enabled */);
    }
@@ -578,14 +579,12 @@ class WindowToken extends WindowContainer<WindowState> {
            for (int i = state.mAssociatedTokens.size() - 1; i >= 0; i--) {
                state.mAssociatedTokens.get(i).cancelFixedRotationTransform();
            }
            cancelFixedRotationTransform();
        }
        // The state is cleared at the end, because it is used to indicate that other windows can
        // use seamless rotation when applying rotation to display.
        for (int i = state.mAssociatedTokens.size() - 1; i >= 0; i--) {
            state.mAssociatedTokens.get(i).cleanUpFixedRotationTransformState();
        }
        cleanUpFixedRotationTransformState();
    }

    private void cleanUpFixedRotationTransformState() {
+3 −1
Original line number Diff line number Diff line
@@ -1134,8 +1134,10 @@ public class DisplayContentTests extends WindowTestsBase {
        mDisplayContent.mOpeningApps.add(app2);
        app2.setRequestedOrientation(newOrientation);

        // The activity should share the same transform state as the existing one.
        // The activity should share the same transform state as the existing one. The activity
        // should also be the fixed rotation launching app because it is the latest top.
        assertTrue(app.hasFixedRotationTransform(app2));
        assertTrue(mDisplayContent.isFixedRotationLaunchingApp(app2));

        // The display should be rotated after the launch is finished.
        mDisplayContent.mAppTransition.notifyAppTransitionFinishedLocked(app.token);