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

Commit f0c5e235 authored by Evan Rosky's avatar Evan Rosky
Browse files

Defer sub-activity layout while sub-activity cfg is deferred

When using config-at-end, sub-activity configuration changes
are blocked so that the client doesn't receive configs until
the end of a transition. However, layout was still running
at these levels which was wasteful and produced incorrect
results.

Fix this by also deferring layout calculations during the
same time that sub-activity configs are deferred and then
updating the layout when resumed.

Bug: 393159816
Test: move pip without resize and observe no flicker
Flag: EXEMPT bugfix
Change-Id: I7cafe7db6f5af71df688a24f9ab12a427b91f38d
parent 1f3c73b0
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -205,13 +205,6 @@ public class PipScheduler implements PipTransitionState.PipTransitionStateChange
        WindowContainerTransaction wct = new WindowContainerTransaction();
        if (configAtEnd) {
            wct.deferConfigToTransitionEnd(pipTaskToken);

            if (mPipBoundsState.getBounds().width() == toBounds.width()
                    && mPipBoundsState.getBounds().height() == toBounds.height()) {
                // TODO (b/393159816): Config-at-End causes a flicker without size change.
                // If PiP size isn't changing enforce a minimal one-pixel change as a workaround.
                --toBounds.bottom;
            }
        }
        wct.setBounds(pipTaskToken, toBounds);
        mPipTransitionController.startPipBoundsChangeTransition(wct, duration);
+6 −0
Original line number Diff line number Diff line
@@ -8287,6 +8287,12 @@ final class ActivityRecord extends WindowToken {
        }
        for (int i = getChildCount() - 1; i >= 0; --i) {
            dispatchConfigurationToChild(getChildAt(i), getConfiguration());
            final WindowState ws = getChildAt(i).asWindowState();
            if (ws != null) {
                getDisplayContent().getDisplayPolicy().layoutWindowLw(ws, null /* attached */,
                        getDisplayContent().mDisplayFrames);
                ws.updateSurfacePositionNonOrganized();
            }
        }
        updateReportedConfigurationAndSend();
        return true;
+2 −1
Original line number Diff line number Diff line
@@ -1234,7 +1234,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP

    boolean skipLayout() {
        // Skip layout of the window when in transition to pip mode.
        return mActivityRecord != null && mActivityRecord.mWaitForEnteringPinnedMode;
        return mActivityRecord != null && (mActivityRecord.mWaitForEnteringPinnedMode
                || mActivityRecord.isConfigurationDispatchPaused());
    }

    void setFrames(ClientWindowFrames clientWindowFrames, int requestedWidth, int requestedHeight) {