From 8d2e21c43b3b83bb7dd29d7960be068cf5e3c8f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BB=80=E6=BC=93=E4=B8=A8Sevtinge?= <89193494+Sevtinge@users.noreply.github.com> Date: Sat, 4 May 2024 06:51:06 +0800 Subject: [PATCH] fix: gpu driver (maybe font loader) load failed cause of framework-AllDarkMode international build type got failed --- .../hyperceiler/module/hook/home/title/DisableHideFile.kt | 2 +- .../module/hook/systemframework/display/AllDarkMode.kt | 5 +++-- .../hyperceiler/utils/devicesdk/MiDeviceAppUtils.kt | 8 ++++++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/home/title/DisableHideFile.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/home/title/DisableHideFile.kt index 0c8e60c284..164ed2a84b 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/home/title/DisableHideFile.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/home/title/DisableHideFile.kt @@ -25,7 +25,7 @@ import de.robv.android.xposed.* object DisableHideFile : BaseHook() { override fun init() { - if (isInternational()) return + if (IS_INTERNATIONAL_BUILD) return XposedHelpers.findAndHookConstructor( "com.miui.home.launcher.AppFilter", diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemframework/display/AllDarkMode.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemframework/display/AllDarkMode.kt index e2513615e1..21bc4c5037 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemframework/display/AllDarkMode.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemframework/display/AllDarkMode.kt @@ -22,6 +22,7 @@ import android.content.pm.* import com.github.kyuubiran.ezxhelper.ClassUtils.loadClass import com.github.kyuubiran.ezxhelper.ClassUtils.setStaticObject import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHooks + import com.github.kyuubiran.ezxhelper.ObjectUtils.invokeMethodBestMatch import com.github.kyuubiran.ezxhelper.finders.MethodFinder.`-Static`.methodFinder import com.sevtinge.hyperceiler.module.base.* @@ -31,7 +32,7 @@ import com.sevtinge.hyperceiler.utils.devicesdk.* //from SetoHook by SetoSkins class AllDarkMode : BaseHook() { override fun init() { - if (isInternational()) return + if (IS_INTERNATIONAL_BUILD) return val clazzForceDarkAppListManager = loadClass("com.android.server.ForceDarkAppListManager") clazzForceDarkAppListManager.methodFinder().filterByName("getDarkModeAppList").toList() @@ -43,7 +44,7 @@ class AllDarkMode : BaseHook() { setStaticObject( clazzMiuiBuild, "IS_INTERNATIONAL_BUILD", - isInternational() + IS_INTERNATIONAL_BUILD ) } } diff --git a/app/src/main/java/com/sevtinge/hyperceiler/utils/devicesdk/MiDeviceAppUtils.kt b/app/src/main/java/com/sevtinge/hyperceiler/utils/devicesdk/MiDeviceAppUtils.kt index 6cd8571ea4..b5fbac147a 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/utils/devicesdk/MiDeviceAppUtils.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/utils/devicesdk/MiDeviceAppUtils.kt @@ -1,7 +1,15 @@ package com.sevtinge.hyperceiler.utils.devicesdk +import com.github.kyuubiran.ezxhelper.ClassUtils.getStaticObjectOrNullAs import com.sevtinge.hyperceiler.utils.api.LazyClass.clazzMiuiBuild +val IS_TABLET by lazy { + getStaticObjectOrNullAs(clazzMiuiBuild, "IS_TABLET") ?: false +} +val IS_INTERNATIONAL_BUILD by lazy { + getStaticObjectOrNullAs(clazzMiuiBuild, "IS_INTERNATIONAL_BUILD") ?: false +} + /** * 函数调用,适用于其他一些需要判断的情况,仅支持小米设备的判断 * 2024-04-20 更新对非小米设备的判断方式,仅防止闪退