diff options
author | Michael Wright <michaelwr@google.com> | 2014-09-03 19:30:20 -0700 |
---|---|---|
committer | Michael Wright <michaelwr@google.com> | 2014-09-04 19:48:39 -0700 |
commit | 70af00abf73160235d4efe114fcf4753007a8ff3 (patch) | |
tree | 238870bea8f34434c8a082aff99fd8c79fd90036 /services/core/jni | |
parent | d06cd2b1bd067e911d48c3b0c81a503c5772c98f (diff) | |
download | frameworks_base-70af00abf73160235d4efe114fcf4753007a8ff3.zip frameworks_base-70af00abf73160235d4efe114fcf4753007a8ff3.tar.gz frameworks_base-70af00abf73160235d4efe114fcf4753007a8ff3.tar.bz2 |
Allow for event dispatching when in non-interactive states.
We need to allow for event dispatching in non-interactive states so
that we can enable a richer set of interactions when a device is
dozing (i.e. is in a low power state with an Always-on-Display).
Bug: 17167296
Change-Id: I8ae0f544a8106cb91ff38c2309b8b57cbe2f2c72
Diffstat (limited to 'services/core/jni')
-rw-r--r-- | services/core/jni/com_android_server_input_InputManagerService.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/services/core/jni/com_android_server_input_InputManagerService.cpp b/services/core/jni/com_android_server_input_InputManagerService.cpp index 8ed74be..cddca92 100644 --- a/services/core/jni/com_android_server_input_InputManagerService.cpp +++ b/services/core/jni/com_android_server_input_InputManagerService.cpp @@ -71,7 +71,7 @@ static struct { jmethodID notifyANR; jmethodID filterInputEvent; jmethodID interceptKeyBeforeQueueing; - jmethodID interceptWakeMotionBeforeQueueing; + jmethodID interceptMotionBeforeQueueingNonInteractive; jmethodID interceptKeyBeforeDispatching; jmethodID dispatchUnhandledKey; jmethodID checkInjectEventsPermission; @@ -854,7 +854,9 @@ void NativeInputManager::interceptKeyBeforeQueueing(const KeyEvent* keyEvent, handleInterceptActions(wmActions, when, /*byref*/ policyFlags); } else { - policyFlags |= POLICY_FLAG_PASS_TO_USER; + if (mInteractive) { + policyFlags |= POLICY_FLAG_PASS_TO_USER; + } } } @@ -870,20 +872,22 @@ void NativeInputManager::interceptMotionBeforeQueueing(nsecs_t when, uint32_t& p if ((policyFlags & POLICY_FLAG_TRUSTED) && !(policyFlags & POLICY_FLAG_INJECTED)) { if (policyFlags & POLICY_FLAG_INTERACTIVE) { policyFlags |= POLICY_FLAG_PASS_TO_USER; - } else if (policyFlags & POLICY_FLAG_WAKE) { + } else { JNIEnv* env = jniEnv(); jint wmActions = env->CallIntMethod(mServiceObj, - gServiceClassInfo.interceptWakeMotionBeforeQueueing, + gServiceClassInfo.interceptMotionBeforeQueueingNonInteractive, when, policyFlags); if (checkAndClearExceptionFromCallback(env, - "interceptWakeMotionBeforeQueueing")) { + "interceptMotionBeforeQueueingNonInteractive")) { wmActions = 0; } handleInterceptActions(wmActions, when, /*byref*/ policyFlags); } } else { - policyFlags |= POLICY_FLAG_PASS_TO_USER; + if (mInteractive) { + policyFlags |= POLICY_FLAG_PASS_TO_USER; + } } } @@ -1441,8 +1445,8 @@ int register_android_server_InputManager(JNIEnv* env) { GET_METHOD_ID(gServiceClassInfo.interceptKeyBeforeQueueing, clazz, "interceptKeyBeforeQueueing", "(Landroid/view/KeyEvent;I)I"); - GET_METHOD_ID(gServiceClassInfo.interceptWakeMotionBeforeQueueing, clazz, - "interceptWakeMotionBeforeQueueing", "(JI)I"); + GET_METHOD_ID(gServiceClassInfo.interceptMotionBeforeQueueingNonInteractive, clazz, + "interceptMotionBeforeQueueingNonInteractive", "(JI)I"); GET_METHOD_ID(gServiceClassInfo.interceptKeyBeforeDispatching, clazz, "interceptKeyBeforeDispatching", |