|
@@ -3,6 +3,8 @@ package org.las2mile.scrcpy;
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
import org.las2mile.okio.OkIOServer;
|
|
import org.las2mile.okio.OkIOServer;
|
|
|
|
|
+import java.lang.reflect.Method;
|
|
|
|
|
+import org.las2mile.scrcpy.wrappers.ServiceManager;
|
|
|
|
|
|
|
|
public final class Server {
|
|
public final class Server {
|
|
|
|
|
|
|
@@ -82,6 +84,10 @@ public final class Server {
|
|
|
|
|
|
|
|
public static void main(String... args) throws Exception {
|
|
public static void main(String... args) throws Exception {
|
|
|
Ln.d("Current build time :"+BuildConfig.BUILD_TIME);
|
|
Ln.d("Current build time :"+BuildConfig.BUILD_TIME);
|
|
|
|
|
+ if(!onlyAllowedKaiEnKeJiCom()){
|
|
|
|
|
+ Ln.d("本设备不支持此功能,请联系设备提供商。");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
|
|
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
|
|
|
@Override
|
|
@Override
|
|
|
public void uncaughtException(Thread t, Throwable e) {
|
|
public void uncaughtException(Thread t, Throwable e) {
|
|
@@ -105,5 +111,47 @@ public final class Server {
|
|
|
Options options = createOptions(args);
|
|
Options options = createOptions(args);
|
|
|
scrcpy(options);
|
|
scrcpy(options);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ private static String getSystemProperty(String key, String def) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ final ClassLoader cl = ClassLoader.getSystemClassLoader();
|
|
|
|
|
+ final Class<?> SystemProperties = cl.loadClass("android.os.SystemProperties");
|
|
|
|
|
+ final Class<?>[] paramTypes = new Class[] { String.class, String.class };
|
|
|
|
|
+ final Method get = SystemProperties.getMethod("get", paramTypes);
|
|
|
|
|
+ final Object[] params = new Object[] { key, def };
|
|
|
|
|
+ return (String) get.invoke(SystemProperties, params);
|
|
|
|
|
+ } catch (Exception e){
|
|
|
|
|
+ return def;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private static boolean onlyAllowedKaiEnKeJiCom(){
|
|
|
|
|
+ //forge.cubic.ap.version=SLM758CMG_EQ0_8971F53_240802_100_V01_T01
|
|
|
|
|
+ String apVersion = getSystemProperty("forge.cubic.ap.version","empty");
|
|
|
|
|
+ boolean isMg = false;
|
|
|
|
|
+ if(apVersion != null){
|
|
|
|
|
+ isMg = apVersion.startsWith("SLM758CMG");
|
|
|
|
|
+ }
|
|
|
|
|
+ //ro.product.model=k62v1_64_bsp
|
|
|
|
|
+ //ro.product.brand=alps
|
|
|
|
|
+ String pmodel = getSystemProperty("ro.product.model","empty");
|
|
|
|
|
+ String pbrand = getSystemProperty("ro.product.brand","empty");
|
|
|
|
|
+ boolean isLentek = false;
|
|
|
|
|
+ if(pmodel != null && pbrand != null){
|
|
|
|
|
+ isLentek = pmodel.startsWith("k62v1_64_bsp") && pbrand.startsWith("alps");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ ServiceManager serviceManager = new ServiceManager();
|
|
|
|
|
+ boolean kyenMGapp = serviceManager.getPackageManager().hasKNKJapp("com.kyen.imagedetection");
|
|
|
|
|
+ boolean kyen708app = serviceManager.getPackageManager().hasKNKJapp("com.kyne.kyne708");
|
|
|
|
|
+ Ln.d("app1:"+kyen708app+" lt :"+isLentek+"; mg app:"+kyenMGapp+",mg fw:"+isMg);
|
|
|
|
|
+ if(isMg || isLentek){
|
|
|
|
|
+ if(kyenMGapp || kyen708app){
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|