summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/jni/OWNERS1
-rw-r--r--core/jni/android_view_WindowManagerGlobal.cpp8
-rw-r--r--native/android/surface_control_input_receiver.cpp2
3 files changed, 7 insertions, 4 deletions
diff --git a/core/jni/OWNERS b/core/jni/OWNERS
index 3aca751edb0d..2a4f062478bd 100644
--- a/core/jni/OWNERS
+++ b/core/jni/OWNERS
@@ -27,6 +27,7 @@ per-file android_view_VelocityTracker.* = file:/services/core/java/com/android/s
# WindowManager
per-file android_graphics_BLASTBufferQueue.cpp = file:/services/core/java/com/android/server/wm/OWNERS
per-file android_view_Surface* = file:/services/core/java/com/android/server/wm/OWNERS
+per-file android_view_WindowManagerGlobal.cpp = file:/services/core/java/com/android/server/wm/OWNERS
per-file android_window_* = file:/services/core/java/com/android/server/wm/OWNERS
# Resources
diff --git a/core/jni/android_view_WindowManagerGlobal.cpp b/core/jni/android_view_WindowManagerGlobal.cpp
index b03ac88a36ca..abc621d8dc90 100644
--- a/core/jni/android_view_WindowManagerGlobal.cpp
+++ b/core/jni/android_view_WindowManagerGlobal.cpp
@@ -48,7 +48,7 @@ std::shared_ptr<InputChannel> createInputChannel(
surfaceControlObj(env,
android_view_SurfaceControl_getJavaSurfaceControl(env,
surfaceControl));
- jobject clientTokenObj = javaObjectForIBinder(env, clientToken);
+ ScopedLocalRef<jobject> clientTokenObj(env, javaObjectForIBinder(env, clientToken));
ScopedLocalRef<jobject> clientInputTransferTokenObj(
env,
android_window_InputTransferToken_getJavaInputTransferToken(env,
@@ -57,7 +57,7 @@ std::shared_ptr<InputChannel> createInputChannel(
inputChannelObj(env,
env->CallStaticObjectMethod(gWindowManagerGlobal.clazz,
gWindowManagerGlobal.createInputChannel,
- clientTokenObj,
+ clientTokenObj.get(),
hostInputTransferTokenObj.get(),
surfaceControlObj.get(),
clientInputTransferTokenObj.get()));
@@ -68,9 +68,9 @@ std::shared_ptr<InputChannel> createInputChannel(
void removeInputChannel(const sp<IBinder>& clientToken) {
JNIEnv* env = AndroidRuntime::getJNIEnv();
- jobject clientTokenObj(javaObjectForIBinder(env, clientToken));
+ ScopedLocalRef<jobject> clientTokenObj(env, javaObjectForIBinder(env, clientToken));
env->CallStaticObjectMethod(gWindowManagerGlobal.clazz, gWindowManagerGlobal.removeInputChannel,
- clientTokenObj);
+ clientTokenObj.get());
}
int register_android_view_WindowManagerGlobal(JNIEnv* env) {
diff --git a/native/android/surface_control_input_receiver.cpp b/native/android/surface_control_input_receiver.cpp
index da0defd9fd17..d178abc2c3d7 100644
--- a/native/android/surface_control_input_receiver.cpp
+++ b/native/android/surface_control_input_receiver.cpp
@@ -45,6 +45,8 @@ public:
mClientToken(clientToken),
mInputTransferToken(inputTransferToken) {}
+ // The InputConsumer does not keep the InputReceiver alive so the receiver is cleared once the
+ // owner releases it.
~InputReceiver() {
remove();
}