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

Commit 5dd47d95 authored by Riddle Hsu's avatar Riddle Hsu
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
Test: Fold/unfold split screen. There is no split screen transition
      after display change transition.
Change-Id: I2b755db6fa2c388eb6db2bed18d298dc7c844925
parent 96fd8a65
Loading
Loading
Loading
Loading
+19 −12
Original line number Diff line number Diff line
@@ -173,6 +173,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,
@@ -186,6 +188,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
@@ -6210,7 +6210,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) {