Reorganize server packages

There are now a lot of classes in the server, reorganize them into
subpackages.
This commit is contained in:
Romain Vimont 2024-07-11 22:38:00 +02:00
parent 80ca7b15e5
commit e84db2914d
67 changed files with 204 additions and 70 deletions

View File

@ -52,6 +52,11 @@ cd "$SERVER_DIR/src/main/aidl"
SRC=( \
com/genymobile/scrcpy/*.java \
com/genymobile/scrcpy/audio/*.java \
com/genymobile/scrcpy/control/*.java \
com/genymobile/scrcpy/device/*.java \
com/genymobile/scrcpy/util/*.java \
com/genymobile/scrcpy/video/*.java \
com/genymobile/scrcpy/wrappers/*.java \
)

View File

@ -1,5 +1,10 @@
package com.genymobile.scrcpy;
import com.genymobile.scrcpy.device.Device;
import com.genymobile.scrcpy.util.Ln;
import com.genymobile.scrcpy.util.Settings;
import com.genymobile.scrcpy.util.SettingsException;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;

View File

@ -1,5 +1,15 @@
package com.genymobile.scrcpy;
import com.genymobile.scrcpy.audio.AudioCodec;
import com.genymobile.scrcpy.audio.AudioSource;
import com.genymobile.scrcpy.device.Size;
import com.genymobile.scrcpy.util.CodecOption;
import com.genymobile.scrcpy.util.Ln;
import com.genymobile.scrcpy.video.CameraAspectRatio;
import com.genymobile.scrcpy.video.CameraFacing;
import com.genymobile.scrcpy.video.VideoCodec;
import com.genymobile.scrcpy.video.VideoSource;
import android.graphics.Rect;
import java.util.List;

View File

@ -1,5 +1,26 @@
package com.genymobile.scrcpy;
import com.genymobile.scrcpy.audio.AudioCapture;
import com.genymobile.scrcpy.audio.AudioCodec;
import com.genymobile.scrcpy.audio.AudioEncoder;
import com.genymobile.scrcpy.audio.AudioRawRecorder;
import com.genymobile.scrcpy.control.ControlChannel;
import com.genymobile.scrcpy.control.Controller;
import com.genymobile.scrcpy.control.DeviceMessage;
import com.genymobile.scrcpy.device.ConfigurationException;
import com.genymobile.scrcpy.device.DesktopConnection;
import com.genymobile.scrcpy.device.Device;
import com.genymobile.scrcpy.device.Streamer;
import com.genymobile.scrcpy.util.Ln;
import com.genymobile.scrcpy.util.LogUtils;
import com.genymobile.scrcpy.util.Settings;
import com.genymobile.scrcpy.util.SettingsException;
import com.genymobile.scrcpy.video.CameraCapture;
import com.genymobile.scrcpy.video.ScreenCapture;
import com.genymobile.scrcpy.video.SurfaceCapture;
import com.genymobile.scrcpy.video.SurfaceEncoder;
import com.genymobile.scrcpy.video.VideoSource;
import android.os.BatteryManager;
import android.os.Build;

View File

@ -1,5 +1,7 @@
package com.genymobile.scrcpy;
import com.genymobile.scrcpy.util.Ln;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Application;

View File

@ -1,5 +1,8 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.audio;
import com.genymobile.scrcpy.FakeContext;
import com.genymobile.scrcpy.util.Ln;
import com.genymobile.scrcpy.Workarounds;
import com.genymobile.scrcpy.wrappers.ServiceManager;
import android.annotation.SuppressLint;

View File

@ -1,4 +1,4 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.audio;
/**
* Exception thrown if audio capture failed on Android 11 specifically because the running App (shell) was not in foreground.

View File

@ -1,4 +1,6 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.audio;
import com.genymobile.scrcpy.util.Codec;
import android.media.MediaFormat;

View File

@ -1,4 +1,14 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.audio;
import com.genymobile.scrcpy.AsyncProcessor;
import com.genymobile.scrcpy.util.Codec;
import com.genymobile.scrcpy.util.CodecOption;
import com.genymobile.scrcpy.util.CodecUtils;
import com.genymobile.scrcpy.device.ConfigurationException;
import com.genymobile.scrcpy.util.IO;
import com.genymobile.scrcpy.util.Ln;
import com.genymobile.scrcpy.util.LogUtils;
import com.genymobile.scrcpy.device.Streamer;
import android.annotation.TargetApi;
import android.media.MediaCodec;

View File

@ -1,4 +1,9 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.audio;
import com.genymobile.scrcpy.AsyncProcessor;
import com.genymobile.scrcpy.util.IO;
import com.genymobile.scrcpy.util.Ln;
import com.genymobile.scrcpy.device.Streamer;
import android.media.MediaCodec;
import android.os.Build;

View File

@ -1,4 +1,4 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.audio;
import android.media.MediaRecorder;
@ -18,7 +18,7 @@ public enum AudioSource {
return value;
}
static AudioSource findByName(String name) {
public static AudioSource findByName(String name) {
for (AudioSource audioSource : AudioSource.values()) {
if (name.equals(audioSource.name)) {
return audioSource;

View File

@ -1,4 +1,4 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.control;
import android.net.LocalSocket;

View File

@ -1,4 +1,6 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.control;
import com.genymobile.scrcpy.device.Position;
/**
* Union of all supported event types, identified by their {@code type}.

View File

@ -1,4 +1,8 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.control;
import com.genymobile.scrcpy.util.Binary;
import com.genymobile.scrcpy.util.Ln;
import com.genymobile.scrcpy.device.Position;
import java.io.EOFException;
import java.io.IOException;

View File

@ -1,5 +1,11 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.control;
import com.genymobile.scrcpy.AsyncProcessor;
import com.genymobile.scrcpy.CleanUp;
import com.genymobile.scrcpy.device.Device;
import com.genymobile.scrcpy.util.Ln;
import com.genymobile.scrcpy.device.Point;
import com.genymobile.scrcpy.device.Position;
import com.genymobile.scrcpy.wrappers.InputManager;
import com.genymobile.scrcpy.wrappers.ServiceManager;

View File

@ -1,4 +1,4 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.control;
public final class DeviceMessage {

View File

@ -1,4 +1,6 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.control;
import com.genymobile.scrcpy.util.Ln;
import java.io.IOException;
import java.util.concurrent.ArrayBlockingQueue;

View File

@ -1,4 +1,7 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.control;
import com.genymobile.scrcpy.util.Ln;
import com.genymobile.scrcpy.util.StringUtils;
import java.io.IOException;
import java.io.OutputStream;

View File

@ -1,4 +1,4 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.control;
import java.util.HashMap;
import java.util.Map;

View File

@ -1,4 +1,6 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.control;
import com.genymobile.scrcpy.device.Point;
public class Pointer {

View File

@ -1,4 +1,6 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.control;
import com.genymobile.scrcpy.device.Point;
import android.view.MotionEvent;

View File

@ -1,4 +1,6 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.control;
import com.genymobile.scrcpy.util.Ln;
import android.os.Build;
import android.os.HandlerThread;

View File

@ -1,4 +1,4 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.device;
public class ConfigurationException extends Exception {
public ConfigurationException(String message) {

View File

@ -1,4 +1,8 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.device;
import com.genymobile.scrcpy.control.ControlChannel;
import com.genymobile.scrcpy.util.IO;
import com.genymobile.scrcpy.util.StringUtils;
import android.net.LocalServerSocket;
import android.net.LocalSocket;

View File

@ -1,5 +1,9 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.device;
import com.genymobile.scrcpy.Options;
import com.genymobile.scrcpy.util.Ln;
import com.genymobile.scrcpy.util.LogUtils;
import com.genymobile.scrcpy.video.ScreenInfo;
import com.genymobile.scrcpy.wrappers.ClipboardManager;
import com.genymobile.scrcpy.wrappers.DisplayControl;
import com.genymobile.scrcpy.wrappers.InputManager;

View File

@ -1,4 +1,4 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.device;
public final class DisplayInfo {
private final int displayId;

View File

@ -1,4 +1,4 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.device;
import java.util.Objects;

View File

@ -1,4 +1,4 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.device;
import java.util.Objects;

View File

@ -1,4 +1,4 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.device;
import android.graphics.Rect;

View File

@ -1,4 +1,8 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.device;
import com.genymobile.scrcpy.audio.AudioCodec;
import com.genymobile.scrcpy.util.Codec;
import com.genymobile.scrcpy.util.IO;
import android.media.MediaCodec;

View File

@ -1,4 +1,4 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.util;
public final class Binary {
private Binary() {

View File

@ -1,4 +1,4 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.util;
public interface Codec {

View File

@ -1,4 +1,4 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.util;
import java.util.ArrayList;
import java.util.List;

View File

@ -1,4 +1,7 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.util;
import com.genymobile.scrcpy.audio.AudioCodec;
import com.genymobile.scrcpy.video.VideoCodec;
import android.media.MediaCodecInfo;
import android.media.MediaCodecList;

View File

@ -1,4 +1,4 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.util;
import java.io.IOException;
import java.util.Arrays;

View File

@ -1,4 +1,4 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.util;
import android.os.Handler;

View File

@ -1,4 +1,6 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.util;
import com.genymobile.scrcpy.BuildConfig;
import android.system.ErrnoException;
import android.system.Os;

View File

@ -1,4 +1,4 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.util;
import android.util.Log;
@ -19,7 +19,7 @@ public final class Ln {
private static final PrintStream CONSOLE_OUT = new PrintStream(new FileOutputStream(FileDescriptor.out));
private static final PrintStream CONSOLE_ERR = new PrintStream(new FileOutputStream(FileDescriptor.err));
enum Level {
public enum Level {
VERBOSE, DEBUG, INFO, WARN, ERROR
}

View File

@ -1,5 +1,7 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.util;
import com.genymobile.scrcpy.device.DisplayInfo;
import com.genymobile.scrcpy.device.Size;
import com.genymobile.scrcpy.wrappers.DisplayManager;
import com.genymobile.scrcpy.wrappers.ServiceManager;

View File

@ -1,4 +1,4 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.util;
import com.genymobile.scrcpy.wrappers.ContentProvider;
import com.genymobile.scrcpy.wrappers.ServiceManager;

View File

@ -1,4 +1,4 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.util;
public class SettingsException extends Exception {
private static String createMessage(String method, String table, String key, String value) {

View File

@ -1,4 +1,4 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.util;
public final class StringUtils {
private StringUtils() {

View File

@ -1,4 +1,4 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.video;
public final class CameraAspectRatio {
private static final float SENSOR = -1;

View File

@ -1,5 +1,8 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.video;
import com.genymobile.scrcpy.util.HandlerExecutor;
import com.genymobile.scrcpy.util.Ln;
import com.genymobile.scrcpy.device.Size;
import com.genymobile.scrcpy.wrappers.ServiceManager;
import android.annotation.SuppressLint;

View File

@ -1,4 +1,4 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.video;
import android.annotation.SuppressLint;
import android.hardware.camera2.CameraCharacteristics;
@ -21,7 +21,7 @@ public enum CameraFacing {
return value;
}
static CameraFacing findByName(String name) {
public static CameraFacing findByName(String name) {
for (CameraFacing facing : CameraFacing.values()) {
if (name.equals(facing.name)) {
return facing;

View File

@ -1,5 +1,8 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.video;
import com.genymobile.scrcpy.device.Device;
import com.genymobile.scrcpy.util.Ln;
import com.genymobile.scrcpy.device.Size;
import com.genymobile.scrcpy.wrappers.ServiceManager;
import com.genymobile.scrcpy.wrappers.SurfaceControl;

View File

@ -1,4 +1,9 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.video;
import com.genymobile.scrcpy.BuildConfig;
import com.genymobile.scrcpy.device.Device;
import com.genymobile.scrcpy.util.Ln;
import com.genymobile.scrcpy.device.Size;
import android.graphics.Rect;

View File

@ -1,4 +1,6 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.video;
import com.genymobile.scrcpy.device.Size;
import android.view.Surface;

View File

@ -1,4 +1,15 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.video;
import com.genymobile.scrcpy.AsyncProcessor;
import com.genymobile.scrcpy.util.Codec;
import com.genymobile.scrcpy.util.CodecOption;
import com.genymobile.scrcpy.util.CodecUtils;
import com.genymobile.scrcpy.device.ConfigurationException;
import com.genymobile.scrcpy.util.IO;
import com.genymobile.scrcpy.util.Ln;
import com.genymobile.scrcpy.util.LogUtils;
import com.genymobile.scrcpy.device.Size;
import com.genymobile.scrcpy.device.Streamer;
import android.media.MediaCodec;
import android.media.MediaCodecInfo;

View File

@ -1,4 +1,6 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.video;
import com.genymobile.scrcpy.util.Codec;
import android.annotation.SuppressLint;
import android.media.MediaFormat;

View File

@ -1,4 +1,4 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.video;
public enum VideoSource {
DISPLAY("display"),
@ -10,7 +10,7 @@ public enum VideoSource {
this.name = name;
}
static VideoSource findByName(String name) {
public static VideoSource findByName(String name) {
for (VideoSource videoSource : VideoSource.values()) {
if (name.equals(videoSource.name)) {
return videoSource;

View File

@ -1,7 +1,7 @@
package com.genymobile.scrcpy.wrappers;
import com.genymobile.scrcpy.FakeContext;
import com.genymobile.scrcpy.Ln;
import com.genymobile.scrcpy.util.Ln;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;

View File

@ -1,7 +1,7 @@
package com.genymobile.scrcpy.wrappers;
import com.genymobile.scrcpy.FakeContext;
import com.genymobile.scrcpy.Ln;
import com.genymobile.scrcpy.util.Ln;
import android.content.ClipData;
import android.content.IOnPrimaryClipChangedListener;

View File

@ -1,8 +1,8 @@
package com.genymobile.scrcpy.wrappers;
import com.genymobile.scrcpy.FakeContext;
import com.genymobile.scrcpy.Ln;
import com.genymobile.scrcpy.SettingsException;
import com.genymobile.scrcpy.util.Ln;
import com.genymobile.scrcpy.util.SettingsException;
import android.annotation.SuppressLint;
import android.content.AttributionSource;

View File

@ -1,6 +1,6 @@
package com.genymobile.scrcpy.wrappers;
import com.genymobile.scrcpy.Ln;
import com.genymobile.scrcpy.util.Ln;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;

View File

@ -1,9 +1,9 @@
package com.genymobile.scrcpy.wrappers;
import com.genymobile.scrcpy.Command;
import com.genymobile.scrcpy.DisplayInfo;
import com.genymobile.scrcpy.Ln;
import com.genymobile.scrcpy.Size;
import com.genymobile.scrcpy.util.Command;
import com.genymobile.scrcpy.device.DisplayInfo;
import com.genymobile.scrcpy.util.Ln;
import com.genymobile.scrcpy.device.Size;
import android.annotation.SuppressLint;
import android.hardware.display.VirtualDisplay;

View File

@ -1,6 +1,6 @@
package com.genymobile.scrcpy.wrappers;
import com.genymobile.scrcpy.Ln;
import com.genymobile.scrcpy.util.Ln;
import android.annotation.SuppressLint;
import android.view.InputEvent;

View File

@ -1,6 +1,6 @@
package com.genymobile.scrcpy.wrappers;
import com.genymobile.scrcpy.Ln;
import com.genymobile.scrcpy.util.Ln;
import android.annotation.SuppressLint;
import android.os.Build;

View File

@ -1,6 +1,6 @@
package com.genymobile.scrcpy.wrappers;
import com.genymobile.scrcpy.Ln;
import com.genymobile.scrcpy.util.Ln;
import android.os.IInterface;

View File

@ -1,6 +1,6 @@
package com.genymobile.scrcpy.wrappers;
import com.genymobile.scrcpy.Ln;
import com.genymobile.scrcpy.util.Ln;
import android.annotation.SuppressLint;
import android.graphics.Rect;

View File

@ -1,6 +1,6 @@
package com.genymobile.scrcpy.wrappers;
import com.genymobile.scrcpy.Ln;
import com.genymobile.scrcpy.util.Ln;
import android.annotation.TargetApi;
import android.os.IInterface;

View File

@ -1,4 +1,6 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.control;
import com.genymobile.scrcpy.device.Device;
import android.view.KeyEvent;
import android.view.MotionEvent;

View File

@ -1,4 +1,4 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.control;
import org.junit.Assert;
import org.junit.Test;

View File

@ -1,4 +1,4 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.util;
import org.junit.Assert;
import org.junit.Test;

View File

@ -1,4 +1,4 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.util;
import org.junit.Assert;
import org.junit.Test;

View File

@ -1,5 +1,6 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.util;
import com.genymobile.scrcpy.device.DisplayInfo;
import com.genymobile.scrcpy.wrappers.DisplayManager;
import android.view.Display;

View File

@ -1,4 +1,4 @@
package com.genymobile.scrcpy;
package com.genymobile.scrcpy.util;
import org.junit.Assert;
import org.junit.Test;