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

Commit 3bdb1331 authored by Patrick Williams's avatar Patrick Williams Committed by Android (Google) Code Review
Browse files

Merge "Synchronize access to Transaction::sApplyToken" into main

parents ac7229db 84541d15
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -1227,7 +1227,7 @@ status_t SurfaceComposerClient::Transaction::apply(bool synchronous, bool oneWay
        flags |= ISurfaceComposer::eEarlyWakeupEnd;
    }

    sp<IBinder> applyToken = mApplyToken ? mApplyToken : sApplyToken;
    sp<IBinder> applyToken = mApplyToken ? mApplyToken : getDefaultApplyToken();

    sp<ISurfaceComposer> sf(ComposerService::getComposerService());
    sf->setTransactionState(mFrameTimelineInfo, composerStates, displayStates, flags, applyToken,
@@ -1249,11 +1249,15 @@ status_t SurfaceComposerClient::Transaction::apply(bool synchronous, bool oneWay

sp<IBinder> SurfaceComposerClient::Transaction::sApplyToken = new BBinder();

std::mutex SurfaceComposerClient::Transaction::sApplyTokenMutex;

sp<IBinder> SurfaceComposerClient::Transaction::getDefaultApplyToken() {
    std::scoped_lock lock{sApplyTokenMutex};
    return sApplyToken;
}

void SurfaceComposerClient::Transaction::setDefaultApplyToken(sp<IBinder> applyToken) {
    std::scoped_lock lock{sApplyTokenMutex};
    sApplyToken = applyToken;
}

+1 −0
Original line number Diff line number Diff line
@@ -422,6 +422,7 @@ public:
    class Transaction : public Parcelable {
    private:
        static sp<IBinder> sApplyToken;
        static std::mutex sApplyTokenMutex;
        void releaseBufferIfOverwriting(const layer_state_t& state);
        static void mergeFrameTimelineInfo(FrameTimelineInfo& t, const FrameTimelineInfo& other);