am 6e52f164: am 655be140: Merge "When Accessibility is on, intercept touch events during dispatch." into jb-mr1-dev

* commit '6e52f164e6c7f5ed4f374d79b45a5665ee3d263b':
  When Accessibility is on, intercept touch events during dispatch.
main
Charles Chen 2012-09-12 15:15:06 -07:00 committed by Android Git Automerger
commit 93e97d1bc8
2 changed files with 13 additions and 8 deletions

View File

@ -105,15 +105,15 @@ public class AccessibleKeyboardViewProxy extends AccessibilityDelegateCompat {
} }
/** /**
* Receives motion events when touch exploration is turned on in SDK * Intercepts touch events before dispatch when touch exploration is turned
* versions ICS and higher. * on in ICS and higher.
* *
* @param event The motion event. * @param event The motion event being dispatched.
* @return {@code true} if the event is handled * @return {@code true} if the event is handled
*/ */
public boolean onTouchEvent(MotionEvent event) { public boolean dispatchTouchEvent(MotionEvent event) {
// To avoid accidental key presses during touch exploration, always drop // To avoid accidental key presses during touch exploration, always drop
// non-hover touch events. // touch events generated by the user.
return false; return false;
} }

View File

@ -660,14 +660,19 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
return mOldPointerCount; return mOldPointerCount;
} }
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
if (AccessibilityUtils.getInstance().isTouchExplorationEnabled()) {
return AccessibleKeyboardViewProxy.getInstance().dispatchTouchEvent(event);
}
return super.dispatchTouchEvent(event);
}
@Override @Override
public boolean onTouchEvent(final MotionEvent me) { public boolean onTouchEvent(final MotionEvent me) {
if (getKeyboard() == null) { if (getKeyboard() == null) {
return false; return false;
} }
if (AccessibilityUtils.getInstance().isTouchExplorationEnabled()) {
return AccessibleKeyboardViewProxy.getInstance().onTouchEvent(me);
}
return mTouchScreenRegulator.onTouchEvent(me); return mTouchScreenRegulator.onTouchEvent(me);
} }