From 6a4a4a283d4b79f41cf46fc6eb314af4b36cc1a5 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Sat, 16 Apr 2022 09:28:24 +0200 Subject: [PATCH] Remove obsolete alternative injection method The previous commit replaced the IInterface instance (the "input" service) by the InputManager instance (retrieved by InputManager.getInstance()). Both define an "injectInputEvent" method, but the alternate version (probably) does not concern the InputManager. This reverts commit b7a06278fee0dbfbb18b651ad563d9fb0797c8bc. PR #3190 --- .../com/genymobile/scrcpy/wrappers/InputManager.java | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/server/src/main/java/com/genymobile/scrcpy/wrappers/InputManager.java b/server/src/main/java/com/genymobile/scrcpy/wrappers/InputManager.java index c42f9de1..38e96d45 100644 --- a/server/src/main/java/com/genymobile/scrcpy/wrappers/InputManager.java +++ b/server/src/main/java/com/genymobile/scrcpy/wrappers/InputManager.java @@ -15,7 +15,6 @@ public final class InputManager { private final android.hardware.input.InputManager manager; private Method injectInputEventMethod; - private boolean alternativeInjectInputEventMethod; private static Method setDisplayIdMethod; @@ -25,12 +24,7 @@ public final class InputManager { private Method getInjectInputEventMethod() throws NoSuchMethodException { if (injectInputEventMethod == null) { - try { - injectInputEventMethod = manager.getClass().getMethod("injectInputEvent", InputEvent.class, int.class); - } catch (NoSuchMethodException e) { - injectInputEventMethod = manager.getClass().getMethod("injectInputEvent", InputEvent.class, int.class, int.class); - alternativeInjectInputEventMethod = true; - } + injectInputEventMethod = manager.getClass().getMethod("injectInputEvent", InputEvent.class, int.class); } return injectInputEventMethod; } @@ -38,10 +32,6 @@ public final class InputManager { public boolean injectInputEvent(InputEvent inputEvent, int mode) { try { Method method = getInjectInputEventMethod(); - if (alternativeInjectInputEventMethod) { - // See - return (boolean) method.invoke(manager, inputEvent, mode, 0); - } return (boolean) method.invoke(manager, inputEvent, mode); } catch (InvocationTargetException | IllegalAccessException | NoSuchMethodException e) { Ln.e("Could not invoke method", e);