@@ -333,24 +333,18 @@ public void onAccessibilityEvent(AccessibilityEvent event) {
333333
334334 // The event for gesture end should be strictly after the
335335 // last hover exit event.
336- if (mTouchExplorationGestureEnded ) {
337- switch (eventType ) {
338- case AccessibilityEvent .TYPE_VIEW_HOVER_EXIT : {
339- mTouchExplorationGestureEnded = false ;
340- sendAccessibilityEvent (AccessibilityEvent .TYPE_TOUCH_EXPLORATION_GESTURE_END );
341- } break ;
342- }
336+ if (mTouchExplorationGestureEnded
337+ && eventType == AccessibilityEvent .TYPE_VIEW_HOVER_EXIT ) {
338+ mTouchExplorationGestureEnded = false ;
339+ sendAccessibilityEvent (AccessibilityEvent .TYPE_TOUCH_EXPLORATION_GESTURE_END );
343340 }
344341
345342 // The event for touch interaction end should be strictly after the
346343 // last hover exit and the touch exploration gesture end events.
347- if (mTouchInteractionEnded ) {
348- switch (eventType ) {
349- case AccessibilityEvent .TYPE_VIEW_HOVER_EXIT : {
350- mTouchInteractionEnded = false ;
351- sendAccessibilityEvent (AccessibilityEvent .TYPE_TOUCH_INTERACTION_END );
352- } break ;
353- }
344+ if (mTouchInteractionEnded
345+ && eventType == AccessibilityEvent .TYPE_VIEW_HOVER_EXIT ) {
346+ mTouchInteractionEnded = false ;
347+ sendAccessibilityEvent (AccessibilityEvent .TYPE_TOUCH_INTERACTION_END );
354348 }
355349
356350 // If a new window opens or the accessibility focus moves we no longer
@@ -393,9 +387,9 @@ private void handleMotionEventStateTouchExploring(MotionEvent event, int policyF
393387
394388 switch (event .getActionMasked ()) {
395389 case MotionEvent .ACTION_DOWN :
396- // The delayed enter not delivered implies that we have delivered
397- // TYPE_TOUCH_INTERACTION_START and not TYPE_TOUCH_INTERACTION_END,
398- // therefore we need to deliver the interaction end event here.
390+ // The delayed enter not delivered implies that we have delivered
391+ // TYPE_TOUCH_INTERACTION_START and not TYPE_TOUCH_INTERACTION_END,
392+ // therefore we need to deliver the interaction end event here.
399393 if (mSendHoverEnterDelayed .isPending ()) {
400394 sendAccessibilityEvent (AccessibilityEvent .TYPE_TOUCH_INTERACTION_END );
401395 }
@@ -1157,16 +1151,16 @@ public void onDoubleTap(MotionEvent secondTapUp, int policyFlags) {
11571151 }
11581152
11591153 if (Build .IS_DEBUGGABLE ) {
1160- if (mSendHoverEnterDelayed .isPending ()) {
1161- throw new IllegalStateException ("mSendHoverEnterDelayed must not be pending." );
1162- }
1163- if (mSendHoverExitDelayed .isPending ()) {
1164- throw new IllegalStateException ("mSendHoverExitDelayed must not be pending." );
1165- }
1166- if (!mPerformLongPressDelayed .isPending ()) {
1167- throw new IllegalStateException (
1168- "mPerformLongPressDelayed must not be pending." );
1169- }
1154+ if (mSendHoverEnterDelayed .isPending ()) {
1155+ throw new IllegalStateException ("mSendHoverEnterDelayed must not be pending." );
1156+ }
1157+ if (mSendHoverExitDelayed .isPending ()) {
1158+ throw new IllegalStateException ("mSendHoverExitDelayed must not be pending." );
1159+ }
1160+ if (!mPerformLongPressDelayed .isPending ()) {
1161+ throw new IllegalStateException (
1162+ "mPerformLongPressDelayed must not be pending." );
1163+ }
11701164 }
11711165
11721166 // Remove pending event deliveries.
0 commit comments