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

Commit 5958828b authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Update top fixed rotation launching app when linking new top" into rvc-dev

parents 9aa88525 f3ff9e7f
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);