Skip to content

Commit

Permalink
更新V1.4.6
Browse files Browse the repository at this point in the history
- 修复荣耀的bug--感谢○_○
  • Loading branch information
mingzhixian committed Apr 10, 2024
1 parent 38325d0 commit 75e124a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions easycontrol/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
applicationId "top.saymzx.easycontrol.app"
minSdk 21
targetSdk 34
versionCode 10405
versionName "1.4.5"
versionCode 10406
versionName "1.4.6"
ndk {
abiFilters "arm64-v8a", "armeabi-v7a", "x86", "x86_64"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,19 @@ public static void init() throws ClassNotFoundException {

// 安卓14之后部分函数转移到了DisplayControl
@SuppressLint({"PrivateApi", "SoonBlockedPrivateApi", "BlockedPrivateApi"})
private static void getMethodAndroid14() throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
Method createClassLoaderMethod = Class.forName("com.android.internal.os.ClassLoaderFactory").getDeclaredMethod("createClassLoader", String.class, String.class, String.class, ClassLoader.class, int.class, boolean.class, String.class);
ClassLoader classLoader = (ClassLoader) createClassLoaderMethod.invoke(null, "/system/framework/services.jar", null, null, ClassLoader.getSystemClassLoader(), 0, true, null);
Class<?> displayControlClass = classLoader.loadClass("com.android.server.display.DisplayControl");
Method loadMethod = Runtime.class.getDeclaredMethod("loadLibrary0", Class.class, String.class);
loadMethod.setAccessible(true);
private static void getMethodAndroid14() throws Exception {
Class<?> displayControlClass = null;
try {
Method createClassLoaderMethod = Class.forName("com.android.internal.os.ClassLoaderFactory").getDeclaredMethod("createClassLoader", String.class, String.class, String.class, ClassLoader.class, int.class, boolean.class, String.class);
ClassLoader classLoader = (ClassLoader) createClassLoaderMethod.invoke(null, "/system/framework/services.jar", null, null, ClassLoader.getSystemClassLoader(), 0, true, null);
displayControlClass = classLoader.loadClass("com.android.server.display.DisplayControl");
Method loadMethod = Runtime.class.getDeclaredMethod("loadLibrary0", Class.class, String.class);
loadMethod.setAccessible(true);
if ((Build.BRAND.toLowerCase() + Build.MANUFACTURER.toLowerCase()).contains("honor")) throw new Exception("Honor device");
loadMethod.invoke(Runtime.getRuntime(), displayControlClass, "android_servers");
} catch (Throwable ignored) {
}
if (displayControlClass == null) throw new Exception("Failed to load DisplayControl class");
getPhysicalDisplayIdsMethod = displayControlClass.getMethod("getPhysicalDisplayIds");
getPhysicalDisplayTokenMethod = displayControlClass.getMethod("getPhysicalDisplayToken", long.class);
}
Expand Down

0 comments on commit 75e124a

Please sign in to comment.