From a2bf9d24ebc920f263536fa7685733f4821e6312 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?YuSaki=E4=B8=B6Kanade?= <53483352+Nep-Timeline@users.noreply.github.com> Date: Tue, 24 Sep 2024 19:09:12 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BF=AE=E5=A4=8D]=20Android=2015=20=E8=A7=A3?= =?UTF-8?q?=E9=99=A4=E7=8A=B6=E6=80=81=E6=A0=8F=E5=9B=BE=E6=A0=87=E6=97=A0?= =?UTF-8?q?=E6=95=88=20/=20=E7=B1=BB=E5=8F=8A=E6=96=B9=E6=B3=95=E9=94=99?= =?UTF-8?q?=E8=AF=AF=20(#206)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update FunctionFactory.kt * Update SystemUIHooker.kt * Update SystemUIHooker.kt * Update SystemUIHooker.kt * Update SystemUIHooker.kt * Update FunctionFactory.kt --- .../miui/notify/hook/entity/SystemUIHooker.kt | 18 +++++++++++------- .../notify/utils/factory/FunctionFactory.kt | 5 +++-- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/com/fankes/miui/notify/hook/entity/SystemUIHooker.kt b/app/src/main/java/com/fankes/miui/notify/hook/entity/SystemUIHooker.kt index 6efdf02..940e621 100644 --- a/app/src/main/java/com/fankes/miui/notify/hook/entity/SystemUIHooker.kt +++ b/app/src/main/java/com/fankes/miui/notify/hook/entity/SystemUIHooker.kt @@ -177,7 +177,8 @@ object SystemUIHooker : YukiBaseHooker() { private val NotificationUtilClass by lazyClass( VariousClass( "${PackageName.SYSTEMUI}.statusbar.notification.NotificationUtil", - "${PackageName.SYSTEMUI}.miui.statusbar.notification.NotificationUtil" + "${PackageName.SYSTEMUI}.miui.statusbar.notification.NotificationUtil", + "${PackageName.SYSTEMUI}.statusbar.notification.utils.NotifImageUtil" ) ) @@ -677,9 +678,12 @@ object SystemUIHooker : YukiBaseHooker() { /** 旧版名称 */ val oldVersion = it == "mMaxStaticIcons" + /** 旧版名称 */ + val oldVersion2 = it == "MAX_STATIC_ICONS" + /** 新版本名称 */ - val newVersion = it == "MAX_STATIC_ICONS" - oldVersion || newVersion + val newVersion = it == "mMaxIcons" + oldVersion || oldVersion2 || newVersion } }.get(instance) if (statusBarMaxStaticIcons == -1 || @@ -892,7 +896,7 @@ object SystemUIHooker : YukiBaseHooker() { } method { name = "getSmallIcon" - param(ContextClass, ExpandedNotificationClass) + param { it[0] == ContextClass && it[1] extends StatusBarNotificationClass } }.onFind { isUseLegacy = true } }.hook().after { (globalContext ?: args().first().cast())?.also { context -> @@ -921,7 +925,7 @@ object SystemUIHooker : YukiBaseHooker() { ).also { pair -> iconView.setImageDrawable(pair.first) } updateStatusBarIconColor(iconView) } - /** 注入状态栏通知图标容器管理实例 */ + /** 注入状态栏通知图标容器管理实例 (A15 HyperOS 已移除) */ NotificationIconAreaControllerClass.apply { /** Hook 深色图标模式改变 */ method { @@ -1010,7 +1014,7 @@ object SystemUIHooker : YukiBaseHooker() { name = "setMaxStaticIcons" param(IntType) }.ignored().hook().before { isShowNotificationIcons = args().first().int() > 0 } - /** 新版方法 - 旧版不存在 */ + /** 旧版方法 - 新版 (A15 HyperOS) 不存在 */ method { name = "miuiShowNotificationIcons" param(BooleanType) @@ -1100,4 +1104,4 @@ object SystemUIHooker : YukiBaseHooker() { } ?: false } } -} \ No newline at end of file +} diff --git a/app/src/main/java/com/fankes/miui/notify/utils/factory/FunctionFactory.kt b/app/src/main/java/com/fankes/miui/notify/utils/factory/FunctionFactory.kt index 1ce1fae..08d2971 100644 --- a/app/src/main/java/com/fankes/miui/notify/utils/factory/FunctionFactory.kt +++ b/app/src/main/java/com/fankes/miui/notify/utils/factory/FunctionFactory.kt @@ -175,7 +175,7 @@ inline val isNotMIOS get() = !isMIOS val isSupportMiSystemVersion get() = when { isMIOS -> when (miosVersion) { - "1.0" -> true + "1.0", "1.1" -> true else -> false } isMIUI -> when (miuiVersion) { @@ -197,6 +197,7 @@ inline val isNotSupportMiSystemVersion get() = !isSupportMiSystemVersion */ val androidVersionCodeName get() = when (Build.VERSION.SDK_INT) { + 35 -> "V" 34 -> "U" 33 -> "T" 32 -> "S_V2" @@ -719,4 +720,4 @@ fun Context.hideOrShowLauncherIcon(isShow: Boolean) { val Context.isLauncherIconShowing get() = packageManager?.getComponentEnabledSetting( ComponentName(packageName, "${BuildConfigWrapper.APPLICATION_ID}.Home") - ) != PackageManager.COMPONENT_ENABLED_STATE_DISABLED \ No newline at end of file + ) != PackageManager.COMPONENT_ENABLED_STATE_DISABLED