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

Commit 4225e77c authored by Vishnu Nair's avatar Vishnu Nair
Browse files

Update Transaction ID after clearing the transaction

Previously, we updated the Transaction and then cleared its state. This resulted in
passing a transaction id of 0 to SF. Fix the bug by updating the transaction id
after clearing its state.

Bug: 385976595
Test: presubmit
Flag: EXEMPT bug fix
Change-Id: I24f230f974ad798f71fb63b5c4701e21f460ff70
parent 5e116051
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -998,6 +998,7 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::merge(Tr

void SurfaceComposerClient::Transaction::clear() {
    mState.clear();
    mState.mId = generateId();
    mListenerCallbacks.clear();
    mMayContainBuffer = false;
    mApplyToken = nullptr;
@@ -1182,10 +1183,13 @@ status_t SurfaceComposerClient::Transaction::apply(bool synchronous, bool oneWay

    sp<ISurfaceComposer> sf(ComposerService::getComposerService());
    TransactionState state = std::move(mState);
    mState = TransactionState();
    mState.mId = generateId();
    status_t binderStatus = sf->setTransactionState(std::move(state), applyToken);

    if (mLogCallPoints) {
        ALOG(LOG_DEBUG, LOG_SURFACE_CONTROL_REGISTRY, "Transaction %" PRIu64 " applied",
             mState.mId);
    }

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

@@ -1193,11 +1197,6 @@ status_t SurfaceComposerClient::Transaction::apply(bool synchronous, bool oneWay
        syncCallback->wait();
    }

    if (mLogCallPoints) {
        ALOG(LOG_DEBUG, LOG_SURFACE_CONTROL_REGISTRY, "Transaction %" PRIu64 " applied",
             mState.mId);
    }

    mStatus = NO_ERROR;
    return binderStatus;
}