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 b7a06278fe
.
PR #3190 <https://github.com/Genymobile/scrcpy/pull/3190>
This commit is contained in:
parent
7d8b72d4a6
commit
6a4a4a283d
1 changed files with 1 additions and 11 deletions
|
@ -15,7 +15,6 @@ public final class InputManager {
|
||||||
|
|
||||||
private final android.hardware.input.InputManager manager;
|
private final android.hardware.input.InputManager manager;
|
||||||
private Method injectInputEventMethod;
|
private Method injectInputEventMethod;
|
||||||
private boolean alternativeInjectInputEventMethod;
|
|
||||||
|
|
||||||
private static Method setDisplayIdMethod;
|
private static Method setDisplayIdMethod;
|
||||||
|
|
||||||
|
@ -25,12 +24,7 @@ public final class InputManager {
|
||||||
|
|
||||||
private Method getInjectInputEventMethod() throws NoSuchMethodException {
|
private Method getInjectInputEventMethod() throws NoSuchMethodException {
|
||||||
if (injectInputEventMethod == null) {
|
if (injectInputEventMethod == null) {
|
||||||
try {
|
|
||||||
injectInputEventMethod = manager.getClass().getMethod("injectInputEvent", InputEvent.class, int.class);
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return injectInputEventMethod;
|
return injectInputEventMethod;
|
||||||
}
|
}
|
||||||
|
@ -38,10 +32,6 @@ public final class InputManager {
|
||||||
public boolean injectInputEvent(InputEvent inputEvent, int mode) {
|
public boolean injectInputEvent(InputEvent inputEvent, int mode) {
|
||||||
try {
|
try {
|
||||||
Method method = getInjectInputEventMethod();
|
Method method = getInjectInputEventMethod();
|
||||||
if (alternativeInjectInputEventMethod) {
|
|
||||||
// See <https://github.com/Genymobile/scrcpy/issues/2250>
|
|
||||||
return (boolean) method.invoke(manager, inputEvent, mode, 0);
|
|
||||||
}
|
|
||||||
return (boolean) method.invoke(manager, inputEvent, mode);
|
return (boolean) method.invoke(manager, inputEvent, mode);
|
||||||
} catch (InvocationTargetException | IllegalAccessException | NoSuchMethodException e) {
|
} catch (InvocationTargetException | IllegalAccessException | NoSuchMethodException e) {
|
||||||
Ln.e("Could not invoke method", e);
|
Ln.e("Could not invoke method", e);
|
||||||
|
|
Loading…
Reference in a new issue