Home | History | Annotate | Download | only in view

Lines Matching refs:event

26  * When a problem is detected, the event is tainted.  This mechanism prevents the same
56 // The most recently checked event and the nesting level at which it was checked.
58 // so that the verifier can detect when it has been asked to verify the same event twice.
59 // It does not make sense to examine the contents of the last event since it may have
70 // Current event and its type.
90 // Set to true when we discover that the touch event stream is inconsistent.
94 // Set to true if the touch event stream is partially unhandled.
107 * Indicates that the verifier is intended to act on raw device input event streams.
143 * Resets the state of the input event consistency verifier.
164 * Checks an arbitrary input event.
165 * @param event The event.
167 * or 1 from a subclass. If the event was already checked by this consistency verifier
172 public void onInputEvent(InputEvent event, int nestingLevel) {
173 if (event instanceof KeyEvent) {
174 final KeyEvent keyEvent = (KeyEvent)event;
177 final MotionEvent motionEvent = (MotionEvent)event;
189 * Checks a key event.
190 * @param event The event.
192 * or 1 from a subclass. If the event was already checked by this consistency verifier
197 public void onKeyEvent(KeyEvent event, int nestingLevel) {
198 if (!startEvent(event, nestingLevel, EVENT_TYPE_KEY)) {
203 ensureMetaStateIsNormalized(event.getMetaState());
205 final int action = event.getAction();
206 final int deviceId = event.getDeviceId();
207 final int source = event.getSource();
208 final int keyCode = event.getKeyCode();
220 && event.getRepeatCount() == 0) {
221 problem("ACTION_DOWN but key is already down and this event "
242 + " for key event.");
251 * Checks a trackball event.
252 * @param event The event.
254 * or 1 from a subclass. If the event was already checked by this consistency verifier
259 public void onTrackballEvent(MotionEvent event, int nestingLevel) {
260 if (!startEvent(event, nestingLevel, EVENT_TYPE_TRACKBALL)) {
265 ensureMetaStateIsNormalized(event.getMetaState());
267 final int action = event.getAction();
268 final int source = event.getSource();
278 ensureHistorySizeIsZeroForThisAction(event);
279 ensurePointerCountIsOneForThisAction(event);
288 ensureHistorySizeIsZeroForThisAction(event);
289 ensurePointerCountIsOneForThisAction(event);
292 ensurePointerCountIsOneForThisAction(event);
296 + " for trackball event.");
300 if (mTrackballDown && event.getPressure() <= 0) {
302 } else if (!mTrackballDown && event.getPressure() != 0) {
314 * Checks a touch event.
315 * @param event The event.
317 * or 1 from a subclass. If the event was already checked by this consistency verifier
322 public void onTouchEvent(MotionEvent event, int nestingLevel) {
323 if (!startEvent(event, nestingLevel, EVENT_TYPE_TOUCH)) {
327 final int action = event.getAction();
336 event.setTainted(true);
340 ensureMetaStateIsNormalized(event.getMetaState());
342 final int deviceId = event.getDeviceId();
343 final int source = event.getSource();
348 problem("Touch event stream contains events from multiple sources: "
357 final int pointerCount = event.getPointerCount();
365 ensureHistorySizeIsZeroForThisAction(event);
366 ensurePointerCountIsOneForThisAction(event);
367 mTouchEventStreamPointers = 1 << event.getPointerId(0);
370 ensureHistorySizeIsZeroForThisAction(event);
371 ensurePointerCountIsOneForThisAction(event);
394 ensureHistorySizeIsZeroForThisAction(event);
395 ensurePointerCountIsOneForThisAction(event);
399 final int actionMasked = event.getActionMasked();
400 final int actionIndex = event.getActionIndex();
411 final int id = event.getPointerId(actionIndex);
421 ensureHistorySizeIsZeroForThisAction(event);
428 final int id = event.getPointerId(actionIndex);
438 ensureHistorySizeIsZeroForThisAction(event);
441 + " for touch event.");
455 * Checks a generic motion event.
456 * @param event The event.
458 * or 1 from a subclass. If the event was already checked by this consistency verifier
463 public void onGenericMotionEvent(MotionEvent event, int nestingLevel) {
464 if (!startEvent(event, nestingLevel, EVENT_TYPE_GENERIC_MOTION)) {
469 ensureMetaStateIsNormalized(event.getMetaState());
471 final int action = event.getAction();
472 final int source = event.getSource();
473 final int buttonState = event.getButtonState();
474 final int actionButton = event.getActionButton();
478 ensurePointerCountIsOneForThisAction(event);
482 ensurePointerCountIsOneForThisAction(event);
485 ensurePointerCountIsOneForThisAction(event);
492 ensureHistorySizeIsZeroForThisAction(event);
493 ensurePointerCountIsOneForThisAction(event);
496 ensureActionButtonIsNonZeroForThisAction(event);
498 problem("Action button for ACTION_BUTTON_PRESS event is " +
524 ensureActionButtonIsNonZeroForThisAction(event);
526 problem("Action button for ACTION_BUTTON_RELEASE event is " +
552 problem("Invalid action for generic pointer event.");
558 ensurePointerCountIsOneForThisAction(event);
561 problem("Invalid action for generic joystick event.");
571 * Notifies the verifier that a given event was unhandled and the rest of the
572 * trace for the event should be ignored.
573 * This method should only be called if the event was previously checked by
575 * @param event The event.
577 * or 1 from a subclass. If the event was already checked by this consistency verifier
582 public void onUnhandledEvent(InputEvent event, int nestingLevel) {
591 if (event instanceof KeyEvent) {
592 final KeyEvent keyEvent = (KeyEvent)event;
601 final MotionEvent motionEvent = (MotionEvent)event;
620 private void ensurePointerCountIsOneForThisAction(MotionEvent event) {
621 final int pointerCount = event.getPointerCount();
624 + MotionEvent.actionToString(event.getAction()));
628 private void ensureActionButtonIsNonZeroForThisAction(MotionEvent event) {
629 final int actionButton = event.getActionButton();
632 MotionEvent.actionToString(event.getAction()));
637 private void ensureHistorySizeIsZeroForThisAction(MotionEvent event) {
638 final int historySize = event.getHistorySize();
641 + MotionEvent.actionToString(event.getAction()));
645 private boolean startEvent(InputEvent event, int nestingLevel, String eventType) {
646 // Ignore the event if we already checked it at a higher nesting level.
647 final int seq = event.getSequenceNumber();
663 mCurrentEvent = event;
671 // Write a log message only if the event was not already tainted.
681 final InputEvent event = mRecentEvents[index];
682 if (event == null) {
686 appendEvent(mViolationMessage, i + 1, event, mRecentEventsUnhandled[index]);
692 // Taint the event so that we do not generate additional violations from it
718 InputEvent event, boolean unhandled) {
719 message.append(index).append(": sent at ").append(event.getEventTimeNano());
724 message.append(event);