blob: 7a41d682f82585613e99c98c60c8bdd85a275d8e [file] [log] [blame]
Arthur Hung1a1007b2022-05-11 07:15:01 +00001/*
2 * Copyright (C) 2022 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Prabir Pradhan48108662022-09-09 21:22:04 +000017#pragma once
Arthur Hung1a1007b2022-05-11 07:15:01 +000018
19#define LOG_TAG "InputDispatcher"
20
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -070021#include <android-base/logging.h>
Arthur Hung1a1007b2022-05-11 07:15:01 +000022
23namespace android::inputdispatcher {
Prabir Pradhan65613802023-02-22 23:36:58 +000024
25/**
26 * Signals whether this is a debuggable Android build.
27 * This is populated by reading the value of the "ro.debuggable" property.
28 */
29extern const bool IS_DEBUGGABLE_BUILD;
30
Arthur Hung1a1007b2022-05-11 07:15:01 +000031/**
32 * Log detailed debug messages about each inbound event notification to the dispatcher.
Prabir Pradhan65613802023-02-22 23:36:58 +000033 * Enable this via "adb shell setprop log.tag.InputDispatcherInboundEvent DEBUG".
34 * This requires a restart on non-debuggable (e.g. user) builds, but should take effect immediately
35 * on debuggable builds (e.g. userdebug).
Arthur Hung1a1007b2022-05-11 07:15:01 +000036 */
Prabir Pradhan65613802023-02-22 23:36:58 +000037bool debugInboundEventDetails();
Arthur Hung1a1007b2022-05-11 07:15:01 +000038
39/**
40 * Log detailed debug messages about each outbound event processed by the dispatcher.
41 * Enable this via "adb shell setprop log.tag.InputDispatcherOutboundEvent DEBUG" (requires restart)
42 */
43const bool DEBUG_OUTBOUND_EVENT_DETAILS =
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -070044 android::base::ShouldLog(android::base::LogSeverity::DEBUG, LOG_TAG "OutboundEvent");
Arthur Hung1a1007b2022-05-11 07:15:01 +000045
46/**
47 * Log debug messages about the dispatch cycle.
48 * Enable this via "adb shell setprop log.tag.InputDispatcherDispatchCycle DEBUG" (requires restart)
49 */
50const bool DEBUG_DISPATCH_CYCLE =
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -070051 android::base::ShouldLog(android::base::LogSeverity::DEBUG, LOG_TAG "DispatchCycle");
Arthur Hung1a1007b2022-05-11 07:15:01 +000052
53/**
54 * Log debug messages about channel creation
55 * Enable this via "adb shell setprop log.tag.InputDispatcherChannelCreation DEBUG" (requires
56 * restart)
57 */
58const bool DEBUG_CHANNEL_CREATION =
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -070059 android::base::ShouldLog(android::base::LogSeverity::DEBUG, LOG_TAG "ChannelCreation");
Arthur Hung1a1007b2022-05-11 07:15:01 +000060
61/**
62 * Log debug messages about input event injection.
63 * Enable this via "adb shell setprop log.tag.InputDispatcherInjection DEBUG" (requires restart)
64 */
65const bool DEBUG_INJECTION =
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -070066 android::base::ShouldLog(android::base::LogSeverity::DEBUG, LOG_TAG "Injection");
Arthur Hung1a1007b2022-05-11 07:15:01 +000067
68/**
69 * Log debug messages about input focus tracking.
70 * Enable this via "adb shell setprop log.tag.InputDispatcherFocus DEBUG" (requires restart)
71 */
72const bool DEBUG_FOCUS =
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -070073 android::base::ShouldLog(android::base::LogSeverity::DEBUG, LOG_TAG "Focus");
Arthur Hung1a1007b2022-05-11 07:15:01 +000074
75/**
76 * Log debug messages about touch mode event
77 * Enable this via "adb shell setprop log.tag.InputDispatcherTouchMode DEBUG" (requires restart)
78 */
79const bool DEBUG_TOUCH_MODE =
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -070080 android::base::ShouldLog(android::base::LogSeverity::DEBUG, LOG_TAG "TouchMode");
Arthur Hung1a1007b2022-05-11 07:15:01 +000081
82/**
83 * Log debug messages about touch occlusion
Arthur Hung1a1007b2022-05-11 07:15:01 +000084 */
Siarhei Vishniakou076dc752022-09-12 15:07:16 +000085constexpr bool DEBUG_TOUCH_OCCLUSION = true;
Arthur Hung1a1007b2022-05-11 07:15:01 +000086
87/**
88 * Log debug messages about the app switch latency optimization.
89 * Enable this via "adb shell setprop log.tag.InputDispatcherAppSwitch DEBUG" (requires restart)
90 */
91const bool DEBUG_APP_SWITCH =
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -070092 android::base::ShouldLog(android::base::LogSeverity::DEBUG, LOG_TAG "AppSwitch");
Arthur Hung1a1007b2022-05-11 07:15:01 +000093
94/**
95 * Log debug messages about hover events.
96 * Enable this via "adb shell setprop log.tag.InputDispatcherHover DEBUG" (requires restart)
97 */
98const bool DEBUG_HOVER =
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -070099 android::base::ShouldLog(android::base::LogSeverity::DEBUG, LOG_TAG "Hover");
100
101/**
102 * Crash if a bad stream from InputListener is detected.
103 * Enable this via "adb shell setprop log.tag.InputDispatcherVerifyEvents DEBUG" (requires restart)
104 */
105const bool DEBUG_VERIFY_EVENTS =
106 android::base::ShouldLog(android::base::LogSeverity::DEBUG, LOG_TAG "VerifyEvents");
Prabir Pradhan65613802023-02-22 23:36:58 +0000107
Arthur Hung1a1007b2022-05-11 07:15:01 +0000108} // namespace android::inputdispatcher