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

Commit 65461abc authored by Kshitish Vyas's avatar Kshitish Vyas Committed by Android (Google) Code Review
Browse files

Merge "Pause surface position for bounds change transaction" into 24D1-dev

parents b8450647 868410d5
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -4623,7 +4623,10 @@ class Task extends TaskFragment {
        }
        final WindowState w = getTopVisibleAppMainWindow();
        if (w != null) {
            w.mIsSurfacePositionPaused = true;
            w.applyWithNextDraw((d) -> {
                w.mIsSurfacePositionPaused = false;
                w.updateSurfacePosition(d);
                d.merge(t);
            });
        } else {
+0 −3
Original line number Diff line number Diff line
@@ -2529,9 +2529,6 @@ public class WindowManagerService extends IWindowManager.Stub
            if (displayPolicy.areSystemBarsForcedConsumedLw()) {
                result |= WindowManagerGlobal.RELAYOUT_RES_CONSUME_ALWAYS_SYSTEM_BARS;
            }
            if (!win.isGoneForLayout()) {
                win.mResizedWhileGone = false;
            }

            if (outFrames != null && outMergedConfiguration != null) {
                win.fillClientWindowFramesAndConfiguration(outFrames, outMergedConfiguration,
+6 −5
Original line number Diff line number Diff line
@@ -826,9 +826,14 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
    }

    private int applyTaskChanges(Task tr, WindowContainerTransaction.Change c) {
        int effects = applyChanges(tr, c);
        final SurfaceControl.Transaction t = c.getBoundsChangeTransaction();
        // Check bounds change transaction at the beginning because it may pause updating window
        // surface position. Then the following changes won't apply intermediate position.
        if (t != null) {
            tr.setMainWindowSizeChangeTransaction(t);
        }

        int effects = applyChanges(tr, c);
        if ((c.getChangeMask() & WindowContainerTransaction.Change.CHANGE_HIDDEN) != 0) {
            if (tr.setForceHidden(FLAG_FORCE_HIDDEN_FOR_TASK_ORG, c.getHidden())) {
                effects = TRANSACT_EFFECTS_LIFECYCLE;
@@ -849,10 +854,6 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
            tr.forAllActivities(a -> { a.setWindowingMode(childWindowingMode); });
        }

        if (t != null) {
            tr.setMainWindowSizeChangeTransaction(t);
        }

        Rect enterPipBounds = c.getEnterPipBounds();
        if (enterPipBounds != null) {
            tr.mDisplayContent.mPinnedTaskController.setEnterPipBounds(enterPipBounds);
+7 −6
Original line number Diff line number Diff line
@@ -653,9 +653,10 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
    private final Transaction mTmpTransaction;

    /**
     * Whether the window was resized by us while it was gone for layout.
     * Whether the surface position of window is paused to update. Currently it is only used for
     * {@link Task#setMainWindowSizeChangeTransaction(Transaction)} to synchronize position.
     */
    boolean mResizedWhileGone = false;
    boolean mIsSurfacePositionPaused;

    /**
     * During seamless rotation we have two phases, first the old window contents
@@ -2156,9 +2157,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
            ProtoLog.d(WM_DEBUG_RESIZE, "onResize: Resizing %s", this);
            resizingWindows.add(this);
        }
        if (isGoneForLayout()) {
            mResizedWhileGone = true;
        }

        super.onResize();
    }
@@ -4112,6 +4110,9 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        pw.println(prefix + "mHasSurface=" + mHasSurface
                + " isReadyForDisplay()=" + isReadyForDisplay()
                + " mWindowRemovalAllowed=" + mWindowRemovalAllowed);
        if (mIsSurfacePositionPaused) {
            pw.println(prefix + "mIsSurfacePositionPaused=true");
        }
        if (mInvGlobalScale != 1f) {
            pw.println(prefix + "mCompatFrame=" + mWindowFrames.mCompatFrame.toShortString(sTmpSB));
        }
@@ -5197,7 +5198,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
    @Override
    @VisibleForTesting
    void updateSurfacePosition(Transaction t) {
        if (mSurfaceControl == null) {
        if (mSurfaceControl == null || mIsSurfacePositionPaused) {
            return;
        }
        if (mActivityRecord != null && mActivityRecord.isConfigurationDispatchPaused()) {