Fix potential block in InputReader
The 'dispatchExternalStylusState' is a callback function for
'ExternalStylusInputMapper' when the stylus device state is changed,
it's unnecessary to hold the lock again because it already hold when
processing the raw event.
Bug: 187253236
Test: atest inputflinger_tests
Change-Id: I19a2ef5f4c7a5afb622691ef7ec532f8d4dbb7ed
diff --git a/services/inputflinger/reader/InputReader.cpp b/services/inputflinger/reader/InputReader.cpp
index 2d0fdf7..e91f84e 100644
--- a/services/inputflinger/reader/InputReader.cpp
+++ b/services/inputflinger/reader/InputReader.cpp
@@ -413,8 +413,7 @@
}
}
-void InputReader::dispatchExternalStylusState(const StylusState& state) {
- std::scoped_lock _l(mLock);
+void InputReader::dispatchExternalStylusStateLocked(const StylusState& state) {
for (auto& devicePair : mDevices) {
std::shared_ptr<InputDevice>& device = devicePair.second;
device->updateExternalStylusState(state);
@@ -945,7 +944,7 @@
}
void InputReader::ContextImpl::dispatchExternalStylusState(const StylusState& state) {
- mReader->dispatchExternalStylusState(state);
+ mReader->dispatchExternalStylusStateLocked(state);
}
InputReaderPolicyInterface* InputReader::ContextImpl::getPolicy() {