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

Commit d3efcb3c authored by Adithya Srinivasan's avatar Adithya Srinivasan
Browse files

Clear mFrameTimelineVsyncId after transaction is applied

Without clearing the mFrameTimelineVsyncId, there can be stale tokens
that get reused, thereby resulting in wrong classification of janks.
This change cleans up the existing code and calls clear(), which
does a clean clear of all the states.

Bug: 171329973
Test: dumpsys SurfaceFlinger --frametimeline on cold starting an app
Change-Id: Ia27520fc6dbb79a122fed40ad963ef470bc2ae35
parent b05b9099
Loading
Loading
Loading
Loading
+7 −17
Original line number Diff line number Diff line
@@ -695,8 +695,6 @@ status_t SurfaceComposerClient::Transaction::apply(bool synchronous) {
        }
    }

    mListenerCallbacks.clear();

    cacheBuffers();

    Vector<ComposerState> composerStates;
@@ -709,10 +707,7 @@ status_t SurfaceComposerClient::Transaction::apply(bool synchronous) {
        composerStates.add(kv.second);
    }

    mComposerStates.clear();

    displayStates = mDisplayStates;
    mDisplayStates.clear();
    displayStates = std::move(mDisplayStates);

    if (mForceSynchronous) {
        flags |= ISurfaceComposer::eSynchronous;
@@ -733,21 +728,16 @@ status_t SurfaceComposerClient::Transaction::apply(bool synchronous) {
        flags |= ISurfaceComposer::eExplicitEarlyWakeupEnd;
    }

    mForceSynchronous = false;
    mAnimation = false;
    mEarlyWakeup = false;
    mExplicitEarlyWakeupStart = false;
    mExplicitEarlyWakeupEnd = false;

    uint64_t transactionId = mId;
    mId = generateId();

    sp<IBinder> applyToken = IInterface::asBinder(TransactionCompletedListener::getIInstance());
    sf->setTransactionState(mFrameTimelineVsyncId, composerStates, displayStates, flags, applyToken,
                            mInputWindowCommands, mDesiredPresentTime,
                            {} /*uncacheBuffer - only set in doUncacheBufferTransaction*/,
                            hasListenerCallbacks, listenerCallbacks, transactionId);
    mInputWindowCommands.clear();
                            hasListenerCallbacks, listenerCallbacks, mId);
    mId = generateId();

    // Clear the current states and flags
    clear();

    mStatus = NO_ERROR;
    return NO_ERROR;
}