diff options
| author | 2022-08-04 02:35:48 +0000 | |
|---|---|---|
| committer | 2022-08-04 02:35:48 +0000 | |
| commit | 1cf6d7f4cacfed91900c1af5d1a2872ae04dc8ff (patch) | |
| tree | ea701a691cfb9c93093ab0d3c26e870d97a278d6 /services/inputflinger/UnwantedInteractionBlocker.cpp | |
| parent | 190ac25ebe5907e6c0a6b5309bac34545cc58f6b (diff) | |
| parent | d5fe5185d8b4d1ae017e2a27f8d14c459b880619 (diff) | |
Merge "Dynamic logs for motions in UnwantedInteractionBlocker" into tm-qpr-dev
Diffstat (limited to 'services/inputflinger/UnwantedInteractionBlocker.cpp')
| -rw-r--r-- | services/inputflinger/UnwantedInteractionBlocker.cpp | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/services/inputflinger/UnwantedInteractionBlocker.cpp b/services/inputflinger/UnwantedInteractionBlocker.cpp index fcb7bec1b0..4e0f0c3bf5 100644 --- a/services/inputflinger/UnwantedInteractionBlocker.cpp +++ b/services/inputflinger/UnwantedInteractionBlocker.cpp @@ -39,6 +39,30 @@ using PalmFilterImplementation = ::ui::NeuralStylusPalmDetectionFilter; namespace android { +/** + * Log detailed debug messages about each inbound motion event notification to the blocker. + * Enable this via "adb shell setprop log.tag.UnwantedInteractionBlockerInboundMotion DEBUG" + * (requires restart) + */ +const bool DEBUG_INBOUND_MOTION = + __android_log_is_loggable(ANDROID_LOG_DEBUG, LOG_TAG "InboundMotion", ANDROID_LOG_INFO); + +/** + * Log detailed debug messages about each outbound motion event processed by the blocker. + * Enable this via "adb shell setprop log.tag.UnwantedInteractionBlockerOutboundMotion DEBUG" + * (requires restart) + */ +const bool DEBUG_OUTBOUND_MOTION = + __android_log_is_loggable(ANDROID_LOG_DEBUG, LOG_TAG "OutboundMotion", ANDROID_LOG_INFO); + +/** + * Log the data sent to the model and received back from the model. + * Enable this via "adb shell setprop log.tag.UnwantedInteractionBlockerModel DEBUG" + * (requires restart) + */ +const bool DEBUG_MODEL = + __android_log_is_loggable(ANDROID_LOG_DEBUG, LOG_TAG "Model", ANDROID_LOG_INFO); + // Category (=namespace) name for the input settings that are applied at boot time static const char* INPUT_NATIVE_BOOT = "input_native_boot"; /** @@ -309,6 +333,7 @@ void UnwantedInteractionBlocker::notifyKey(const NotifyKeyArgs* args) { } void UnwantedInteractionBlocker::notifyMotion(const NotifyMotionArgs* args) { + ALOGD_IF(DEBUG_INBOUND_MOTION, "%s: %s", __func__, args->dump().c_str()); { // acquire lock std::scoped_lock lock(mLock); const std::vector<NotifyMotionArgs> processedArgs = @@ -322,17 +347,22 @@ void UnwantedInteractionBlocker::notifyMotion(const NotifyMotionArgs* args) { mQueuedListener.flush(); } +void UnwantedInteractionBlocker::enqueueOutboundMotionLocked(const NotifyMotionArgs& args) { + ALOGD_IF(DEBUG_OUTBOUND_MOTION, "%s: %s", __func__, args.dump().c_str()); + mQueuedListener.notifyMotion(&args); +} + void UnwantedInteractionBlocker::notifyMotionLocked(const NotifyMotionArgs* args) { auto it = mPalmRejectors.find(args->deviceId); const bool sendToPalmRejector = it != mPalmRejectors.end() && isFromTouchscreen(args->source); if (!sendToPalmRejector) { - mQueuedListener.notifyMotion(args); + enqueueOutboundMotionLocked(*args); return; } std::vector<NotifyMotionArgs> processedArgs = it->second.processMotion(*args); for (const NotifyMotionArgs& loopArgs : processedArgs) { - mQueuedListener.notifyMotion(&loopArgs); + enqueueOutboundMotionLocked(loopArgs); } } @@ -616,8 +646,18 @@ std::vector<NotifyMotionArgs> PalmRejector::processMotion(const NotifyMotionArgs getTouches(args, mDeviceInfo, oldSlotState, mSlotState); ::base::TimeTicks chromeTimestamp = toChromeTimestamp(args.eventTime); + if (DEBUG_MODEL) { + std::stringstream touchesStream; + for (const ::ui::InProgressTouchEvdev& touch : touches) { + touchesStream << touch.tracking_id << " : " << touch << "\n"; + } + ALOGD("Filter: touches = %s", touchesStream.str().c_str()); + } mPalmDetectionFilter->Filter(touches, chromeTimestamp, &slotsToHold, &slotsToSuppress); + ALOGD_IF(DEBUG_MODEL, "Response: slotsToHold = %s, slotsToSuppress = %s", + slotsToHold.to_string().c_str(), slotsToSuppress.to_string().c_str()); + // Now that we know which slots should be suppressed, let's convert those to pointer id's. std::set<int32_t> oldSuppressedIds; std::swap(oldSuppressedIds, mSuppressedPointerIds); |