SF: Add thread saftey static analysis for InputWindowCommands
ref: http://clang.llvm.org/docs/ThreadSafetyAnalysis.html
Bug: 124061013
Test: n/a static analysis
Change-Id: Ide594386d1e1bf3857be418b3f305c68bebd520e
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index ea7a32d..02898b2 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -534,11 +534,11 @@
void handleMessageRefresh();
void handleTransaction(uint32_t transactionFlags);
- void handleTransactionLocked(uint32_t transactionFlags);
+ void handleTransactionLocked(uint32_t transactionFlags) REQUIRES(mStateLock);
void updateInputFlinger();
void updateInputWindowInfo();
- void commitInputWindowCommands();
+ void commitInputWindowCommands() REQUIRES(mStateLock);
void executeInputWindowCommands();
void updateCursorAsync();
@@ -567,7 +567,8 @@
const Vector<ComposerState>& states);
uint32_t setClientStateLocked(const ComposerState& composerState);
uint32_t setDisplayStateLocked(const DisplayState& s);
- uint32_t addInputWindowCommands(const InputWindowCommands& inputWindowCommands);
+ uint32_t addInputWindowCommands(const InputWindowCommands& inputWindowCommands)
+ REQUIRES(mStateLock);
/* ------------------------------------------------------------------------
* Layer management
@@ -1145,9 +1146,8 @@
/* ------------------------------------------------------------------------ */
sp<IInputFlinger> mInputFlinger;
- // Access must be protected by mStateLock.
- InputWindowCommands mPendingInputWindowCommands;
- // Should only be accessed by the drawing thread.
+ InputWindowCommands mPendingInputWindowCommands GUARDED_BY(mStateLock);
+ // Should only be accessed by the main thread.
InputWindowCommands mInputWindowCommands;
ui::DisplayPrimaries mInternalDisplayPrimaries;