summaryrefslogtreecommitdiff
path: root/services/inputflinger/InputClassifier.cpp
diff options
context:
space:
mode:
author Prabir Pradhan <prabirmsp@google.com> 2022-07-01 17:54:18 +0000
committer Prabir Pradhan <prabirmsp@google.com> 2022-07-01 17:54:18 +0000
commitd7740d681c5b577dac7827fae66f9ec9847327dc (patch)
tree4cd14511ae3b73af5d04d0af10387c7bdfc0a3d0 /services/inputflinger/InputClassifier.cpp
parentfc821138912910d44cf6f0ae9a622b592936111c (diff)
Classifier: Ping the HAL from monitor() instead of dump()
The input dump should not be affected by the state of the HAL. Previously, we were pinging the HAL duing a dump, which means the dumpsys would fail if the HAL is stuck. Instead, we ping the HAL duing the monitor() call so that a HAL that is stuck can be more easiliy identified. Bug: 237347585 Test: manual, flash device Change-Id: I050bacc5510f10b788232e156ea91d505d841b55
Diffstat (limited to 'services/inputflinger/InputClassifier.cpp')
-rw-r--r--services/inputflinger/InputClassifier.cpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/services/inputflinger/InputClassifier.cpp b/services/inputflinger/InputClassifier.cpp
index 8ce2f35d7b..21695c354d 100644
--- a/services/inputflinger/InputClassifier.cpp
+++ b/services/inputflinger/InputClassifier.cpp
@@ -331,20 +331,9 @@ void MotionClassifier::reset(const NotifyDeviceResetArgs& args) {
enqueueEvent(std::make_unique<NotifyDeviceResetArgs>(args));
}
-const char* MotionClassifier::getServiceStatus() REQUIRES(mLock) {
- if (!mService) {
- return "null";
- }
-
- if (AIBinder_ping(mService->asBinder().get()) == STATUS_OK) {
- return "running";
- }
- return "not responding";
-}
-
void MotionClassifier::dump(std::string& dump) {
std::scoped_lock lock(mLock);
- dump += StringPrintf(INDENT2 "mService status: %s\n", getServiceStatus());
+ dump += StringPrintf(INDENT2 "mService connected: %s\n", mService ? "true" : "false");
dump += StringPrintf(INDENT2 "mEvents: %zu element(s) (max=%zu)\n",
mEvents.size(), MAX_EVENTS);
dump += INDENT2 "mClassifications, mLastDownTimes:\n";
@@ -365,6 +354,18 @@ void MotionClassifier::dump(std::string& dump) {
}
}
+void MotionClassifier::monitor() {
+ std::scoped_lock lock(mLock);
+ if (mService) {
+ // Ping the HAL service to ensure it is alive and not blocked.
+ const binder_status_t status = AIBinder_ping(mService->asBinder().get());
+ if (status != STATUS_OK) {
+ ALOGW("IInputProcessor HAL is not responding; binder ping result: %s",
+ AStatus_getDescription(AStatus_fromStatus(status)));
+ }
+ }
+}
+
// --- InputClassifier ---
InputClassifier::InputClassifier(InputListenerInterface& listener) : mQueuedListener(listener) {}
@@ -504,6 +505,7 @@ void InputClassifier::dump(std::string& dump) {
void InputClassifier::monitor() {
std::scoped_lock lock(mLock);
+ if (mMotionClassifier) mMotionClassifier->monitor();
}
InputClassifier::~InputClassifier() {