From 1fb2d7815fe73c84d422a32cfd6e819f604d2049 Mon Sep 17 00:00:00 2001 From: Brandon Dayauon Date: Wed, 11 Dec 2024 16:53:16 -0800 Subject: [PATCH] Fix unintended scroll in all apps when using external mouse. The reason is because when ag/29152694 was introduced, the accessibilityEvent that would trigger is TYPE_VIEW_HOVER_ENTER that would eventually always have the list scrolling depending on where the mouse would be. Gating it to TYPE_VIEW_ACCESSIBILITY_FOCUSED would be fix this as this should still work for talkback when traversing the A-Z list as TYPE_VIEW_ACCESSIBILITY_FOCUSED is whats is always used during this case. bug: 372965379 Test: manually Flag: EXEMPT bug fix Change-Id: I249cee8036216f93aab53efc3d77fad047f7e408 --- .../android/launcher3/QuickstepAccessibilityDelegate.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/launcher3/QuickstepAccessibilityDelegate.java b/quickstep/src/com/android/launcher3/QuickstepAccessibilityDelegate.java index 1161720e3b..08ef8fe219 100644 --- a/quickstep/src/com/android/launcher3/QuickstepAccessibilityDelegate.java +++ b/quickstep/src/com/android/launcher3/QuickstepAccessibilityDelegate.java @@ -15,6 +15,8 @@ */ package com.android.launcher3; +import static android.view.accessibility.AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED; + import static androidx.recyclerview.widget.RecyclerView.NO_POSITION; import android.view.KeyEvent; @@ -48,7 +50,11 @@ public class QuickstepAccessibilityDelegate extends LauncherAccessibilityDelegat public void onPopulateAccessibilityEvent(View view, AccessibilityEvent event) { super.onPopulateAccessibilityEvent(view, event); // Scroll to the position if focused view in main allapps list and not completely visible. - scrollToPositionIfNeeded(view); + // Gate based on TYPE_VIEW_ACCESSIBILITY_FOCUSED for unintended scrolling with external + // mouse. + if (event.getEventType() == TYPE_VIEW_ACCESSIBILITY_FOCUSED) { + scrollToPositionIfNeeded(view); + } } private void scrollToPositionIfNeeded(View view) {