summaryrefslogtreecommitdiff
path: root/services/core/jni/com_android_server_input_InputManagerService.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'services/core/jni/com_android_server_input_InputManagerService.cpp')
-rw-r--r--services/core/jni/com_android_server_input_InputManagerService.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/services/core/jni/com_android_server_input_InputManagerService.cpp b/services/core/jni/com_android_server_input_InputManagerService.cpp
index fb3076ba9ddd..d331d1f58b2d 100644
--- a/services/core/jni/com_android_server_input_InputManagerService.cpp
+++ b/services/core/jni/com_android_server_input_InputManagerService.cpp
@@ -1571,6 +1571,27 @@ static void nativeSetSystemUiVisibility(JNIEnv* /* env */,
im->setSystemUiVisibility(visibility);
}
+static jboolean nativeTransferTouchFocus(JNIEnv* env,
+ jclass /* clazz */, jlong ptr, jobject fromChannelObj, jobject toChannelObj) {
+ NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr);
+
+ sp<InputChannel> fromChannel =
+ android_view_InputChannel_getInputChannel(env, fromChannelObj);
+ sp<InputChannel> toChannel =
+ android_view_InputChannel_getInputChannel(env, toChannelObj);
+
+ if (fromChannel == nullptr || toChannel == nullptr) {
+ return JNI_FALSE;
+ }
+
+ if (im->getInputManager()->getDispatcher()->
+ transferTouchFocus(fromChannel->getToken(), toChannel->getToken())) {
+ return JNI_TRUE;
+ } else {
+ return JNI_FALSE;
+ }
+}
+
static void nativeSetPointerSpeed(JNIEnv* /* env */,
jclass /* clazz */, jlong ptr, jint speed) {
NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr);
@@ -1770,6 +1791,8 @@ static const JNINativeMethod gInputManagerMethods[] = {
(void*) nativeSetInputDispatchMode },
{ "nativeSetSystemUiVisibility", "(JI)V",
(void*) nativeSetSystemUiVisibility },
+ { "nativeTransferTouchFocus", "(JLandroid/view/InputChannel;Landroid/view/InputChannel;)Z",
+ (void*) nativeTransferTouchFocus },
{ "nativeSetPointerSpeed", "(JI)V",
(void*) nativeSetPointerSpeed },
{ "nativeSetShowTouches", "(JZ)V",