@@ -384,9 +384,11 @@ public void binderDied() {
384384 }
385385
386386 public boolean sendAccessibilityEvent (AccessibilityEvent event ) {
387+ final int eventType = event .getEventType ();
388+
387389 // The event for gesture start should be strictly before the
388390 // first hover enter event for the gesture.
389- if (event . getEventType () == AccessibilityEvent .TYPE_VIEW_HOVER_ENTER
391+ if (eventType == AccessibilityEvent .TYPE_VIEW_HOVER_ENTER
390392 && mTouchExplorationGestureStarted ) {
391393 mTouchExplorationGestureStarted = false ;
392394 AccessibilityEvent gestureStartEvent = AccessibilityEvent .obtain (
@@ -400,21 +402,21 @@ public boolean sendAccessibilityEvent(AccessibilityEvent event) {
400402 notifyAccessibilityServicesDelayedLocked (event , false );
401403 notifyAccessibilityServicesDelayedLocked (event , true );
402404 }
405+
406+ event .recycle ();
407+ mHandledFeedbackTypes = 0 ;
403408 }
404409
405410 // The event for gesture end should be strictly after the
406411 // last hover exit event for the gesture.
407- if (event . getEventType () == AccessibilityEvent .TYPE_VIEW_HOVER_EXIT
412+ if (eventType == AccessibilityEvent .TYPE_VIEW_HOVER_EXIT
408413 && mTouchExplorationGestureEnded ) {
409414 mTouchExplorationGestureEnded = false ;
410415 AccessibilityEvent gestureEndEvent = AccessibilityEvent .obtain (
411416 AccessibilityEvent .TYPE_TOUCH_EXPLORATION_GESTURE_END );
412417 sendAccessibilityEvent (gestureEndEvent );
413418 }
414419
415- event .recycle ();
416- mHandledFeedbackTypes = 0 ;
417-
418420 return (OWN_PROCESS_ID != Binder .getCallingPid ());
419421 }
420422
0 commit comments