Track unhandled input events in consistency verifiers.

This fixes spurious verification errors that would be generated
when a view declined an initial event such as ACTION_DOWN.  Since
the view would not receive the rest of the event stream, it would
not see the corresponding ACTION_UP and the next ACTION_DOWN would
trigger a spurious verification error.

Change-Id: I2386acf378cd1765d5446faed5ad9c6525f8b400
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index dc8e52f..fe8af19 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -4614,8 +4614,15 @@
             return true;
         }
 
-        return event.dispatch(this, mAttachInfo != null
-                ? mAttachInfo.mKeyDispatchState : null, this);
+        if (event.dispatch(this, mAttachInfo != null
+                ? mAttachInfo.mKeyDispatchState : null, this)) {
+            return true;
+        }
+
+        if (mInputEventConsistencyVerifier != null) {
+            mInputEventConsistencyVerifier.onUnhandledEvent(event, 0);
+        }
+        return false;
     }
 
     /**
@@ -4640,16 +4647,22 @@
             mInputEventConsistencyVerifier.onTouchEvent(event, 0);
         }
 
-        if (!onFilterTouchEventForSecurity(event)) {
-            return false;
+        if (onFilterTouchEventForSecurity(event)) {
+            //noinspection SimplifiableIfStatement
+            if (mOnTouchListener != null && (mViewFlags & ENABLED_MASK) == ENABLED &&
+                    mOnTouchListener.onTouch(this, event)) {
+                return true;
+            }
+
+            if (onTouchEvent(event)) {
+                return true;
+            }
         }
 
-        //noinspection SimplifiableIfStatement
-        if (mOnTouchListener != null && (mViewFlags & ENABLED_MASK) == ENABLED &&
-                mOnTouchListener.onTouch(this, event)) {
-            return true;
+        if (mInputEventConsistencyVerifier != null) {
+            mInputEventConsistencyVerifier.onUnhandledEvent(event, 0);
         }
-        return onTouchEvent(event);
+        return false;
     }
 
     /**
@@ -4682,7 +4695,14 @@
         }
 
         //Log.i("view", "view=" + this + ", " + event.toString());
-        return onTrackballEvent(event);
+        if (onTrackballEvent(event)) {
+            return true;
+        }
+
+        if (mInputEventConsistencyVerifier != null) {
+            mInputEventConsistencyVerifier.onUnhandledEvent(event, 0);
+        }
+        return false;
     }
 
     /**
@@ -4723,7 +4743,15 @@
                 && mOnGenericMotionListener.onGenericMotion(this, event)) {
             return true;
         }
-        return onGenericMotionEvent(event);
+
+        if (onGenericMotionEvent(event)) {
+            return true;
+        }
+
+        if (mInputEventConsistencyVerifier != null) {
+            mInputEventConsistencyVerifier.onUnhandledEvent(event, 0);
+        }
+        return false;
     }
 
     /**