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

Commit d19b21b1 authored by Rob Carr's avatar Rob Carr Committed by Automerger Merge Worker
Browse files

Merge "Replace MainWindowSizeChange transaction with applyWithNextDraw" into tm-dev am: acc878da

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17049422

Change-Id: I85a273083b0b56ef8a06d5c259992557775b3a04
parents db3b2fa6 acc878da
Loading
Loading
Loading
Loading
+8 −16
Original line number Diff line number Diff line
@@ -504,13 +504,6 @@ class Task extends TaskFragment {
     */
    boolean mInRemoveTask;

    // When non-null, this is a transaction that will get applied on the next frame returned after
    // a relayout is requested from the client. While this is only valid on a leaf task; since the
    // transaction can effect an ancestor task, this also needs to keep track of the ancestor task
    // that this transaction manipulates because deferUntilFrame acts on individual surfaces.
    SurfaceControl.Transaction mMainWindowSizeChangeTransaction;
    Task mMainWindowSizeChangeTask;

    private final AnimatingActivityRegistry mAnimatingActivityRegistry =
            new AnimatingActivityRegistry();

@@ -4390,17 +4383,16 @@ class Task extends TaskFragment {
            leaf.setMainWindowSizeChangeTransaction(t, origin);
            return;
        }
        mMainWindowSizeChangeTransaction = t;
        mMainWindowSizeChangeTask = t == null ? null : origin;
        final WindowState w = getTopVisibleAppMainWindow();
        if (w != null) {
            w.applyWithNextDraw((d) -> {
                d.merge(t);
            });
        } else {
            t.apply();
        }

    SurfaceControl.Transaction getMainWindowSizeChangeTransaction() {
        return mMainWindowSizeChangeTransaction;
    }

    Task getMainWindowSizeChangeTask() {
        return mMainWindowSizeChangeTask;
    }

    void setActivityWindowingMode(int windowingMode) {
        PooledConsumer c = PooledLambda.obtainConsumer(ActivityRecord::setWindowingMode,
+0 −13
Original line number Diff line number Diff line
@@ -5988,15 +5988,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        finishDrawing(null);
        mWmService.mH.removeMessages(WINDOW_STATE_BLAST_SYNC_TIMEOUT, this);
        if (!useBLASTSync()) return;

        final Task task = getTask();
        if (task != null) {
            final SurfaceControl.Transaction t = task.getMainWindowSizeChangeTransaction();
            if (t != null) {
                mSyncTransaction.merge(t);
            }
            task.setMainWindowSizeChangeTransaction(null);
        }
    }

    @Override
@@ -6033,10 +6024,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        if (mRedrawForSyncReported) {
            return false;
        }
        final Task task = getTask();
        if (task != null && task.getMainWindowSizeChangeTransaction() != null) {
            return true;
        }
        return useBLASTSync();
    }

+0 −46
Original line number Diff line number Diff line
@@ -442,50 +442,6 @@ class WindowStateAnimator {
        return mService.useBLASTSync() && mWin.useBLASTSync();
    }

    private boolean shouldConsumeMainWindowSizeTransaction() {
        // We only consume the transaction when the client is calling relayout
        // because this is the only time we know the frameNumber will be valid
        // due to the client renderer being paused. Put otherwise, only when
        // mInRelayout is true can we guarantee the next frame will contain
        // the most recent configuration.
        if (!mWin.mInRelayout) return false;
        // Since we can only do this for one window, we focus on the main application window
        if (mAttrType != TYPE_BASE_APPLICATION) return false;
        final Task task = mWin.getTask();
        if (task == null) return false;
        if (task.getMainWindowSizeChangeTransaction() == null) return false;
        // Likewise we only focus on the task root, since we can only use one window
        if (!mWin.mActivityRecord.isRootOfTask()) return false;
        return true;
    }

    void setSurfaceBoundariesLocked(SurfaceControl.Transaction t) {
        if (mSurfaceController == null) {
            return;
        }

        final WindowState w = mWin;
        final Task task = w.getTask();
        if (shouldConsumeMainWindowSizeTransaction()) {
            if (isInBlastSync()) {
                // If we're in a sync transaction, there's no need to call defer transaction.
                // The sync transaction will contain the buffer so the bounds change transaction
                // will only be applied with the buffer.
                t.merge(task.getMainWindowSizeChangeTransaction());
                task.setMainWindowSizeChangeTransaction(null);
            } else {
                mWin.applyWithNextDraw(finishedFrame -> {
                      final SurfaceControl.Transaction sizeChangedTransaction =
                          task.getMainWindowSizeChangeTransaction();
                      if (sizeChangedTransaction != null) {
                          finishedFrame.merge(sizeChangedTransaction);
                          task.setMainWindowSizeChangeTransaction(null);
                      }
                });
            }
        }
    }

    void prepareSurfaceLocked(SurfaceControl.Transaction t) {
        final WindowState w = mWin;
        if (!hasSurface()) {
@@ -501,8 +457,6 @@ class WindowStateAnimator {

        computeShownFrameLocked();

        setSurfaceBoundariesLocked(t);

        if (w.isParentWindowHidden() || !w.isOnScreen()) {
            hide(t, "prepareSurfaceLocked");
            mWallpaperControllerLocked.hideWallpapers(w);