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
This commit is contained in:
Brandon Dayauon
2024-12-11 16:53:16 -08:00
parent 9632253a4a
commit 1fb2d7815f
@@ -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) {