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

Commit 4343a6f6 authored by Steven Moreland's avatar Steven Moreland Committed by Automerger Merge Worker
Browse files

Merge "ANDROID: binder: prevent double flushing when free buffer" am: 29f845bb

Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1710474

Change-Id: If5e4edd1c4a2a05f26265f2a77c78cdc24aa1365
parents c550a073 29f845bb
Loading
Loading
Loading
Loading
+4 −1
Original line number Original line Diff line number Diff line
@@ -516,14 +516,16 @@ void IPCThreadState::flushCommands()


bool IPCThreadState::flushIfNeeded()
bool IPCThreadState::flushIfNeeded()
{
{
    if (mIsLooper || mServingStackPointer != nullptr) {
    if (mIsLooper || mServingStackPointer != nullptr || mIsFlushing) {
        return false;
        return false;
    }
    }
    mIsFlushing = true;
    // In case this thread is not a looper and is not currently serving a binder transaction,
    // In case this thread is not a looper and is not currently serving a binder transaction,
    // there's no guarantee that this thread will call back into the kernel driver any time
    // there's no guarantee that this thread will call back into the kernel driver any time
    // soon. Therefore, flush pending commands such as BC_FREE_BUFFER, to prevent them from getting
    // soon. Therefore, flush pending commands such as BC_FREE_BUFFER, to prevent them from getting
    // stuck in this thread's out buffer.
    // stuck in this thread's out buffer.
    flushCommands();
    flushCommands();
    mIsFlushing = false;
    return true;
    return true;
}
}


@@ -880,6 +882,7 @@ IPCThreadState::IPCThreadState()
        mWorkSource(kUnsetWorkSource),
        mWorkSource(kUnsetWorkSource),
        mPropagateWorkSource(false),
        mPropagateWorkSource(false),
        mIsLooper(false),
        mIsLooper(false),
        mIsFlushing(false),
        mStrictModePolicy(0),
        mStrictModePolicy(0),
        mLastTransactionBinderFlags(0),
        mLastTransactionBinderFlags(0),
        mCallRestriction(mProcess->mCallRestriction) {
        mCallRestriction(mProcess->mCallRestriction) {
+1 −0
Original line number Original line Diff line number Diff line
@@ -243,6 +243,7 @@ private:
            // Whether the work source should be propagated.
            // Whether the work source should be propagated.
            bool                mPropagateWorkSource;
            bool                mPropagateWorkSource;
            bool                mIsLooper;
            bool                mIsLooper;
            bool mIsFlushing;
            int32_t             mStrictModePolicy;
            int32_t             mStrictModePolicy;
            int32_t             mLastTransactionBinderFlags;
            int32_t             mLastTransactionBinderFlags;
            CallRestriction     mCallRestriction;
            CallRestriction     mCallRestriction;