summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Chavi Weingarten <chaviw@google.com> 2019-04-01 17:53:00 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2019-04-01 17:53:00 +0000
commit03dda730d756bde1f268db4afeae4e509e3d0e99 (patch)
treeb64fc3af9d33542fe1218c15d6d684aad13d437b
parentd91a716cf30f327a8b85a5b3e0311379927f332b (diff)
parent17902c5450e3e31d4e8fad3c22d39f565cfff375 (diff)
Merge "Add onPointerDownOutsideFocus for events outside the focused window (3/4)"
-rw-r--r--services/core/java/com/android/server/input/InputManagerService.java4
-rw-r--r--services/core/jni/com_android_server_input_InputManagerService.cpp14
2 files changed, 18 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/input/InputManagerService.java b/services/core/java/com/android/server/input/InputManagerService.java
index 622c49e67967..5abc73eb255a 100644
--- a/services/core/java/com/android/server/input/InputManagerService.java
+++ b/services/core/java/com/android/server/input/InputManagerService.java
@@ -1809,6 +1809,10 @@ public class InputManagerService extends IInputManager.Stub
}
// Native callback.
+ private void onPointerDownOutsideFocus(IBinder touchedToken) {
+ }
+
+ // Native callback.
private int getVirtualKeyQuietTimeMillis() {
return mContext.getResources().getInteger(
com.android.internal.R.integer.config_virtualKeyQuietTimeMillis);
diff --git a/services/core/jni/com_android_server_input_InputManagerService.cpp b/services/core/jni/com_android_server_input_InputManagerService.cpp
index 3d84bd40fb5a..3d6c8684e6d8 100644
--- a/services/core/jni/com_android_server_input_InputManagerService.cpp
+++ b/services/core/jni/com_android_server_input_InputManagerService.cpp
@@ -96,6 +96,7 @@ static struct {
jmethodID interceptKeyBeforeDispatching;
jmethodID dispatchUnhandledKey;
jmethodID checkInjectEventsPermission;
+ jmethodID onPointerDownOutsideFocus;
jmethodID getVirtualKeyQuietTimeMillis;
jmethodID getExcludedDeviceNames;
jmethodID getInputPortAssociations;
@@ -259,6 +260,7 @@ public:
virtual void pokeUserActivity(nsecs_t eventTime, int32_t eventType);
virtual bool checkInjectEventsPermissionNonReentrant(
int32_t injectorPid, int32_t injectorUid);
+ virtual void onPointerDownOutsideFocus(const sp<IBinder>& touchedToken);
/* --- PointerControllerPolicyInterface implementation --- */
@@ -1205,6 +1207,15 @@ bool NativeInputManager::checkInjectEventsPermissionNonReentrant(
return result;
}
+void NativeInputManager::onPointerDownOutsideFocus(const sp<IBinder>& touchedToken) {
+ ATRACE_CALL();
+ JNIEnv* env = jniEnv();
+
+ jobject touchedTokenObj = javaObjectForIBinder(env, touchedToken);
+ env->CallVoidMethod(mServiceObj, gServiceClassInfo.onPointerDownOutsideFocus, touchedTokenObj);
+ checkAndClearExceptionFromCallback(env, "onPointerDownOutsideFocus");
+}
+
void NativeInputManager::loadPointerIcon(SpriteIcon* icon, int32_t displayId) {
ATRACE_CALL();
JNIEnv* env = jniEnv();
@@ -1809,6 +1820,9 @@ int register_android_server_InputManager(JNIEnv* env) {
GET_METHOD_ID(gServiceClassInfo.checkInjectEventsPermission, clazz,
"checkInjectEventsPermission", "(II)Z");
+ GET_METHOD_ID(gServiceClassInfo.onPointerDownOutsideFocus, clazz,
+ "onPointerDownOutsideFocus", "(Landroid/os/IBinder;)V");
+
GET_METHOD_ID(gServiceClassInfo.getVirtualKeyQuietTimeMillis, clazz,
"getVirtualKeyQuietTimeMillis", "()I");