今天用了下Vysor,可以实现屏幕共享和远程控制,并且不需要root,而且可以兼容所有版本Android,功能很是强大,反编译了,下面是根据Vysor源码精简的功能。
import android.graphics.Bitmap;
import android.graphics.Point;
import android.hardware.input.InputManager;
import android.os.Build;
import android.os.Handler;
import android.os.SystemClock;
import android.support.v4.view.InputDeviceCompat;
import android.view.InputEvent;
import android.view.KeyEvent;
import android.view.MotionEvent;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/**
* Created by wanjian on 2017/4/4.
*/
public class Main {
private static InputManager im;
private static Method injectInputEventMethod;
private static long downTime;
public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException, FileNotFoundException {
if ("screenshot".equals(args[0])) {
screenShot();
return;
}
initEvent();
if ("home".equals(args[0])) {
System.out.println("home");
pressHome();
return;
}
if ("touch".equals(args[0])) {
System.out.println("slide");
slideScreen();
return;
}
if ("back".equals(args[0])) {
System.out.println("back");
back();
return;
}
}
private static void screenShot() throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException, FileNotFoundException {
System.out.prin