mirror of
https://github.com/Genymobile/scrcpy.git
synced 2024-09-12 05:21:18 +02:00
Fix java code style
This commit is contained in:
parent
acb2988837
commit
c573bd2a33
11 changed files with 25 additions and 23 deletions
|
@ -11,6 +11,8 @@ public interface AsyncProcessor {
|
||||||
}
|
}
|
||||||
|
|
||||||
void start(TerminationListener listener);
|
void start(TerminationListener listener);
|
||||||
|
|
||||||
void stop();
|
void stop();
|
||||||
|
|
||||||
void join() throws InterruptedException;
|
void join() throws InterruptedException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -289,18 +289,17 @@ public class CameraCapture extends SurfaceCapture {
|
||||||
List<OutputConfiguration> outputs = Arrays.asList(outputConfig);
|
List<OutputConfiguration> outputs = Arrays.asList(outputConfig);
|
||||||
|
|
||||||
int sessionType = highSpeed ? SessionConfiguration.SESSION_HIGH_SPEED : SessionConfiguration.SESSION_REGULAR;
|
int sessionType = highSpeed ? SessionConfiguration.SESSION_HIGH_SPEED : SessionConfiguration.SESSION_REGULAR;
|
||||||
SessionConfiguration sessionConfig = new SessionConfiguration(sessionType, outputs, cameraExecutor,
|
SessionConfiguration sessionConfig = new SessionConfiguration(sessionType, outputs, cameraExecutor, new CameraCaptureSession.StateCallback() {
|
||||||
new CameraCaptureSession.StateCallback() {
|
@Override
|
||||||
@Override
|
public void onConfigured(CameraCaptureSession session) {
|
||||||
public void onConfigured(CameraCaptureSession session) {
|
future.complete(session);
|
||||||
future.complete(session);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConfigureFailed(CameraCaptureSession session) {
|
public void onConfigureFailed(CameraCaptureSession session) {
|
||||||
future.completeExceptionally(new CameraAccessException(CameraAccessException.CAMERA_ERROR));
|
future.completeExceptionally(new CameraAccessException(CameraAccessException.CAMERA_ERROR));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
camera.createCaptureSession(sessionConfig);
|
camera.createCaptureSession(sessionConfig);
|
||||||
|
|
||||||
|
|
|
@ -318,9 +318,8 @@ public class Controller implements AsyncProcessor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MotionEvent event = MotionEvent
|
MotionEvent event = MotionEvent.obtain(lastTouchDown, now, action, pointerCount, pointerProperties, pointerCoords, 0, buttons, 1f, 1f,
|
||||||
.obtain(lastTouchDown, now, action, pointerCount, pointerProperties, pointerCoords, 0, buttons, 1f, 1f, DEFAULT_DEVICE_ID, 0, source,
|
DEFAULT_DEVICE_ID, 0, source, 0);
|
||||||
0);
|
|
||||||
return device.injectEvent(event, Device.INJECT_MODE_ASYNC);
|
return device.injectEvent(event, Device.INJECT_MODE_ASYNC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,9 +340,8 @@ public class Controller implements AsyncProcessor {
|
||||||
coords.setAxisValue(MotionEvent.AXIS_HSCROLL, hScroll);
|
coords.setAxisValue(MotionEvent.AXIS_HSCROLL, hScroll);
|
||||||
coords.setAxisValue(MotionEvent.AXIS_VSCROLL, vScroll);
|
coords.setAxisValue(MotionEvent.AXIS_VSCROLL, vScroll);
|
||||||
|
|
||||||
MotionEvent event = MotionEvent
|
MotionEvent event = MotionEvent.obtain(lastTouchDown, now, MotionEvent.ACTION_SCROLL, 1, pointerProperties, pointerCoords, 0, buttons, 1f, 1f,
|
||||||
.obtain(lastTouchDown, now, MotionEvent.ACTION_SCROLL, 1, pointerProperties, pointerCoords, 0, buttons, 1f, 1f, DEFAULT_DEVICE_ID, 0,
|
DEFAULT_DEVICE_ID, 0, InputDevice.SOURCE_MOUSE, 0);
|
||||||
InputDevice.SOURCE_MOUSE, 0);
|
|
||||||
return device.injectEvent(event, Device.INJECT_MODE_ASYNC);
|
return device.injectEvent(event, Device.INJECT_MODE_ASYNC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,8 @@ import android.graphics.Rect;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.view.IRotationWatcher;
|
|
||||||
import android.view.IDisplayFoldListener;
|
import android.view.IDisplayFoldListener;
|
||||||
|
import android.view.IRotationWatcher;
|
||||||
import android.view.InputDevice;
|
import android.view.InputDevice;
|
||||||
import android.view.InputEvent;
|
import android.view.InputEvent;
|
||||||
import android.view.KeyCharacterMap;
|
import android.view.KeyCharacterMap;
|
||||||
|
|
|
@ -51,6 +51,7 @@ public final class DeviceMessageSender {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start() {
|
public void start() {
|
||||||
thread = new Thread(() -> {
|
thread = new Thread(() -> {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -11,6 +11,7 @@ import java.util.List;
|
||||||
public final class Server {
|
public final class Server {
|
||||||
|
|
||||||
public static final String SERVER_PATH;
|
public static final String SERVER_PATH;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
String[] classPaths = System.getProperty("java.class.path").split(File.pathSeparator);
|
String[] classPaths = System.getProperty("java.class.path").split(File.pathSeparator);
|
||||||
// By convention, scrcpy is always executed with the absolute path of scrcpy-server.jar as the first item in the classpath
|
// By convention, scrcpy is always executed with the absolute path of scrcpy-server.jar as the first item in the classpath
|
||||||
|
|
|
@ -75,7 +75,7 @@ public final class Settings {
|
||||||
|
|
||||||
String oldValue = getValue(table, key);
|
String oldValue = getValue(table, key);
|
||||||
if (!value.equals(oldValue)) {
|
if (!value.equals(oldValue)) {
|
||||||
putValue(table, key, value);
|
putValue(table, key, value);
|
||||||
}
|
}
|
||||||
return oldValue;
|
return oldValue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,8 +138,8 @@ public final class ClipboardManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void addPrimaryClipChangedListener(Method method, int methodVersion, IInterface manager,
|
private static void addPrimaryClipChangedListener(Method method, int methodVersion, IInterface manager, IOnPrimaryClipChangedListener listener)
|
||||||
IOnPrimaryClipChangedListener listener) throws InvocationTargetException, IllegalAccessException {
|
throws InvocationTargetException, IllegalAccessException {
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
|
||||||
method.invoke(manager, listener, FakeContext.PACKAGE_NAME);
|
method.invoke(manager, listener, FakeContext.PACKAGE_NAME);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -20,7 +20,7 @@ public final class PowerManager {
|
||||||
private Method getIsScreenOnMethod() throws NoSuchMethodException {
|
private Method getIsScreenOnMethod() throws NoSuchMethodException {
|
||||||
if (isScreenOnMethod == null) {
|
if (isScreenOnMethod == null) {
|
||||||
@SuppressLint("ObsoleteSdkInt") // we may lower minSdkVersion in the future
|
@SuppressLint("ObsoleteSdkInt") // we may lower minSdkVersion in the future
|
||||||
String methodName = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH ? "isInteractive" : "isScreenOn";
|
String methodName = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH ? "isInteractive" : "isScreenOn";
|
||||||
isScreenOnMethod = manager.getClass().getMethod(methodName);
|
isScreenOnMethod = manager.getClass().getMethod(methodName);
|
||||||
}
|
}
|
||||||
return isScreenOnMethod;
|
return isScreenOnMethod;
|
||||||
|
|
|
@ -16,6 +16,7 @@ import java.lang.reflect.Method;
|
||||||
public final class ServiceManager {
|
public final class ServiceManager {
|
||||||
|
|
||||||
private static final Method GET_SERVICE_METHOD;
|
private static final Method GET_SERVICE_METHOD;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
GET_SERVICE_METHOD = Class.forName("android.os.ServiceManager").getDeclaredMethod("getService", String.class);
|
GET_SERVICE_METHOD = Class.forName("android.os.ServiceManager").getDeclaredMethod("getService", String.class);
|
||||||
|
|
|
@ -4,8 +4,8 @@ import com.genymobile.scrcpy.Ln;
|
||||||
|
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
import android.os.IInterface;
|
import android.os.IInterface;
|
||||||
import android.view.IRotationWatcher;
|
|
||||||
import android.view.IDisplayFoldListener;
|
import android.view.IDisplayFoldListener;
|
||||||
|
import android.view.IRotationWatcher;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
Loading…
Reference in a new issue