Lines Matching refs:event

39  * transforms the motion event stream by modifying, adding, replacing,
111 // Command for delayed sending of a hover enter and move event.
114 // Command for delayed sending of a hover exit event.
211 // If we have not received an event then we are in initial
213 MotionEvent event = mReceivedPointerTracker.getLastReceivedEvent();
214 if (event != null) {
219 private void clear(MotionEvent event, int policyFlags) {
228 sendUpForInjectedDownPointers(event, policyFlags);
232 sendUpForInjectedDownPointers(event, policyFlags);
265 public void onMotionEvent(MotionEvent event, MotionEvent rawEvent, int policyFlags) {
266 if (!event.isFromSource(InputDevice.SOURCE_TOUCHSCREEN)) {
268 mNext.onMotionEvent(event, rawEvent, policyFlags);
274 Slog.d(LOG_TAG, "Received event: " + event + ", policyFlags=0x"
289 if (event.getActionMasked() == MotionEvent.ACTION_CANCEL) {
290 clear(event, policyFlags);
296 handleMotionEventStateTouchExploring(event, rawEvent, policyFlags);
299 handleMotionEventStateDragging(event, policyFlags);
302 handleMotionEventStateDelegating(event, policyFlags);
313 public void onKeyEvent(KeyEvent event, int policyFlags) {
315 mNext.onKeyEvent(event, policyFlags);
320 public void onAccessibilityEvent(AccessibilityEvent event) {
321 final int eventType = event.getEventType();
323 // The event for gesture end should be strictly after the
324 // last hover exit event.
331 // The event for touch interaction end should be strictly after the
352 mLastTouchedWindowId = event.getWindowId();
356 mNext.onAccessibilityEvent(event);
361 public void onDoubleTapAndHold(MotionEvent event, int policyFlags) {
362 // Ignore the event if we aren't touch exploring.
372 final int pointerIndex = event.getActionIndex();
373 final int pointerId = event.getPointerId(pointerIndex);
383 mLongPressingPointerDeltaX = (int) event.getX(pointerIndex) - clickLocation.x;
384 mLongPressingPointerDeltaY = (int) event.getY(pointerIndex) - clickLocation.y;
389 sendDownForAllNotInjectedPointers(event, policyFlags);
393 public boolean onDoubleTap(MotionEvent event, int policyFlags) {
394 // Ignore the event if we aren't touch exploring.
399 // Remove pending event deliveries.
410 final int pointerIndex = event.getActionIndex();
411 final int pointerId = event.getPointerId(pointerIndex);
424 event.getPointerProperties(pointerIndex, properties[0]);
429 MotionEvent click_event = MotionEvent.obtain(event.getDownTime(),
430 event.getEventTime(), MotionEvent.ACTION_DOWN, 1, properties,
431 coords, 0, 0, 1.0f, 1.0f, event.getDeviceId(), 0,
432 event.getSource(), event.getFlags());
447 // Send accessibility event to announce the start
467 public boolean onGestureCancelled(MotionEvent event, int policyFlags) {
472 // If the finger is still moving, pass the event on.
473 if (event.getActionMasked() == MotionEvent.ACTION_MOVE) {
479 mSendHoverEnterAndMoveDelayed.addEvent(event);
482 sendMotionEvent(event, MotionEvent.ACTION_HOVER_MOVE, pointerIdBits, policyFlags);
490 * Handles a motion event in touch exploring state.
492 * @param event The event to be handled.
493 * @param rawEvent The raw (unmodified) motion event.
494 * @param policyFlags The policy flags associated with the event.
496 private void handleMotionEventStateTouchExploring(MotionEvent event, MotionEvent rawEvent,
500 switch (event.getActionMasked()) {
526 mSendHoverEnterAndMoveDelayed.post(event, true, pointerIdBits,
529 // Cache the event until we discern exploration from gesturing.
530 mSendHoverEnterAndMoveDelayed.addEvent(event);
543 final int pointerIndex = event.findPointerIndex(pointerId);
545 switch (event.getPointerCount()) {
550 // Cache the event until we discern exploration from gesturing.
551 mSendHoverEnterAndMoveDelayed.addEvent(event);
555 sendMotionEvent(event, MotionEvent.ACTION_HOVER_MOVE, pointerIdBits,
589 if (isDraggingGesture(event)) {
594 event.setEdgeFlags(receivedTracker.getLastReceivedDownEdgeFlags());
595 sendMotionEvent(event, MotionEvent.ACTION_DOWN, pointerIdBits,
600 sendDownForAllNotInjectedPointers(event, policyFlags);
619 sendDownForAllNotInjectedPointers(event, policyFlags);
625 final int pointerId = event.getPointerId(event.getActionIndex());
630 mSendHoverExitDelayed.post(event, pointerIdBits, policyFlags);
645 * Handles a motion event in dragging state.
647 * @param event The event to be handled.
648 * @param policyFlags The policy flags associated with the event.
650 private void handleMotionEventStateDragging(MotionEvent event, int policyFlags) {
653 if (event.findPointerIndex(mDraggingPointerId) == -1) {
654 Slog.e(LOG_TAG, "mDraggingPointerId doesn't match any pointers on current event. " +
656 ", Event: " + event);
661 switch (event.getActionMasked()) {
671 sendMotionEvent(event, MotionEvent.ACTION_UP, pointerIdBits, policyFlags);
673 sendDownForAllNotInjectedPointers(event, policyFlags);
679 switch (event.getPointerCount()) {
684 if (isDraggingGesture(event)) {
685 final float firstPtrX = event.getX(0);
686 final float firstPtrY = event.getY(0);
687 final float secondPtrX = event.getX(1);
688 final float secondPtrY = event.getY(1);
695 event.setLocation(deltaX / 2, deltaY / 2);
698 // If still dragging send a drag event.
699 sendMotionEvent(event, MotionEvent.ACTION_MOVE, pointerIdBits,
705 // Send an event to the end of the drag gesture.
706 sendMotionEvent(event, MotionEvent.ACTION_UP, pointerIdBits,
709 sendDownForAllNotInjectedPointers(event, policyFlags);
714 // Send an event to the end of the drag gesture.
715 sendMotionEvent(event, MotionEvent.ACTION_UP, pointerIdBits,
718 sendDownForAllNotInjectedPointers(event, policyFlags);
723 final int pointerId = event.getPointerId(event.getActionIndex());
726 // Send an event to the end of the drag gesture.
727 sendMotionEvent(event, MotionEvent.ACTION_UP, pointerIdBits, policyFlags);
735 final int pointerId = event.getPointerId(event.getActionIndex());
738 // Send an event to the end of the drag gesture.
739 sendMotionEvent(event, MotionEvent.ACTION_UP, pointerIdBits, policyFlags);
747 * Handles a motion event in delegating state.
749 * @param event The event to be handled.
750 * @param policyFlags The policy flags associated with the event.
752 private void handleMotionEventStateDelegating(MotionEvent event, int policyFlags) {
753 switch (event.getActionMasked()) {
759 // Offset the event if we are doing a long press as the
762 event = offsetEvent(event, - mLongPressingPointerDeltaX,
770 // Deliver the event.
771 sendMotionEvent(event, event.getAction(), ALL_POINTER_ID_BITS, policyFlags);
780 // Deliver the event.
781 sendMotionEvent(event, event.getAction(), ALL_POINTER_ID_BITS, policyFlags);
799 * Sends an accessibility event of the given type.
801 * @param type The event type.
806 AccessibilityEvent event = AccessibilityEvent.obtain(type);
807 event.setWindowId(mAms.getActiveWindowId());
808 accessibilityManager.sendAccessibilityEvent(event);
825 * @param policyFlags The policy flags associated with the event.
835 // Do not send event for already delivered pointers.
848 * @param policyFlags The policy flags associated with the event.
851 MotionEvent event = mInjectedPointerTracker.getLastInjectedHoverEvent();
852 if (event != null && event.getActionMasked() != MotionEvent.ACTION_HOVER_EXIT) {
853 final int pointerIdBits = event.getPointerIdBits();
857 sendMotionEvent(event, MotionEvent.ACTION_HOVER_EXIT, pointerIdBits, policyFlags);
865 * @param policyFlags The policy flags associated with the event.
868 MotionEvent event = mInjectedPointerTracker.getLastInjectedHoverEvent();
869 if (event != null && event.getActionMasked() == MotionEvent.ACTION_HOVER_EXIT) {
870 final int pointerIdBits = event.getPointerIdBits();
872 sendMotionEvent(event, MotionEvent.ACTION_HOVER_ENTER, pointerIdBits, policyFlags);
881 * @param policyFlags The policy flags associated with the event.
903 * @param policyFlags The policy flags associated with the event.
904 * @param targetAccessibilityFocus Whether the event targets the accessibility focus.
918 * Sends an event.
921 * @param action The action of the event.
923 * @param policyFlags The policy flags associated with the event.
929 MotionEvent event = null;
931 event = prototype;
933 event = prototype.split(pointerIdBits);
936 event.setDownTime(event.getEventTime());
938 event.setDownTime(mInjectedPointerTracker.getLastInjectedDownEventTime());
948 event = offsetEvent(event, - mLongPressingPointerDeltaX,
953 Slog.d(LOG_TAG, "Injecting event: " + event + ", policyFlags=0x"
957 // Make sure that the user will see the event.
960 // TODO: For now pass null for the raw event since the touch
961 // explorer is the last event transformation and it does
962 // not care about the raw event.
963 mNext.onMotionEvent(event, null, policyFlags);
966 mInjectedPointerTracker.onMotionEvent(event);
968 if (event != prototype) {
969 event.recycle();
974 * Offsets all pointers in the given event by adding the specified X and Y
977 * @param event The event to offset.
980 * @return An event with the offset pointers or the original event if both
983 private MotionEvent offsetEvent(MotionEvent event, int offsetX, int offsetY) {
985 return event;
987 final int remappedIndex = event.findPointerIndex(mLongPressingPointerId);
988 final int pointerCount = event.getPointerCount();
992 event.getPointerProperties(i, props[i]);
993 event.getPointerCoords(i, coords[i]);
999 return MotionEvent.obtain(event.getDownTime(),
1000 event.getEventTime(), event.getAction(), event.getPointerCount(),
1001 props, coords, event.getMetaState(), event.getButtonState(),
1002 1.0f, 1.0f, event.getDeviceId(), event.getEdgeFlags(),
1003 event.getSource(), event.getFlags());
1007 * Computes the action for an injected event based on a masked action
1045 * @param event The event with the pointer data.
1048 private boolean isDraggingGesture(MotionEvent event) {
1051 final float firstPtrX = event.getX(0);
1052 final float firstPtrY = event.getY(0);
1053 final float secondPtrX = event.getX(1);
1054 final float secondPtrY = event.getY(1);
1143 public void post(MotionEvent event, boolean touchExplorationInProgress,
1146 addEvent(event);
1152 public void addEvent(MotionEvent event) {
1153 mEvents.add(MotionEvent.obtain(event));
1184 // Send an accessibility event to announce the touch exploration start.
1188 // Deliver a down event.
1193 "Injecting motion event: ACTION_HOVER_ENTER");
1203 "Injecting motion event: ACTION_HOVER_MOVE");
1256 Slog.d(LOG_TAG_SEND_HOVER_DELAYED, "Injecting motion event:"
1321 // The last injected hover event.
1324 // The last injected hover event used for performing clicks.
1328 * Processes an injected {@link MotionEvent} event.
1330 * @param event The event to process.
1332 public void onMotionEvent(MotionEvent event) {
1333 final int action = event.getActionMasked();
1337 final int pointerId = event.getPointerId(event.getActionIndex());
1340 mLastInjectedDownEventTime = event.getDownTime();
1344 final int pointerId = event.getPointerId(event.getActionIndex());
1357 mLastInjectedHoverEvent = MotionEvent.obtain(event);
1361 mLastInjectedHoverEventForClick = MotionEvent.obtain(event);
1377 * @return The time of the last injected down event.
1409 * @return The the last injected hover event.
1416 * @return The the last injected hover event.
1452 // The edge flags of the last received down event.
1481 * Processes a received {@link MotionEvent} event.
1483 * @param event The event to process.
1485 public void onMotionEvent(MotionEvent event) {
1489 mLastReceivedEvent = MotionEvent.obtain(event);
1491 final int action = event.getActionMasked();
1494 handleReceivedPointerDown(event.getActionIndex(), event);
1497 handleReceivedPointerDown(event.getActionIndex(), event);
1500 handleReceivedPointerUp(event.getActionIndex(), event);
1503 handleReceivedPointerUp(event.getActionIndex(), event);
1512 * @return The last received event.
1592 * @return The edge flags of the last received down event.
1599 * Handles a received pointer down event.
1602 * @param event The event to be handled.
1604 private void handleReceivedPointerDown(int pointerIndex, MotionEvent event) {
1605 final int pointerId = event.getPointerId(pointerIndex);
1612 mLastReceivedDownEdgeFlags = event.getEdgeFlags();
1615 mReceivedPointerDownX[pointerId] = event.getX(pointerIndex);
1616 mReceivedPointerDownY[pointerId] = event.getY(pointerIndex);
1617 mReceivedPointerDownTime[pointerId] = event.getEventTime();
1623 * Handles a received pointer up event.
1626 * @param event The event to be handled.
1628 private void handleReceivedPointerUp(int pointerIndex, MotionEvent event) {
1629 final int pointerId = event.getPointerId(pointerIndex);