diff options
author | 2025-03-12 21:48:32 +0000 | |
---|---|---|
committer | 2025-03-22 00:06:07 +0000 | |
commit | f3f9d84f31155b419059b38c5e3fefc90537804b (patch) | |
tree | 9e5b0d7582ba7bbabfb809a5213e85862c83b100 | |
parent | 2506c1c9e8ea48635dd79e9bf71aa016ac51ef91 (diff) |
a11y: Refactor click canceling
This refactor makes all instances where a scheduled click should be
canceled call the same logic.
Bug: b/388847769
Test: AutoclickControllerTest
Flag: com.android.server.accessibility.enable_autoclick_indicator
Change-Id: I5885cf556883c278df646aef6f9141cb7cd96f0f
-rw-r--r-- | services/accessibility/java/com/android/server/accessibility/autoclick/AutoclickController.java | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/services/accessibility/java/com/android/server/accessibility/autoclick/AutoclickController.java b/services/accessibility/java/com/android/server/accessibility/autoclick/AutoclickController.java index 99febd6de60f..74397236847a 100644 --- a/services/accessibility/java/com/android/server/accessibility/autoclick/AutoclickController.java +++ b/services/accessibility/java/com/android/server/accessibility/autoclick/AutoclickController.java @@ -207,8 +207,8 @@ public class AutoclickController extends BaseEventStreamTransformation { if (!isPaused()) { handleMouseMotion(event, policyFlags); } - } else if (mClickScheduler != null) { - mClickScheduler.cancel(); + } else { + cancelPendingClick(); } super.onMotionEvent(event, rawEvent, policyFlags); @@ -238,7 +238,7 @@ public class AutoclickController extends BaseEventStreamTransformation { if (KeyEvent.isModifierKey(event.getKeyCode())) { mClickScheduler.updateMetaState(event.getMetaState()); } else { - mClickScheduler.cancel(); + cancelPendingClick(); } } @@ -247,8 +247,8 @@ public class AutoclickController extends BaseEventStreamTransformation { @Override public void clearEvents(int inputSource) { - if (inputSource == InputDevice.SOURCE_MOUSE && mClickScheduler != null) { - mClickScheduler.cancel(); + if (inputSource == InputDevice.SOURCE_MOUSE) { + cancelPendingClick(); } if (mAutoclickScrollPanel != null) { @@ -288,7 +288,7 @@ public class AutoclickController extends BaseEventStreamTransformation { if (event.getPointerCount() == 1) { mClickScheduler.update(event, policyFlags); } else { - mClickScheduler.cancel(); + cancelPendingClick(); } } break; // Ignore hover enter and exit. @@ -296,7 +296,7 @@ public class AutoclickController extends BaseEventStreamTransformation { case MotionEvent.ACTION_HOVER_EXIT: break; default: - mClickScheduler.cancel(); + cancelPendingClick(); } } |