Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 07526c6a authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "InputManagerService: Remove gesture monitor implementation"

parents e2718dbb d35d4543
Loading
Loading
Loading
Loading
+4 −14
Original line number Diff line number Diff line
@@ -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);
        }
    }

+5 −8
Original line number Diff line number Diff line
@@ -265,7 +265,6 @@ public:
    base::Result<std::unique_ptr<InputChannel>> createInputChannel(JNIEnv* env,
                                                                   const std::string& name);
    base::Result<std::unique_ptr<InputChannel>> createInputMonitor(JNIEnv* env, int32_t displayId,
                                                                   bool isGestureMonitor,
                                                                   const std::string& name,
                                                                   int32_t pid);
    status_t removeInputChannel(JNIEnv* env, const sp<IBinder>& connectionToken);
@@ -522,11 +521,9 @@ base::Result<std::unique_ptr<InputChannel>> NativeInputManager::createInputChann
}

base::Result<std::unique_ptr<InputChannel>> 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<NativeInputManager*>(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<std::unique_ptr<InputChannel>> 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},