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

Commit 366ed325 authored by Riddle Hsu's avatar Riddle Hsu Committed by Nick Chameyev
Browse files

Run surface placement at the end of display change

It was
1. Configuration change from
   a. DC#reconfigureDisplayLocked
2. Surface placement delivers task info change from
   a. (1.a) -> sendNewConfiguration
      -> DC#updateDisplayOverrideConfigurationLocked
      -> continueWindowLayout
   or
   b. (1.a) -> performSurfacePlacement
3. Request transition

This makes 2 happen after 3, so the task info changes won't
reach shell before display transition is requested.

Also reduce unnecessary placement from (2.b).

Bug: 301420598
Bug: 325348791
Test: Fold/unfold split screen. There is no split screen transition
      after display change transition.
Change-Id: I2b755db6fa2c388eb6db2bed18d298dc7c844925
(cherry picked from commit 5dd47d95)
parent 1745193e
Loading
Loading
Loading
Loading
+19 −12
Original line number Diff line number Diff line
@@ -171,6 +171,8 @@ public class DeferredDisplayUpdater implements DisplayUpdater {
                    mDisplayContent.mInitialDisplayHeight);
            final int fromRotation = mDisplayContent.getRotation();

            mDisplayContent.mAtmService.deferWindowLayout();
            try {
                onStartCollect.run();

                ProtoLog.d(WM_DEBUG_WINDOW_TRANSITIONS,
@@ -184,6 +186,11 @@ public class DeferredDisplayUpdater implements DisplayUpdater {
                    mDisplayContent.mTransitionController.requestStartTransition(transition,
                            /* startTask= */ null, /* remoteTransition= */ null, displayChange);
                }
            } finally {
                // Run surface placement after requestStartTransition, so shell side can receive
                // the transition request before handling task info changes.
                mDisplayContent.mAtmService.continueWindowLayout();
            }
        });
    }

+6 −1
Original line number Diff line number Diff line
@@ -6175,7 +6175,12 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
     * @param onDisplayChangeApplied callback that is called when the changes are applied
     */
    void requestDisplayUpdate(@NonNull Runnable onDisplayChangeApplied) {
        mAtmService.deferWindowLayout();
        try {
            mDisplayUpdater.updateDisplayInfo(onDisplayChangeApplied);
        } finally {
            mAtmService.continueWindowLayout();
        }
    }

    void onDisplayInfoUpdated(@NonNull DisplayInfo newDisplayInfo) {