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
diff --git a/quickstep/src/com/android/launcher3/QuickstepAccessibilityDelegate.java b/quickstep/src/com/android/launcher3/QuickstepAccessibilityDelegate.java
index 1161720..08ef8fe 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 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) {