Arthur Hung | 1a1007b | 2022-05-11 07:15:01 +0000 | [diff] [blame] | 1 | /* |
| 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 Pradhan | 4810866 | 2022-09-09 21:22:04 +0000 | [diff] [blame] | 17 | #pragma once |
Arthur Hung | 1a1007b | 2022-05-11 07:15:01 +0000 | [diff] [blame] | 18 | |
| 19 | #define LOG_TAG "InputDispatcher" |
| 20 | |
| 21 | #include <log/log.h> |
| 22 | #include <log/log_event_list.h> |
| 23 | |
| 24 | namespace android::inputdispatcher { |
Prabir Pradhan | 6561380 | 2023-02-22 23:36:58 +0000 | [diff] [blame] | 25 | |
| 26 | /** |
| 27 | * Signals whether this is a debuggable Android build. |
| 28 | * This is populated by reading the value of the "ro.debuggable" property. |
| 29 | */ |
| 30 | extern const bool IS_DEBUGGABLE_BUILD; |
| 31 | |
Arthur Hung | 1a1007b | 2022-05-11 07:15:01 +0000 | [diff] [blame] | 32 | /** |
| 33 | * Log detailed debug messages about each inbound event notification to the dispatcher. |
Prabir Pradhan | 6561380 | 2023-02-22 23:36:58 +0000 | [diff] [blame] | 34 | * Enable this via "adb shell setprop log.tag.InputDispatcherInboundEvent DEBUG". |
| 35 | * This requires a restart on non-debuggable (e.g. user) builds, but should take effect immediately |
| 36 | * on debuggable builds (e.g. userdebug). |
Arthur Hung | 1a1007b | 2022-05-11 07:15:01 +0000 | [diff] [blame] | 37 | */ |
Prabir Pradhan | 6561380 | 2023-02-22 23:36:58 +0000 | [diff] [blame] | 38 | bool debugInboundEventDetails(); |
Arthur Hung | 1a1007b | 2022-05-11 07:15:01 +0000 | [diff] [blame] | 39 | |
| 40 | /** |
| 41 | * Log detailed debug messages about each outbound event processed by the dispatcher. |
| 42 | * Enable this via "adb shell setprop log.tag.InputDispatcherOutboundEvent DEBUG" (requires restart) |
| 43 | */ |
| 44 | const bool DEBUG_OUTBOUND_EVENT_DETAILS = |
| 45 | __android_log_is_loggable(ANDROID_LOG_DEBUG, LOG_TAG "OutboundEvent", ANDROID_LOG_INFO); |
| 46 | |
| 47 | /** |
| 48 | * Log debug messages about the dispatch cycle. |
| 49 | * Enable this via "adb shell setprop log.tag.InputDispatcherDispatchCycle DEBUG" (requires restart) |
| 50 | */ |
| 51 | const bool DEBUG_DISPATCH_CYCLE = |
| 52 | __android_log_is_loggable(ANDROID_LOG_DEBUG, LOG_TAG "DispatchCycle", ANDROID_LOG_INFO); |
| 53 | |
| 54 | /** |
| 55 | * Log debug messages about channel creation |
| 56 | * Enable this via "adb shell setprop log.tag.InputDispatcherChannelCreation DEBUG" (requires |
| 57 | * restart) |
| 58 | */ |
| 59 | const bool DEBUG_CHANNEL_CREATION = |
| 60 | __android_log_is_loggable(ANDROID_LOG_DEBUG, LOG_TAG "ChannelCreation", ANDROID_LOG_INFO); |
| 61 | |
| 62 | /** |
| 63 | * Log debug messages about input event injection. |
| 64 | * Enable this via "adb shell setprop log.tag.InputDispatcherInjection DEBUG" (requires restart) |
| 65 | */ |
| 66 | const bool DEBUG_INJECTION = |
| 67 | __android_log_is_loggable(ANDROID_LOG_DEBUG, LOG_TAG "Injection", ANDROID_LOG_INFO); |
| 68 | |
| 69 | /** |
| 70 | * Log debug messages about input focus tracking. |
| 71 | * Enable this via "adb shell setprop log.tag.InputDispatcherFocus DEBUG" (requires restart) |
| 72 | */ |
| 73 | const bool DEBUG_FOCUS = |
| 74 | __android_log_is_loggable(ANDROID_LOG_DEBUG, LOG_TAG "Focus", ANDROID_LOG_INFO); |
| 75 | |
| 76 | /** |
| 77 | * Log debug messages about touch mode event |
| 78 | * Enable this via "adb shell setprop log.tag.InputDispatcherTouchMode DEBUG" (requires restart) |
| 79 | */ |
| 80 | const bool DEBUG_TOUCH_MODE = |
| 81 | __android_log_is_loggable(ANDROID_LOG_DEBUG, LOG_TAG "TouchMode", ANDROID_LOG_INFO); |
| 82 | |
| 83 | /** |
| 84 | * Log debug messages about touch occlusion |
Arthur Hung | 1a1007b | 2022-05-11 07:15:01 +0000 | [diff] [blame] | 85 | */ |
Siarhei Vishniakou | 076dc75 | 2022-09-12 15:07:16 +0000 | [diff] [blame] | 86 | constexpr bool DEBUG_TOUCH_OCCLUSION = true; |
Arthur Hung | 1a1007b | 2022-05-11 07:15:01 +0000 | [diff] [blame] | 87 | |
| 88 | /** |
| 89 | * Log debug messages about the app switch latency optimization. |
| 90 | * Enable this via "adb shell setprop log.tag.InputDispatcherAppSwitch DEBUG" (requires restart) |
| 91 | */ |
| 92 | const bool DEBUG_APP_SWITCH = |
| 93 | __android_log_is_loggable(ANDROID_LOG_DEBUG, LOG_TAG "AppSwitch", ANDROID_LOG_INFO); |
| 94 | |
| 95 | /** |
| 96 | * Log debug messages about hover events. |
| 97 | * Enable this via "adb shell setprop log.tag.InputDispatcherHover DEBUG" (requires restart) |
| 98 | */ |
| 99 | const bool DEBUG_HOVER = |
| 100 | __android_log_is_loggable(ANDROID_LOG_DEBUG, LOG_TAG "Hover", ANDROID_LOG_INFO); |
Prabir Pradhan | 6561380 | 2023-02-22 23:36:58 +0000 | [diff] [blame] | 101 | |
Arthur Hung | 1a1007b | 2022-05-11 07:15:01 +0000 | [diff] [blame] | 102 | } // namespace android::inputdispatcher |