summaryrefslogtreecommitdiff
path: root/services/inputflinger/InputManager.cpp
diff options
context:
space:
mode:
author Prabir Pradhan <prabirmsp@google.com> 2023-12-06 22:38:21 +0000
committer Prabir Pradhan <prabirmsp@google.com> 2023-12-07 16:28:31 +0000
commit95019ac8d7b5217aa4b606fa5fe775f192c6baeb (patch)
tree1875b3a15c209550d1f961502083e38a5558ebe7 /services/inputflinger/InputManager.cpp
parente209cdde92e60b36652fb078749500f8379c4e6b (diff)
Introduce thread safety to InputDeviceMetricsCollector
There are several threads that interact with the metrics collector, such as the Reader thread, Dispatcher thread, and binder threads for dumping. However, thread safety was never added to it, since it started off only running on the Reader thread. There is a high likelihood that this is the root cause of crashes that we see when dumping the metrics collector. Add a lock to the metrics collector to guard its state. Bug: 315193876 Test: atest inputflinger_tests Change-Id: I6a53014fbc533cf15516e8b079ee5b715b4aa58f
Diffstat (limited to 'services/inputflinger/InputManager.cpp')
-rw-r--r--services/inputflinger/InputManager.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/services/inputflinger/InputManager.cpp b/services/inputflinger/InputManager.cpp
index 8cf61f9064..af4ba5a012 100644
--- a/services/inputflinger/InputManager.cpp
+++ b/services/inputflinger/InputManager.cpp
@@ -228,6 +228,9 @@ void InputManager::monitor() {
mReader->monitor();
mBlocker->monitor();
mProcessor->monitor();
+ if (ENABLE_INPUT_DEVICE_USAGE_METRICS) {
+ mCollector->monitor();
+ }
mDispatcher->monitor();
}