Enable touch splitting by default for Honeycomb apps.
Also fixed some bad comments I noticed along the way.
Change-Id: I4328c8aaa22f48a5c1fd274e889abb7823747330
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index a4ad97b..33ea66c 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -4674,8 +4674,8 @@
}
/**
- * Default implementation of {@link KeyEvent.Callback#onKeyMultiple(int, int, KeyEvent)
- * KeyEvent.Callback.onKeyMultiple()}: perform press of the view
+ * Default implementation of {@link KeyEvent.Callback#onKeyDown(int, KeyEvent)
+ * KeyEvent.Callback.onKeyDown()}: perform press of the view
* when {@link KeyEvent#KEYCODE_DPAD_CENTER} or {@link KeyEvent#KEYCODE_ENTER}
* is released, if the view is enabled and clickable.
*
@@ -4718,8 +4718,8 @@
}
/**
- * Default implementation of {@link KeyEvent.Callback#onKeyMultiple(int, int, KeyEvent)
- * KeyEvent.Callback.onKeyMultiple()}: perform clicking of the view
+ * Default implementation of {@link KeyEvent.Callback#onKeyUp(int, KeyEvent)
+ * KeyEvent.Callback.onKeyUp()}: perform clicking of the view
* when {@link KeyEvent#KEYCODE_DPAD_CENTER} or
* {@link KeyEvent#KEYCODE_ENTER} is released.
*
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index 7b3cc6c..58fadb9 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -31,6 +31,7 @@
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Region;
+import android.os.Build;
import android.os.Parcelable;
import android.os.SystemClock;
import android.util.AttributeSet;
@@ -350,6 +351,10 @@
mGroupFlags |= FLAG_ANIMATION_CACHE;
mGroupFlags |= FLAG_ALWAYS_DRAWN_WITH_CACHE;
+ if (mContext.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.HONEYCOMB) {
+ mGroupFlags |= FLAG_SPLIT_MOTION_EVENTS;
+ }
+
setDescendantFocusability(FOCUS_BEFORE_DESCENDANTS);
mChildren = new View[ARRAY_INITIAL_CAPACITY];
@@ -1568,7 +1573,8 @@
/**
* Enable or disable the splitting of MotionEvents to multiple children during touch event
- * dispatch. This behavior is disabled by default.
+ * dispatch. This behavior is enabled by default for applications that target an
+ * SDK version of {@link Build.VERSION_CODES#HONEYCOMB} or newer.
*
* <p>When this option is enabled MotionEvents may be split and dispatched to different child
* views depending on where each pointer initially went down. This allows for user interactions
@@ -1591,6 +1597,7 @@
}
/**
+ * Returns true if MotionEvents dispatched to this ViewGroup can be split to multiple children.
* @return true if MotionEvents dispatched to this ViewGroup can be split to multiple children.
*/
public boolean isMotionEventSplittingEnabled() {