From d35d4543ca81a80ce8afba8c519dddea99329856 Mon Sep 17 00:00:00 2001 From: Prabir Pradhan Date: Fri, 21 Jan 2022 08:24:35 -0800 Subject: [PATCH] InputManagerService: Remove gesture monitor implementation Bug: 162194035 Test: manual Change-Id: I8a2649f168f76aa56e3a1cb44d85516bebfc6342 --- .../server/input/InputManagerService.java | 18 ++++-------------- ...ndroid_server_input_InputManagerService.cpp | 13 +++++-------- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/services/core/java/com/android/server/input/InputManagerService.java b/services/core/java/com/android/server/input/InputManagerService.java index bfaa7b37fa33e..354d1838709df 100644 --- a/services/core/java/com/android/server/input/InputManagerService.java +++ b/services/core/java/com/android/server/input/InputManagerService.java @@ -150,8 +150,6 @@ public class InputManagerService extends IInputManager.Stub static final String TAG = "InputManager"; static final boolean DEBUG = false; - private static final boolean USE_SPY_WINDOW_GESTURE_MONITORS = true; - private static final String EXCLUDED_DEVICES_PATH = "etc/excluded-input-devices.xml"; private static final String PORT_ASSOCIATIONS_PATH = "etc/input-port-associations.xml"; @@ -303,7 +301,7 @@ public class InputManagerService extends IInputManager.Stub int locationKeyCode); private static native InputChannel nativeCreateInputChannel(long ptr, String name); private static native InputChannel nativeCreateInputMonitor(long ptr, int displayId, - boolean isGestureMonitor, String name, int pid); + String name, int pid); private static native void nativeRemoveInputChannel(long ptr, IBinder connectionToken); private static native void nativePilferPointers(long ptr, IBinder token); private static native void nativeSetInputFilterEnabled(long ptr, boolean enable); @@ -720,8 +718,7 @@ public class InputManagerService extends IInputManager.Stub throw new IllegalArgumentException("displayId must >= 0."); } - return nativeCreateInputMonitor(mPtr, displayId, false /* isGestureMonitor */, - inputChannelName, Binder.getCallingPid()); + return nativeCreateInputMonitor(mPtr, displayId, inputChannelName, Binder.getCallingPid()); } @NonNull @@ -790,10 +787,7 @@ public class InputManagerService extends IInputManager.Stub final long ident = Binder.clearCallingIdentity(); try { final InputChannel inputChannel = - USE_SPY_WINDOW_GESTURE_MONITORS - ? createSpyWindowGestureMonitor(monitorToken, name, displayId, pid, uid) - : nativeCreateInputMonitor(mPtr, displayId, true /*isGestureMonitor*/, - requestedName, pid); + createSpyWindowGestureMonitor(monitorToken, name, displayId, pid, uid); return new InputMonitor(inputChannel, new InputMonitorHost(inputChannel.getToken())); } finally { Binder.restoreCallingIdentity(ident); @@ -3375,11 +3369,7 @@ public class InputManagerService extends IInputManager.Stub @Override public void dispose() { - if (USE_SPY_WINDOW_GESTURE_MONITORS) { - removeSpyWindowGestureMonitor(mInputChannelToken); - return; - } - nativeRemoveInputChannel(mPtr, mInputChannelToken); + removeSpyWindowGestureMonitor(mInputChannelToken); } } diff --git a/services/core/jni/com_android_server_input_InputManagerService.cpp b/services/core/jni/com_android_server_input_InputManagerService.cpp index 8cb27e179c19e..e5529f1997a38 100644 --- a/services/core/jni/com_android_server_input_InputManagerService.cpp +++ b/services/core/jni/com_android_server_input_InputManagerService.cpp @@ -265,7 +265,6 @@ public: base::Result> createInputChannel(JNIEnv* env, const std::string& name); base::Result> createInputMonitor(JNIEnv* env, int32_t displayId, - bool isGestureMonitor, const std::string& name, int32_t pid); status_t removeInputChannel(JNIEnv* env, const sp& connectionToken); @@ -522,11 +521,9 @@ base::Result> NativeInputManager::createInputChann } base::Result> NativeInputManager::createInputMonitor( - JNIEnv* /* env */, int32_t displayId, bool isGestureMonitor, const std::string& name, - int32_t pid) { + JNIEnv* /* env */, int32_t displayId, const std::string& name, int32_t pid) { ATRACE_CALL(); - return mInputManager->getDispatcher().createInputMonitor(displayId, isGestureMonitor, name, - pid); + return mInputManager->getDispatcher().createInputMonitor(displayId, name, pid); } status_t NativeInputManager::removeInputChannel(JNIEnv* /* env */, @@ -1659,7 +1656,7 @@ static jobject nativeCreateInputChannel(JNIEnv* env, jclass /* clazz */, jlong p } static jobject nativeCreateInputMonitor(JNIEnv* env, jclass /* clazz */, jlong ptr, jint displayId, - jboolean isGestureMonitor, jstring nameObj, jint pid) { + jstring nameObj, jint pid) { NativeInputManager* im = reinterpret_cast(ptr); if (displayId == ADISPLAY_ID_NONE) { @@ -1672,7 +1669,7 @@ static jobject nativeCreateInputMonitor(JNIEnv* env, jclass /* clazz */, jlong p std::string name = nameChars.c_str(); base::Result> inputChannel = - im->createInputMonitor(env, displayId, isGestureMonitor, name, pid); + im->createInputMonitor(env, displayId, name, pid); if (!inputChannel.ok()) { std::string message = inputChannel.error().message(); @@ -2381,7 +2378,7 @@ static const JNINativeMethod gInputManagerMethods[] = { {"nativeGetKeyCodeForKeyLocation", "(JII)I", (void*)nativeGetKeyCodeForKeyLocation}, {"nativeCreateInputChannel", "(JLjava/lang/String;)Landroid/view/InputChannel;", (void*)nativeCreateInputChannel}, - {"nativeCreateInputMonitor", "(JIZLjava/lang/String;I)Landroid/view/InputChannel;", + {"nativeCreateInputMonitor", "(JILjava/lang/String;I)Landroid/view/InputChannel;", (void*)nativeCreateInputMonitor}, {"nativeRemoveInputChannel", "(JLandroid/os/IBinder;)V", (void*)nativeRemoveInputChannel}, {"nativePilferPointers", "(JLandroid/os/IBinder;)V", (void*)nativePilferPointers},