From d5ed285606a9f28d2102e086aaee5c9d1cb819b9 Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Wed, 2 Mar 2011 19:23:13 -0800 Subject: 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 --- libs/ui/Input.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'libs/ui/Input.cpp') diff --git a/libs/ui/Input.cpp b/libs/ui/Input.cpp index a80320e475..0ed086662c 100644 --- a/libs/ui/Input.cpp +++ b/libs/ui/Input.cpp @@ -616,6 +616,23 @@ status_t MotionEvent::writeToParcel(Parcel* parcel) const { } #endif +bool MotionEvent::isTouchEvent(int32_t source, int32_t action) { + if (source & AINPUT_SOURCE_CLASS_POINTER) { + // Specifically excludes HOVER_MOVE and SCROLL. + switch (action & AMOTION_EVENT_ACTION_MASK) { + case AMOTION_EVENT_ACTION_DOWN: + case AMOTION_EVENT_ACTION_MOVE: + case AMOTION_EVENT_ACTION_UP: + case AMOTION_EVENT_ACTION_POINTER_DOWN: + case AMOTION_EVENT_ACTION_POINTER_UP: + case AMOTION_EVENT_ACTION_CANCEL: + case AMOTION_EVENT_ACTION_OUTSIDE: + return true; + } + } + return false; +} + // --- InputDeviceInfo --- -- cgit v1.2.3-59-g8ed1b