Loading libs/binder/IPCThreadState.cpp +4 −1 Original line number Original line Diff line number Diff line Loading @@ -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; } } Loading Loading @@ -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) { Loading libs/binder/include/binder/IPCThreadState.h +1 −0 Original line number Original line Diff line number Diff line Loading @@ -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; Loading Loading
libs/binder/IPCThreadState.cpp +4 −1 Original line number Original line Diff line number Diff line Loading @@ -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; } } Loading Loading @@ -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) { Loading
libs/binder/include/binder/IPCThreadState.h +1 −0 Original line number Original line Diff line number Diff line Loading @@ -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; Loading