diff --git a/server/src/main/java/com/genymobile/scrcpy/ControlMessage.java b/server/src/main/java/com/genymobile/scrcpy/ControlMessage.java index 30c05a3b..615773fb 100644 --- a/server/src/main/java/com/genymobile/scrcpy/ControlMessage.java +++ b/server/src/main/java/com/genymobile/scrcpy/ControlMessage.java @@ -47,8 +47,7 @@ public final class ControlMessage { return msg; } - public static ControlMessage createInjectTouchEvent(int action, long pointerId, Position position, float pressure, - int buttons) { + public static ControlMessage createInjectTouchEvent(int action, long pointerId, Position position, float pressure, int buttons) { ControlMessage msg = new ControlMessage(); msg.type = TYPE_INJECT_TOUCH_EVENT; msg.action = action; diff --git a/server/src/main/java/com/genymobile/scrcpy/Controller.java b/server/src/main/java/com/genymobile/scrcpy/Controller.java index ce02e333..65feda55 100644 --- a/server/src/main/java/com/genymobile/scrcpy/Controller.java +++ b/server/src/main/java/com/genymobile/scrcpy/Controller.java @@ -21,10 +21,8 @@ public class Controller { private long lastTouchDown; private final PointersState pointersState = new PointersState(); - private final MotionEvent.PointerProperties[] pointerProperties = - new MotionEvent.PointerProperties[PointersState.MAX_POINTERS]; - private final MotionEvent.PointerCoords[] pointerCoords = - new MotionEvent.PointerCoords[PointersState.MAX_POINTERS]; + private final MotionEvent.PointerProperties[] pointerProperties = new MotionEvent.PointerProperties[PointersState.MAX_POINTERS]; + private final MotionEvent.PointerCoords[] pointerCoords = new MotionEvent.PointerCoords[PointersState.MAX_POINTERS]; public Controller(Device device, DesktopConnection connection) { this.device = device; @@ -176,8 +174,8 @@ public class Controller { } } - MotionEvent event = MotionEvent.obtain(lastTouchDown, now, action, pointerCount, pointerProperties, - pointerCoords, 0, buttons, 1f, 1f, 0, 0, InputDevice.SOURCE_TOUCHSCREEN, 0); + MotionEvent event = MotionEvent.obtain(lastTouchDown, now, action, pointerCount, pointerProperties, pointerCoords, 0, buttons, 1f, 1f, 0, 0, + InputDevice.SOURCE_TOUCHSCREEN, 0); return injectEvent(event); } @@ -198,15 +196,15 @@ public class Controller { coords.setAxisValue(MotionEvent.AXIS_HSCROLL, hScroll); coords.setAxisValue(MotionEvent.AXIS_VSCROLL, vScroll); - MotionEvent event = MotionEvent.obtain(lastTouchDown, now, MotionEvent.ACTION_SCROLL, 1, pointerProperties, - pointerCoords, 0, 0, 1f, 1f, 0, 0, InputDevice.SOURCE_MOUSE, 0); + MotionEvent event = MotionEvent.obtain(lastTouchDown, now, MotionEvent.ACTION_SCROLL, 1, pointerProperties, pointerCoords, 0, 0, 1f, 1f, 0, 0, + InputDevice.SOURCE_MOUSE, 0); return injectEvent(event); } private boolean injectKeyEvent(int action, int keyCode, int repeat, int metaState) { long now = SystemClock.uptimeMillis(); - KeyEvent event = new KeyEvent(now, now, action, keyCode, repeat, metaState, KeyCharacterMap.VIRTUAL_KEYBOARD, - 0, 0, InputDevice.SOURCE_KEYBOARD); + KeyEvent event = new KeyEvent(now, now, action, keyCode, repeat, metaState, KeyCharacterMap.VIRTUAL_KEYBOARD, 0, 0, + InputDevice.SOURCE_KEYBOARD); return injectEvent(event); } diff --git a/server/src/main/java/com/genymobile/scrcpy/Ln.java b/server/src/main/java/com/genymobile/scrcpy/Ln.java index bb741225..26f13a56 100644 --- a/server/src/main/java/com/genymobile/scrcpy/Ln.java +++ b/server/src/main/java/com/genymobile/scrcpy/Ln.java @@ -12,10 +12,7 @@ public final class Ln { private static final String PREFIX = "[server] "; enum Level { - DEBUG, - INFO, - WARN, - ERROR; + DEBUG, INFO, WARN, ERROR } private static final Level THRESHOLD = BuildConfig.DEBUG ? Level.DEBUG : Level.INFO; diff --git a/server/src/main/java/com/genymobile/scrcpy/Point.java b/server/src/main/java/com/genymobile/scrcpy/Point.java index 9ef2db03..c2a30fa8 100644 --- a/server/src/main/java/com/genymobile/scrcpy/Point.java +++ b/server/src/main/java/com/genymobile/scrcpy/Point.java @@ -28,8 +28,7 @@ public class Point { return false; } Point point = (Point) o; - return x == point.x - && y == point.y; + return x == point.x && y == point.y; } @Override @@ -39,9 +38,6 @@ public class Point { @Override public String toString() { - return "Point{" - + "x=" + x - + ", y=" + y - + '}'; + return "Point{" + "x=" + x + ", y=" + y + '}'; } } diff --git a/server/src/main/java/com/genymobile/scrcpy/Position.java b/server/src/main/java/com/genymobile/scrcpy/Position.java index 757fa36e..b46d2f73 100644 --- a/server/src/main/java/com/genymobile/scrcpy/Position.java +++ b/server/src/main/java/com/genymobile/scrcpy/Position.java @@ -32,8 +32,7 @@ public class Position { return false; } Position position = (Position) o; - return Objects.equals(point, position.point) - && Objects.equals(screenSize, position.screenSize); + return Objects.equals(point, position.point) && Objects.equals(screenSize, position.screenSize); } @Override @@ -43,10 +42,7 @@ public class Position { @Override public String toString() { - return "Position{" - + "point=" + point - + ", screenSize=" + screenSize - + '}'; + return "Position{" + "point=" + point + ", screenSize=" + screenSize + '}'; } } diff --git a/server/src/main/java/com/genymobile/scrcpy/Server.java b/server/src/main/java/com/genymobile/scrcpy/Server.java index 26ef2850..d4691e7c 100644 --- a/server/src/main/java/com/genymobile/scrcpy/Server.java +++ b/server/src/main/java/com/genymobile/scrcpy/Server.java @@ -73,8 +73,8 @@ public final class Server { String clientVersion = args[0]; if (!clientVersion.equals(BuildConfig.VERSION_NAME)) { - throw new IllegalArgumentException("The server version (" + clientVersion + ") does not match the client " - + "(" + BuildConfig.VERSION_NAME + ")"); + throw new IllegalArgumentException( + "The server version (" + clientVersion + ") does not match the client " + "(" + BuildConfig.VERSION_NAME + ")"); } if (args.length != 8) { diff --git a/server/src/main/java/com/genymobile/scrcpy/Size.java b/server/src/main/java/com/genymobile/scrcpy/Size.java index 0d546bbd..fd4b6971 100644 --- a/server/src/main/java/com/genymobile/scrcpy/Size.java +++ b/server/src/main/java/com/genymobile/scrcpy/Size.java @@ -38,8 +38,7 @@ public final class Size { return false; } Size size = (Size) o; - return width == size.width - && height == size.height; + return width == size.width && height == size.height; } @Override @@ -49,9 +48,6 @@ public final class Size { @Override public String toString() { - return "Size{" - + "width=" + width - + ", height=" + height - + '}'; + return "Size{" + "width=" + width + ", height=" + height + '}'; } } diff --git a/server/src/main/java/com/genymobile/scrcpy/wrappers/ClipboardManager.java b/server/src/main/java/com/genymobile/scrcpy/wrappers/ClipboardManager.java index 27dcb443..ebd89238 100644 --- a/server/src/main/java/com/genymobile/scrcpy/wrappers/ClipboardManager.java +++ b/server/src/main/java/com/genymobile/scrcpy/wrappers/ClipboardManager.java @@ -43,8 +43,7 @@ public class ClipboardManager { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) { setPrimaryClipMethod = manager.getClass().getMethod("setPrimaryClip", ClipData.class, String.class); } else { - setPrimaryClipMethod = manager.getClass().getMethod("setPrimaryClip", ClipData.class, - String.class, int.class); + setPrimaryClipMethod = manager.getClass().getMethod("setPrimaryClip", ClipData.class, String.class, int.class); } } catch (NoSuchMethodException e) { Ln.e("Could not find method", e); @@ -53,16 +52,15 @@ public class ClipboardManager { return setPrimaryClipMethod; } - private static ClipData getPrimaryClip(Method method, IInterface manager) throws InvocationTargetException, - IllegalAccessException { + private static ClipData getPrimaryClip(Method method, IInterface manager) throws InvocationTargetException, IllegalAccessException { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) { return (ClipData) method.invoke(manager, PACKAGE_NAME); } return (ClipData) method.invoke(manager, PACKAGE_NAME, USER_ID); } - private static void setPrimaryClip(Method method, IInterface manager, ClipData clipData) throws InvocationTargetException, - IllegalAccessException { + private static void setPrimaryClip(Method method, IInterface manager, ClipData clipData) + throws InvocationTargetException, IllegalAccessException { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) { method.invoke(manager, clipData, PACKAGE_NAME); } else {