| 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 |  | 
| Siarhei Vishniakou | 5c02a71 | 2023-05-15 15:45:02 -0700 | [diff] [blame] | 21 | #include <android-base/logging.h> | 
| Siarhei Vishniakou | 9681896 | 2023-08-23 10:19:02 -0700 | [diff] [blame] | 22 | #include <com_android_input_flags.h> | 
|  | 23 |  | 
|  | 24 | namespace input_flags = com::android::input::flags; | 
| Arthur Hung | 1a1007b | 2022-05-11 07:15:01 +0000 | [diff] [blame] | 25 |  | 
|  | 26 | namespace android::inputdispatcher { | 
| Prabir Pradhan | 6561380 | 2023-02-22 23:36:58 +0000 | [diff] [blame] | 27 |  | 
|  | 28 | /** | 
|  | 29 | * Signals whether this is a debuggable Android build. | 
|  | 30 | * This is populated by reading the value of the "ro.debuggable" property. | 
|  | 31 | */ | 
|  | 32 | extern const bool IS_DEBUGGABLE_BUILD; | 
|  | 33 |  | 
| Arthur Hung | 1a1007b | 2022-05-11 07:15:01 +0000 | [diff] [blame] | 34 | /** | 
|  | 35 | * Log detailed debug messages about each inbound event notification to the dispatcher. | 
| Prabir Pradhan | 6561380 | 2023-02-22 23:36:58 +0000 | [diff] [blame] | 36 | * Enable this via "adb shell setprop log.tag.InputDispatcherInboundEvent DEBUG". | 
|  | 37 | * This requires a restart on non-debuggable (e.g. user) builds, but should take effect immediately | 
|  | 38 | * on debuggable builds (e.g. userdebug). | 
| Arthur Hung | 1a1007b | 2022-05-11 07:15:01 +0000 | [diff] [blame] | 39 | */ | 
| Prabir Pradhan | 6561380 | 2023-02-22 23:36:58 +0000 | [diff] [blame] | 40 | bool debugInboundEventDetails(); | 
| Arthur Hung | 1a1007b | 2022-05-11 07:15:01 +0000 | [diff] [blame] | 41 |  | 
|  | 42 | /** | 
|  | 43 | * Log detailed debug messages about each outbound event processed by the dispatcher. | 
|  | 44 | * Enable this via "adb shell setprop log.tag.InputDispatcherOutboundEvent DEBUG" (requires restart) | 
|  | 45 | */ | 
|  | 46 | const bool DEBUG_OUTBOUND_EVENT_DETAILS = | 
| Siarhei Vishniakou | 5c02a71 | 2023-05-15 15:45:02 -0700 | [diff] [blame] | 47 | android::base::ShouldLog(android::base::LogSeverity::DEBUG, LOG_TAG "OutboundEvent"); | 
| Arthur Hung | 1a1007b | 2022-05-11 07:15:01 +0000 | [diff] [blame] | 48 |  | 
|  | 49 | /** | 
|  | 50 | * Log debug messages about the dispatch cycle. | 
|  | 51 | * Enable this via "adb shell setprop log.tag.InputDispatcherDispatchCycle DEBUG" (requires restart) | 
|  | 52 | */ | 
|  | 53 | const bool DEBUG_DISPATCH_CYCLE = | 
| Siarhei Vishniakou | 5c02a71 | 2023-05-15 15:45:02 -0700 | [diff] [blame] | 54 | android::base::ShouldLog(android::base::LogSeverity::DEBUG, LOG_TAG "DispatchCycle"); | 
| Arthur Hung | 1a1007b | 2022-05-11 07:15:01 +0000 | [diff] [blame] | 55 |  | 
|  | 56 | /** | 
|  | 57 | * Log debug messages about channel creation | 
|  | 58 | * Enable this via "adb shell setprop log.tag.InputDispatcherChannelCreation DEBUG" (requires | 
|  | 59 | * restart) | 
|  | 60 | */ | 
|  | 61 | const bool DEBUG_CHANNEL_CREATION = | 
| Siarhei Vishniakou | 5c02a71 | 2023-05-15 15:45:02 -0700 | [diff] [blame] | 62 | android::base::ShouldLog(android::base::LogSeverity::DEBUG, LOG_TAG "ChannelCreation"); | 
| Arthur Hung | 1a1007b | 2022-05-11 07:15:01 +0000 | [diff] [blame] | 63 |  | 
|  | 64 | /** | 
|  | 65 | * Log debug messages about input event injection. | 
|  | 66 | * Enable this via "adb shell setprop log.tag.InputDispatcherInjection DEBUG" (requires restart) | 
|  | 67 | */ | 
|  | 68 | const bool DEBUG_INJECTION = | 
| Siarhei Vishniakou | 5c02a71 | 2023-05-15 15:45:02 -0700 | [diff] [blame] | 69 | android::base::ShouldLog(android::base::LogSeverity::DEBUG, LOG_TAG "Injection"); | 
| Arthur Hung | 1a1007b | 2022-05-11 07:15:01 +0000 | [diff] [blame] | 70 |  | 
|  | 71 | /** | 
| Siarhei Vishniakou | 31dd155 | 2023-10-30 18:46:10 -0700 | [diff] [blame] | 72 | * Generally, we always log whenever events are dropped. However, to reduce logspam, some messages | 
|  | 73 | * are suppressed. | 
|  | 74 | * Log additional debug messages about dropped input events with this flag. | 
|  | 75 | * Enable this via "adb shell setprop log.tag.InputDispatcherDroppedEventsVerbose DEBUG". | 
|  | 76 | * Requires system_server restart via `adb shell stop && adb shell start`. | 
|  | 77 | */ | 
|  | 78 | const bool DEBUG_DROPPED_EVENTS_VERBOSE = | 
|  | 79 | android::base::ShouldLog(android::base::LogSeverity::DEBUG, LOG_TAG "DroppedEventsVerbose"); | 
|  | 80 |  | 
|  | 81 | /** | 
| Arthur Hung | 1a1007b | 2022-05-11 07:15:01 +0000 | [diff] [blame] | 82 | * Log debug messages about input focus tracking. | 
|  | 83 | * Enable this via "adb shell setprop log.tag.InputDispatcherFocus DEBUG" (requires restart) | 
|  | 84 | */ | 
|  | 85 | const bool DEBUG_FOCUS = | 
| Siarhei Vishniakou | 5c02a71 | 2023-05-15 15:45:02 -0700 | [diff] [blame] | 86 | android::base::ShouldLog(android::base::LogSeverity::DEBUG, LOG_TAG "Focus"); | 
| Arthur Hung | 1a1007b | 2022-05-11 07:15:01 +0000 | [diff] [blame] | 87 |  | 
|  | 88 | /** | 
|  | 89 | * Log debug messages about touch mode event | 
|  | 90 | * Enable this via "adb shell setprop log.tag.InputDispatcherTouchMode DEBUG" (requires restart) | 
|  | 91 | */ | 
|  | 92 | const bool DEBUG_TOUCH_MODE = | 
| Siarhei Vishniakou | 5c02a71 | 2023-05-15 15:45:02 -0700 | [diff] [blame] | 93 | android::base::ShouldLog(android::base::LogSeverity::DEBUG, LOG_TAG "TouchMode"); | 
| Arthur Hung | 1a1007b | 2022-05-11 07:15:01 +0000 | [diff] [blame] | 94 |  | 
|  | 95 | /** | 
|  | 96 | * Log debug messages about touch occlusion | 
| Arthur Hung | 1a1007b | 2022-05-11 07:15:01 +0000 | [diff] [blame] | 97 | */ | 
| Siarhei Vishniakou | 076dc75 | 2022-09-12 15:07:16 +0000 | [diff] [blame] | 98 | constexpr bool DEBUG_TOUCH_OCCLUSION = true; | 
| Arthur Hung | 1a1007b | 2022-05-11 07:15:01 +0000 | [diff] [blame] | 99 |  | 
|  | 100 | /** | 
|  | 101 | * Log debug messages about the app switch latency optimization. | 
|  | 102 | * Enable this via "adb shell setprop log.tag.InputDispatcherAppSwitch DEBUG" (requires restart) | 
|  | 103 | */ | 
|  | 104 | const bool DEBUG_APP_SWITCH = | 
| Siarhei Vishniakou | 5c02a71 | 2023-05-15 15:45:02 -0700 | [diff] [blame] | 105 | android::base::ShouldLog(android::base::LogSeverity::DEBUG, LOG_TAG "AppSwitch"); | 
| Arthur Hung | 1a1007b | 2022-05-11 07:15:01 +0000 | [diff] [blame] | 106 |  | 
|  | 107 | /** | 
|  | 108 | * Log debug messages about hover events. | 
|  | 109 | * Enable this via "adb shell setprop log.tag.InputDispatcherHover DEBUG" (requires restart) | 
|  | 110 | */ | 
|  | 111 | const bool DEBUG_HOVER = | 
| Siarhei Vishniakou | 5c02a71 | 2023-05-15 15:45:02 -0700 | [diff] [blame] | 112 | android::base::ShouldLog(android::base::LogSeverity::DEBUG, LOG_TAG "Hover"); | 
|  | 113 |  | 
|  | 114 | /** | 
|  | 115 | * Crash if a bad stream from InputListener is detected. | 
|  | 116 | * Enable this via "adb shell setprop log.tag.InputDispatcherVerifyEvents DEBUG" (requires restart) | 
|  | 117 | */ | 
| Siarhei Vishniakou | 9681896 | 2023-08-23 10:19:02 -0700 | [diff] [blame] | 118 | const bool DEBUG_VERIFY_EVENTS = input_flags::enable_inbound_event_verification() || | 
| Siarhei Vishniakou | 5c02a71 | 2023-05-15 15:45:02 -0700 | [diff] [blame] | 119 | android::base::ShouldLog(android::base::LogSeverity::DEBUG, LOG_TAG "VerifyEvents"); | 
| Prabir Pradhan | 6561380 | 2023-02-22 23:36:58 +0000 | [diff] [blame] | 120 |  | 
| Arthur Hung | 1a1007b | 2022-05-11 07:15:01 +0000 | [diff] [blame] | 121 | } // namespace android::inputdispatcher |