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

Commit 29f845bb authored by Steven Moreland's avatar Steven Moreland Committed by Gerrit Code Review
Browse files

Merge "ANDROID: binder: prevent double flushing when free buffer"

parents 4f7da88f f4c81378
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;