@@ -643,6 +643,10 @@ int getActiveWindowId() {
643643 return mSecurityPolicy .mActiveWindowId ;
644644 }
645645
646+ void onTouchInteractionStart () {
647+ mSecurityPolicy .onTouchInteractionStart ();
648+ }
649+
646650 void onTouchInteractionEnd () {
647651 mSecurityPolicy .onTouchInteractionEnd ();
648652 }
@@ -2138,6 +2142,7 @@ final class SecurityPolicy {
21382142 | AccessibilityEvent .TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED ;
21392143
21402144 private int mActiveWindowId ;
2145+ private boolean mTouchInteractionInProgress ;
21412146
21422147 private boolean canDispatchAccessibilityEvent (AccessibilityEvent event ) {
21432148 final int eventType = event .getEventType ();
@@ -2185,12 +2190,21 @@ public void updateActiveWindow(int windowId, int eventType) {
21852190 }
21862191 } break ;
21872192 case AccessibilityEvent .TYPE_VIEW_HOVER_ENTER : {
2188- mActiveWindowId = windowId ;
2193+ // Do not allow delayed hover events to confuse us
2194+ // which the active window is.
2195+ if (mTouchInteractionInProgress ) {
2196+ mActiveWindowId = windowId ;
2197+ }
21892198 } break ;
21902199 }
21912200 }
21922201
2202+ public void onTouchInteractionStart () {
2203+ mTouchInteractionInProgress = true ;
2204+ }
2205+
21932206 public void onTouchInteractionEnd () {
2207+ mTouchInteractionInProgress = false ;
21942208 // We want to set the active window to be current immediately
21952209 // after the user has stopped touching the screen since if the
21962210 // user types with the IME he should get a feedback for the
0 commit comments