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

Commit 9d22d0f2 authored by Vishnu Nair's avatar Vishnu Nair
Browse files

Reapply "Apply pending transactions always"

This reverts commit 71d8423836dfbfb01e093da63baec54f3e786375.

Track if pending transactions have already been applied and only
apply the workaround if the transaction is not empty.

Flag: EXEMPT bug fix
Test: repro in bug
Bug: 334901521
Change-Id: If2b7e54bc4fe2582fd72a6f8c2511671acce2cfa
parent 7e33e3ae
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -4345,6 +4345,7 @@ public final class ViewRootImpl implements ViewParent,
            handleSyncRequestWhenNoAsyncDraw(mActiveSurfaceSyncGroup, mHasPendingTransactions,
                    mPendingTransaction, "view not visible");
            mHasPendingTransactions = false;
        } else if (cancelAndRedraw) {
            if (!mWasLastDrawCanceled) {
                logAndTrace("Canceling draw."
@@ -4372,6 +4373,7 @@ public final class ViewRootImpl implements ViewParent,
            if (!performDraw(mActiveSurfaceSyncGroup)) {
                handleSyncRequestWhenNoAsyncDraw(mActiveSurfaceSyncGroup, mHasPendingTransactions,
                        mPendingTransaction, mLastPerformDrawSkippedReason);
                mHasPendingTransactions = false;
            }
        }
        mWasLastDrawCanceled = cancelAndRedraw;
@@ -4388,7 +4390,14 @@ public final class ViewRootImpl implements ViewParent,
            mReportNextDraw = false;
            mLastReportNextDrawReason = null;
            mActiveSurfaceSyncGroup = null;
            if (mHasPendingTransactions) {
                // TODO: We shouldn't ever actually hit this, it means mPendingTransaction wasn't
                // merged with a sync group or BLASTBufferQueue before making it to this point
                // But better a one or two frame flicker than steady-state broken from dropping
                // whatever is in this transaction
                mPendingTransaction.apply();
                mHasPendingTransactions = false;
            }
            mSyncBuffer = false;
            if (isInWMSRequestedSync()) {
                mWmsRequestSyncGroup.markSyncReady();
@@ -5305,6 +5314,7 @@ public final class ViewRootImpl implements ViewParent,
    private void registerCallbackForPendingTransactions() {
        Transaction t = new Transaction();
        t.merge(mPendingTransaction);
        mHasPendingTransactions = false;
        registerRtFrameCallback(new FrameDrawingCallback() {
            @Override
@@ -5384,6 +5394,7 @@ public final class ViewRootImpl implements ViewParent,
        if (!usingAsyncReport && mHasPendingTransactions) {
            pendingTransaction = new Transaction();
            pendingTransaction.merge(mPendingTransaction);
            mHasPendingTransactions = false;
        } else {
            pendingTransaction = null;
        }
@@ -9942,6 +9953,7 @@ public final class ViewRootImpl implements ViewParent,
        }
        handleSyncRequestWhenNoAsyncDraw(mActiveSurfaceSyncGroup, mHasPendingTransactions,
                mPendingTransaction, "shutting down VRI");
        mHasPendingTransactions = false;
        WindowManagerGlobal.getInstance().doRemoveView(this);
    }
@@ -12601,6 +12613,7 @@ public final class ViewRootImpl implements ViewParent,
        if (mHasPendingTransactions) {
            t = new Transaction();
            t.merge(mPendingTransaction);
            mHasPendingTransactions = false;
        } else {
            t = null;
        }