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

Commit 4cb5549a authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Collect changes for transition right before updating config

Otherwise if display configuration is updated first, the later
collect() may not detect change. Such as if an activity with
ROTATION_ANIMATION_SEAMLESS is not included in TransitionInfo,
the animation will still be screenshot based style.

Bug: 240238575
Test: SeamlessAppRotationTest

Change-Id: I53f4212dad210cacdc4c243475ab1ab6355fe53b
parent 81ae4109
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -504,6 +504,7 @@ public class DisplayArea<T extends WindowContainer> extends WindowContainer<T> {

    @Override
    public void onConfigurationChanged(Configuration newParentConfig) {
        mTransitionController.collectForDisplayAreaChange(this);
        mTmpConfiguration.setTo(getConfiguration());
        super.onConfigurationChanged(newParentConfig);

+3 −3
Original line number Diff line number Diff line
@@ -5935,6 +5935,9 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
        if (changes != 0) {
            Slog.i(TAG, "Override config changes=" + Integer.toHexString(changes) + " "
                    + mTempConfig + " for displayId=" + mDisplayId);
            if (isReady() && mTransitionController.isShellTransitionsEnabled()) {
                requestChangeTransitionIfNeeded(changes, null /* displayChange */);
            }
            onRequestedOverrideConfigurationChanged(mTempConfig);

            final boolean isDensityChange = (changes & ActivityInfo.CONFIG_DENSITY) != 0;
@@ -5951,9 +5954,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
            }
            mWmService.mDisplayNotificationController.dispatchDisplayChanged(
                    this, getConfiguration());
            if (isReady() && mTransitionController.isShellTransitionsEnabled()) {
                requestChangeTransitionIfNeeded(changes, null /* displayChange */);
            }
        }
        return changes;
    }
+0 −18
Original line number Diff line number Diff line
@@ -513,19 +513,6 @@ public class DisplayRotation {
        return true;
    }

    /**
     * Utility to get a rotating displaycontent from a Transition.
     * @return null if the transition doesn't contain a rotating display.
     */
    static DisplayContent getDisplayFromTransition(Transition transition) {
        for (int i = transition.mParticipants.size() - 1; i >= 0; --i) {
            final WindowContainer wc = transition.mParticipants.valueAt(i);
            if (!(wc instanceof DisplayContent)) continue;
            return (DisplayContent) wc;
        }
        return null;
    }

    private void startRemoteRotation(int fromRotation, int toRotation) {
        mDisplayContent.mRemoteDisplayChangeController.performRemoteDisplayChange(
                fromRotation, toRotation, null /* newDisplayAreaInfo */,
@@ -545,11 +532,6 @@ public class DisplayRotation {
                throw new IllegalStateException("Trying to rotate outside a transition");
            }
            mDisplayContent.mTransitionController.collect(mDisplayContent);
            // Go through all tasks and collect them before the rotation
            // TODO(shell-transitions): move collect() to onConfigurationChange once wallpaper
            //       handling is synchronized.
            mDisplayContent.mTransitionController.collectForDisplayAreaChange(mDisplayContent,
                    null /* use collecting transition */);
        }
        mService.mAtmService.deferWindowLayout();
        try {
+0 −1
Original line number Diff line number Diff line
@@ -101,7 +101,6 @@ public class PhysicalDisplaySwitchTransitionLauncher {

        if (t != null) {
            mDisplayContent.mAtmService.startLaunchPowerMode(POWER_MODE_REASON_CHANGE_DISPLAY);
            mTransitionController.collectForDisplayAreaChange(mDisplayContent, t);
            mTransition = t;
        }
    }
+13 −0
Original line number Diff line number Diff line
@@ -1634,6 +1634,19 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
        return mainWin.getAttrs().rotationAnimation;
    }

    /** Applies the new configuration and returns {@code true} if there is a display change. */
    boolean applyDisplayChangeIfNeeded() {
        boolean changed = false;
        for (int i = mParticipants.size() - 1; i >= 0; --i) {
            final WindowContainer<?> wc = mParticipants.valueAt(i);
            final DisplayContent dc = wc.asDisplayContent();
            if (dc == null || !mChanges.get(dc).hasChanged(dc)) continue;
            dc.sendNewConfiguration();
            changed = true;
        }
        return changed;
    }

    boolean getLegacyIsReady() {
        return isCollecting() && mSyncId >= 0;
    }
Loading