Fix flicker issue.
Don't call initFocus() when handling ACTION_UP nudge events as this
event will typically arrive before the TYPE_VIEW_FOCUSED event when we
delegate focusing to a FocusArea and will cause us to focus a nearby
view when we discover that mFocusedNode is no longer focused.
Test: manual
Bug: 169272887
Change-Id: Ic1d6d1b34f676eac9f2fe9d5cfa3c16d8f0a5cab
diff --git a/src/com/android/car/rotary/RotaryService.java b/src/com/android/car/rotary/RotaryService.java
index 9f120a5..01b3060 100644
--- a/src/com/android/car/rotary/RotaryService.java
+++ b/src/com/android/car/rotary/RotaryService.java
@@ -1129,9 +1129,6 @@
if (!isValidAction(action)) {
return;
}
- if (initFocus()) {
- return;
- }
// If the focused node is in direct manipulation mode, manipulate it directly.
if (mInDirectManipulationMode) {
@@ -1149,6 +1146,14 @@
return;
}
+ // Don't call initFocus() when handling ACTION_UP nudge events as this event will typically
+ // arrive before the TYPE_VIEW_FOCUSED event when we delegate focusing to a FocusArea, and
+ // will cause us to focus a nearby view when we discover that mFocusedNode is no longer
+ // focused.
+ if (initFocus()) {
+ return;
+ }
+
// If the focused node is not in direct manipulation mode, try to move the focus to another
// node.
List<AccessibilityWindowInfo> windows = getWindows();