Allow debug logging of raw events to be enabled on the fly
Enabling debug logs via adb commands required a reboot of the shell. In
order to debug flaky tests more easily, we allow raw event logs to be
enabled and disabled without the need for a restart on debuggable
builds.
We limit this ability to debuggable builds ensure there is no
performance overhead on user builds.
This change allows us to enable more verbose logging on flaky tests that
are hard to reproduce.
Bug: 193231132
Test: Manual, using adb command to enable debug logs on userdebug builds
Change-Id: I544dbf2ff8258e0bb202653b7ff3d3970f0b752e
diff --git a/services/inputflinger/reader/InputDevice.cpp b/services/inputflinger/reader/InputDevice.cpp
index c598c0a..002de29 100644
--- a/services/inputflinger/reader/InputDevice.cpp
+++ b/services/inputflinger/reader/InputDevice.cpp
@@ -412,7 +412,7 @@
// in the order received.
std::list<NotifyArgs> out;
for (const RawEvent* rawEvent = rawEvents; count != 0; rawEvent++) {
- if (DEBUG_RAW_EVENTS) {
+ if (debugRawEvents()) {
ALOGD("Input event: device=%d type=0x%04x code=0x%04x value=0x%08x when=%" PRId64,
rawEvent->deviceId, rawEvent->type, rawEvent->code, rawEvent->value,
rawEvent->when);
@@ -421,11 +421,11 @@
if (mDropUntilNextSync) {
if (rawEvent->type == EV_SYN && rawEvent->code == SYN_REPORT) {
mDropUntilNextSync = false;
- if (DEBUG_RAW_EVENTS) {
+ if (debugRawEvents()) {
ALOGD("Recovered from input event buffer overrun.");
}
} else {
- if (DEBUG_RAW_EVENTS) {
+ if (debugRawEvents()) {
ALOGD("Dropped input event while waiting for next input sync.");
}
}