Loading services/inputflinger/reader/Android.bp +2 −1 Original line number Diff line number Diff line Loading @@ -66,9 +66,10 @@ filegroup { "mapper/accumulator/SingleTouchMotionAccumulator.cpp", "mapper/accumulator/TouchButtonAccumulator.cpp", "mapper/gestures/GestureConverter.cpp", "mapper/gestures/GesturesLogging.cpp", "mapper/gestures/GesturesLogcatAdapter.cpp", "mapper/gestures/HardwareProperties.cpp", "mapper/gestures/HardwareStateConverter.cpp", "mapper/gestures/Logging.cpp", "mapper/gestures/PropertyProvider.cpp", "mapper/gestures/TimerProvider.cpp", ], Loading services/inputflinger/reader/mapper/TouchpadInputMapper.cpp +3 −11 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ #include "TouchCursorInputMapperCommon.h" #include "TouchpadInputMapper.h" #include "gestures/HardwareProperties.h" #include "gestures/Logging.h" #include "gestures/TimerProvider.h" #include "ui/Rotation.h" Loading @@ -49,15 +50,6 @@ namespace android { 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); std::vector<double> createAccelerationCurveForSensitivity(int32_t sensitivity, bool accelerationEnabled, size_t propertySize) { Loading Loading @@ -470,7 +462,7 @@ void TouchpadInputMapper::updatePalmDetectionMetrics() { std::list<NotifyArgs> TouchpadInputMapper::sendHardwareState(nsecs_t when, nsecs_t readTime, SelfContainedHardwareState schs) { ALOGD_IF(DEBUG_TOUCHPAD_GESTURES, "New hardware state: %s", schs.state.String().c_str()); ALOGD_IF(debugTouchpadGestures(), "New hardware state: %s", schs.state.String().c_str()); mGestureInterpreter->PushHardwareState(&schs.state); return processGestures(when, readTime); } Loading @@ -481,7 +473,7 @@ std::list<NotifyArgs> TouchpadInputMapper::timeoutExpired(nsecs_t when) { } void TouchpadInputMapper::consumeGesture(const Gesture* gesture) { ALOGD_IF(DEBUG_TOUCHPAD_GESTURES, "Gesture ready: %s", gesture->String().c_str()); ALOGD_IF(debugTouchpadGestures(), "Gesture ready: %s", gesture->String().c_str()); if (mResettingInterpreter) { // We already handle tidying up fake fingers etc. in GestureConverter::reset, so we should // ignore any gestures produced from the interpreter while we're resetting it. Loading services/inputflinger/reader/mapper/gestures/GesturesLogging.cpp→services/inputflinger/reader/mapper/gestures/GesturesLogcatAdapter.cpp +2 −14 Original line number Diff line number Diff line Loading @@ -22,29 +22,17 @@ #include <log/log.h> #include "Logging.h" #include "include/gestures.h" 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 (DEBUG_TOUCHPAD_GESTURES) { } else if (android::debugTouchpadGestures()) { if (verb == GESTURES_LOG_INFO) { LOG_PRI_VA(ANDROID_LOG_INFO, LOG_TAG, fmt, args); } else { Loading services/inputflinger/reader/mapper/gestures/Logging.cpp 0 → 100644 +46 −0 Original line number Diff line number Diff line /* * Copyright 2025 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "Logging.h" #include <android-base/properties.h> #include <log/log.h> namespace { const bool IS_DEBUGGABLE_BUILD = #if defined(__ANDROID__) android::base::GetBoolProperty("ro.debuggable", false); #else true; #endif } // namespace namespace android { bool debugTouchpadGestures() { if (!IS_DEBUGGABLE_BUILD) { static const bool DEBUG_RAW_EVENTS = __android_log_is_loggable(ANDROID_LOG_DEBUG, "TouchpadInputMapperGestures", ANDROID_LOG_INFO); return DEBUG_RAW_EVENTS; } return __android_log_is_loggable(ANDROID_LOG_DEBUG, "TouchpadInputMapperGestures", ANDROID_LOG_INFO); } } // namespace android No newline at end of file services/inputflinger/reader/mapper/gestures/Logging.h 0 → 100644 +29 −0 Original line number Diff line number Diff line /* * Copyright 2025 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once namespace android { /** * Log details of touchpad gesture library input, output, and processing. * Enable this via "adb shell setprop log.tag.TouchpadInputMapperGestures DEBUG". * This requires a restart on non-debuggable (e.g. user) builds, but should take effect immediately * on debuggable builds (e.g. userdebug). */ bool debugTouchpadGestures(); } // namespace android No newline at end of file Loading
services/inputflinger/reader/Android.bp +2 −1 Original line number Diff line number Diff line Loading @@ -66,9 +66,10 @@ filegroup { "mapper/accumulator/SingleTouchMotionAccumulator.cpp", "mapper/accumulator/TouchButtonAccumulator.cpp", "mapper/gestures/GestureConverter.cpp", "mapper/gestures/GesturesLogging.cpp", "mapper/gestures/GesturesLogcatAdapter.cpp", "mapper/gestures/HardwareProperties.cpp", "mapper/gestures/HardwareStateConverter.cpp", "mapper/gestures/Logging.cpp", "mapper/gestures/PropertyProvider.cpp", "mapper/gestures/TimerProvider.cpp", ], Loading
services/inputflinger/reader/mapper/TouchpadInputMapper.cpp +3 −11 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ #include "TouchCursorInputMapperCommon.h" #include "TouchpadInputMapper.h" #include "gestures/HardwareProperties.h" #include "gestures/Logging.h" #include "gestures/TimerProvider.h" #include "ui/Rotation.h" Loading @@ -49,15 +50,6 @@ namespace android { 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); std::vector<double> createAccelerationCurveForSensitivity(int32_t sensitivity, bool accelerationEnabled, size_t propertySize) { Loading Loading @@ -470,7 +462,7 @@ void TouchpadInputMapper::updatePalmDetectionMetrics() { std::list<NotifyArgs> TouchpadInputMapper::sendHardwareState(nsecs_t when, nsecs_t readTime, SelfContainedHardwareState schs) { ALOGD_IF(DEBUG_TOUCHPAD_GESTURES, "New hardware state: %s", schs.state.String().c_str()); ALOGD_IF(debugTouchpadGestures(), "New hardware state: %s", schs.state.String().c_str()); mGestureInterpreter->PushHardwareState(&schs.state); return processGestures(when, readTime); } Loading @@ -481,7 +473,7 @@ std::list<NotifyArgs> TouchpadInputMapper::timeoutExpired(nsecs_t when) { } void TouchpadInputMapper::consumeGesture(const Gesture* gesture) { ALOGD_IF(DEBUG_TOUCHPAD_GESTURES, "Gesture ready: %s", gesture->String().c_str()); ALOGD_IF(debugTouchpadGestures(), "Gesture ready: %s", gesture->String().c_str()); if (mResettingInterpreter) { // We already handle tidying up fake fingers etc. in GestureConverter::reset, so we should // ignore any gestures produced from the interpreter while we're resetting it. Loading
services/inputflinger/reader/mapper/gestures/GesturesLogging.cpp→services/inputflinger/reader/mapper/gestures/GesturesLogcatAdapter.cpp +2 −14 Original line number Diff line number Diff line Loading @@ -22,29 +22,17 @@ #include <log/log.h> #include "Logging.h" #include "include/gestures.h" 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 (DEBUG_TOUCHPAD_GESTURES) { } else if (android::debugTouchpadGestures()) { if (verb == GESTURES_LOG_INFO) { LOG_PRI_VA(ANDROID_LOG_INFO, LOG_TAG, fmt, args); } else { Loading
services/inputflinger/reader/mapper/gestures/Logging.cpp 0 → 100644 +46 −0 Original line number Diff line number Diff line /* * Copyright 2025 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "Logging.h" #include <android-base/properties.h> #include <log/log.h> namespace { const bool IS_DEBUGGABLE_BUILD = #if defined(__ANDROID__) android::base::GetBoolProperty("ro.debuggable", false); #else true; #endif } // namespace namespace android { bool debugTouchpadGestures() { if (!IS_DEBUGGABLE_BUILD) { static const bool DEBUG_RAW_EVENTS = __android_log_is_loggable(ANDROID_LOG_DEBUG, "TouchpadInputMapperGestures", ANDROID_LOG_INFO); return DEBUG_RAW_EVENTS; } return __android_log_is_loggable(ANDROID_LOG_DEBUG, "TouchpadInputMapperGestures", ANDROID_LOG_INFO); } } // namespace android No newline at end of file
services/inputflinger/reader/mapper/gestures/Logging.h 0 → 100644 +29 −0 Original line number Diff line number Diff line /* * Copyright 2025 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once namespace android { /** * Log details of touchpad gesture library input, output, and processing. * Enable this via "adb shell setprop log.tag.TouchpadInputMapperGestures DEBUG". * This requires a restart on non-debuggable (e.g. user) builds, but should take effect immediately * on debuggable builds (e.g. userdebug). */ bool debugTouchpadGestures(); } // namespace android No newline at end of file