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

Commit 606772f9 authored by Siarhei Vishniakou's avatar Siarhei Vishniakou Committed by Android (Google) Code Review
Browse files

Merge "Add input flags for event verification" into main

parents 3072a705 96818960
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -33,6 +33,21 @@ filegroup {
    ],
}

/////////////////////////////////////////////////
// flags
/////////////////////////////////////////////////
aconfig_declarations {
    name: "aconfig_input_flags",
    package: "com.android.input.flags",
    srcs: ["input_flags.aconfig"],
}

cc_aconfig_library {
    name: "aconfig_input_flags_c_lib",
    aconfig_declarations: "aconfig_input_flags",
    host_supported: true,
}

aidl_interface {
    name: "inputconstants",
    host_supported: true,
@@ -176,6 +191,7 @@ cc_library {
        "libtinyxml2",
        "libutils",
        "libvintf",
        "server_configurable_flags",
    ],

    ldflags: [
@@ -196,6 +212,7 @@ cc_library {
    ],

    whole_static_libs: [
        "aconfig_input_flags_c_lib",
        "libinput_rust_ffi",
    ],

+5 −1
Original line number Diff line number Diff line
@@ -23,9 +23,12 @@
#include <log/log.h>
#include <utils/Trace.h>

#include <com_android_input_flags.h>
#include <input/InputTransport.h>
#include <input/TraceTools.h>

namespace input_flags = com::android::input::flags;

namespace {

/**
@@ -139,7 +142,8 @@ static const char* PROPERTY_RESAMPLING_ENABLED = "ro.input.resampling";
 * Enable this via "adb shell setprop log.tag.InputTransportVerifyEvents DEBUG"
 */
static bool verifyEvents() {
    return __android_log_is_loggable(ANDROID_LOG_DEBUG, LOG_TAG "VerifyEvents", ANDROID_LOG_INFO);
    return input_flags::enable_outbound_event_verification() ||
            __android_log_is_loggable(ANDROID_LOG_DEBUG, LOG_TAG "VerifyEvents", ANDROID_LOG_INFO);
}

template<typename T>
+15 −0
Original line number Diff line number Diff line
package: "com.android.input.flags"

flag {
  name: "enable_outbound_event_verification"
  namespace: "input"
  description: "Set to true to enable crashing whenever bad outbound events are detected inside InputTransport"
  bug: "271455682"
}

flag {
  name: "enable_inbound_event_verification"
  namespace: "input"
  description: "Set to true to enable crashing whenever bad inbound events are going into InputDispatcher"
  bug: "271455682"
}
+1 −0
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ cc_test {
        "libtinyxml2",
        "libutils",
        "libvintf",
        "server_configurable_flags",
    ],
    data: [
        "data/*",
+4 −1
Original line number Diff line number Diff line
@@ -19,6 +19,9 @@
#define LOG_TAG "InputDispatcher"

#include <android-base/logging.h>
#include <com_android_input_flags.h>

namespace input_flags = com::android::input::flags;

namespace android::inputdispatcher {

@@ -102,7 +105,7 @@ const bool DEBUG_HOVER =
 * Crash if a bad stream from InputListener is detected.
 * Enable this via "adb shell setprop log.tag.InputDispatcherVerifyEvents DEBUG" (requires restart)
 */
const bool DEBUG_VERIFY_EVENTS =
const bool DEBUG_VERIFY_EVENTS = input_flags::enable_inbound_event_verification() ||
        android::base::ShouldLog(android::base::LogSeverity::DEBUG, LOG_TAG "VerifyEvents");

} // namespace android::inputdispatcher