Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6acb3ed0 authored by Harry Cutts's avatar Harry Cutts
Browse files

touchpad: hide non-error Gestures library logs

These logs can be extremely verbose, especially the tap-to-click
messages, and they're not particularly useful for triaging bugs. Only
enable them when the touchpad gestures debugging property is set.

Bug: 314743031
Test: use a touchpad, and check no TTC logs appear. Run `adb shell 'stop
      && setprop log.tag.TouchpadInputMapperGestures DEBUG && start'`,
      use a touchpad, and check the TTC logs do appear
Change-Id: I4218fc856080199b974ed7a5746a7acf2283cfaa
parent d26c9194
Loading
Loading
Loading
Loading
+19 −4
Original line number Diff line number Diff line
@@ -26,16 +26,31 @@

extern "C" {

namespace {

/**
 * Log details of each gesture output by the gestures library.
 * Enable this via "adb shell setprop log.tag.TouchpadInputMapperGestures DEBUG" (requires
 * restarting the shell)
 */
const bool DEBUG_TOUCHPAD_GESTURES =
        __android_log_is_loggable(ANDROID_LOG_DEBUG, "TouchpadInputMapperGestures",
                                  ANDROID_LOG_INFO);

} // namespace

void gestures_log(int verb, const char* fmt, ...) {
    va_list args;
    va_start(args, fmt);
    if (verb == GESTURES_LOG_ERROR) {
        LOG_PRI_VA(ANDROID_LOG_ERROR, LOG_TAG, fmt, args);
    } else if (verb == GESTURES_LOG_INFO) {
    } else if (DEBUG_TOUCHPAD_GESTURES) {
        if (verb == GESTURES_LOG_INFO) {
            LOG_PRI_VA(ANDROID_LOG_INFO, LOG_TAG, fmt, args);
        } else {
            LOG_PRI_VA(ANDROID_LOG_DEBUG, LOG_TAG, fmt, args);
        }
    }
    va_end(args);
}
}