Fix synthesizing MotionEvent
KeyboardAccessibilityDelegate.synthesizeTouchEvent() wrongly passed pointer's id as a 6th argument of MotionEvent.obtain method that should be metaState. Change-Id: I822f9647a1ba27ee8cee39f373f6a1c003ebf665
This commit is contained in:
parent
a32803cefe
commit
2351b4f74f
1 changed files with 5 additions and 9 deletions
|
@ -248,19 +248,15 @@ public class KeyboardAccessibilityDelegate<KV extends KeyboardView>
|
||||||
* Synthesize a touch event from a hover event.
|
* Synthesize a touch event from a hover event.
|
||||||
*
|
*
|
||||||
* @param touchAction The action of the synthesizing touch event.
|
* @param touchAction The action of the synthesizing touch event.
|
||||||
* @param event The base hover event from that the touch event is synthesized.
|
* @param hoverEvent The base hover event from that the touch event is synthesized.
|
||||||
* @return The synthesized touch event of <code>touchAction</code> that has pointer information
|
* @return The synthesized touch event of <code>touchAction</code> that has pointer information
|
||||||
* of <code>event</code>.
|
* of <code>event</code>.
|
||||||
*/
|
*/
|
||||||
protected static MotionEvent synthesizeTouchEvent(final int touchAction,
|
protected static MotionEvent synthesizeTouchEvent(final int touchAction,
|
||||||
final MotionEvent event) {
|
final MotionEvent hoverEvent) {
|
||||||
final long downTime = event.getDownTime();
|
final MotionEvent touchEvent = MotionEvent.obtain(hoverEvent);
|
||||||
final long eventTime = event.getEventTime();
|
touchEvent.setAction(touchAction);
|
||||||
final int actionIndex = event.getActionIndex();
|
return touchEvent;
|
||||||
final float x = event.getX(actionIndex);
|
|
||||||
final float y = event.getY(actionIndex);
|
|
||||||
final int pointerId = event.getPointerId(actionIndex);
|
|
||||||
return MotionEvent.obtain(downTime, eventTime, touchAction, x, y, pointerId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue