summaryrefslogtreecommitdiff
path: root/core/java/android/view/MotionEvent.java
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2011-03-02 19:23:13 -0800
committerJeff Brown <jeffbrown@google.com>2011-03-02 19:57:07 -0800
commit56194ebec6212e229f4ccdaa4b187166d20013ef (patch)
tree51276000061ba703b6ddda32ecce3ce10a06f4f5 /core/java/android/view/MotionEvent.java
parent05dc66ada6b61a6bdf806ffaa62617ac5394695d (diff)
Wake screen from external HID peripherals.
Added some plumbing to enable the policy to intercept motion events when the screen is off to handle wakeup if needed. Added a basic concept of an external device to limit the scope of the wakeup policy to external devices only. The wakeup policy for internal devices should be based on explicit rules such as policy flags in key layout files. Moved isTouchEvent to native. Ensure the dispatcher sends the right event type to userActivity for non-touch pointer events like HOVER_MOVE and SCROLL. Bug: 3193114 Change-Id: I15dbd48a16810dfaf226ff7ad117d46908ca4f86
Diffstat (limited to 'core/java/android/view/MotionEvent.java')
-rw-r--r--core/java/android/view/MotionEvent.java15
1 files changed, 2 insertions, 13 deletions
diff --git a/core/java/android/view/MotionEvent.java b/core/java/android/view/MotionEvent.java
index a26dd0425b69..076f71298490 100644
--- a/core/java/android/view/MotionEvent.java
+++ b/core/java/android/view/MotionEvent.java
@@ -937,6 +937,7 @@ public final class MotionEvent extends InputEvent implements Parcelable {
private static native int nativeSetSource(int nativePtr, int source);
private static native int nativeGetAction(int nativePtr);
private static native void nativeSetAction(int nativePtr, int action);
+ private static native boolean nativeIsTouchEvent(int nativePtr);
private static native int nativeGetFlags(int nativePtr);
private static native int nativeGetEdgeFlags(int nativePtr);
private static native void nativeSetEdgeFlags(int nativePtr, int action);
@@ -1275,19 +1276,7 @@ public final class MotionEvent extends InputEvent implements Parcelable {
* @hide
*/
public final boolean isTouchEvent() {
- if ((getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) {
- switch (getActionMasked()) {
- case MotionEvent.ACTION_DOWN:
- case MotionEvent.ACTION_MOVE:
- case MotionEvent.ACTION_UP:
- case MotionEvent.ACTION_POINTER_DOWN:
- case MotionEvent.ACTION_POINTER_UP:
- case MotionEvent.ACTION_CANCEL:
- case MotionEvent.ACTION_OUTSIDE:
- return true;
- }
- }
- return false;
+ return nativeIsTouchEvent(mNativePtr);
}
/**