summaryrefslogtreecommitdiffstats
path: root/core/java/android/view/View.java
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2011-04-01 12:56:35 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-04-01 12:56:35 -0700
commitbc2278b95f4012d81918b0faedea36011f122a33 (patch)
tree8836705e54192c71efac8c72a36efa36692b13c6 /core/java/android/view/View.java
parent165121f64acb8ebd0f1b955684360477c71660d3 (diff)
parent21bc5c917d4ee2a9b2b8173091e6bba85eaff899 (diff)
downloadframeworks_base-bc2278b95f4012d81918b0faedea36011f122a33.zip
frameworks_base-bc2278b95f4012d81918b0faedea36011f122a33.tar.gz
frameworks_base-bc2278b95f4012d81918b0faedea36011f122a33.tar.bz2
Merge "Add a little input event consistency verifier."
Diffstat (limited to 'core/java/android/view/View.java')
-rw-r--r--core/java/android/view/View.java25
1 files changed, 24 insertions, 1 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 0ef56cc..e329e97 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -2384,6 +2384,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
Rect mLocalDirtyRect;
/**
+ * Consistency verifier for debugging purposes.
+ * @hide
+ */
+ protected final InputEventConsistencyVerifier mInputEventConsistencyVerifier =
+ InputEventConsistencyVerifier.isInstrumentationEnabled() ?
+ new InputEventConsistencyVerifier(this, 0) : null;
+
+ /**
* Simple constructor to use when creating a view from code.
*
* @param context The Context the view is running in, through which it can
@@ -4590,13 +4598,16 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
* @return True if the event was handled, false otherwise.
*/
public boolean dispatchKeyEvent(KeyEvent event) {
- // If any attached key listener a first crack at the event.
+ if (mInputEventConsistencyVerifier != null) {
+ mInputEventConsistencyVerifier.onKeyEvent(event, 0);
+ }
//noinspection SimplifiableIfStatement,deprecation
if (android.util.Config.LOGV) {
captureViewInfo("captureViewKeyEvent", this);
}
+ // Give any attached key listener a first crack at the event.
//noinspection SimplifiableIfStatement
if (mOnKeyListener != null && (mViewFlags & ENABLED_MASK) == ENABLED
&& mOnKeyListener.onKey(this, event.getKeyCode(), event)) {
@@ -4625,6 +4636,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
* @return True if the event was handled by the view, false otherwise.
*/
public boolean dispatchTouchEvent(MotionEvent event) {
+ if (mInputEventConsistencyVerifier != null) {
+ mInputEventConsistencyVerifier.onTouchEvent(event, 0);
+ }
+
if (!onFilterTouchEventForSecurity(event)) {
return false;
}
@@ -4662,6 +4677,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
* @return True if the event was handled by the view, false otherwise.
*/
public boolean dispatchTrackballEvent(MotionEvent event) {
+ if (mInputEventConsistencyVerifier != null) {
+ mInputEventConsistencyVerifier.onTrackballEvent(event, 0);
+ }
+
//Log.i("view", "view=" + this + ", " + event.toString());
return onTrackballEvent(event);
}
@@ -4679,6 +4698,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
* @return True if the event was handled by the view, false otherwise.
*/
public boolean dispatchGenericMotionEvent(MotionEvent event) {
+ if (mInputEventConsistencyVerifier != null) {
+ mInputEventConsistencyVerifier.onGenericMotionEvent(event, 0);
+ }
+
final int source = event.getSource();
if ((source & InputDevice.SOURCE_CLASS_POINTER) != 0) {
final int action = event.getAction();