mirror of
https://github.com/fankes/MIUINativeNotifyIcon.git
synced 2025-09-05 10:15:31 +08:00
[修复] Android 15 解除状态栏图标无效 / 类及方法错误 (#206)
* Update FunctionFactory.kt * Update SystemUIHooker.kt * Update SystemUIHooker.kt * Update SystemUIHooker.kt * Update SystemUIHooker.kt * Update FunctionFactory.kt
This commit is contained in:
@@ -177,7 +177,8 @@ object SystemUIHooker : YukiBaseHooker() {
|
|||||||
private val NotificationUtilClass by lazyClass(
|
private val NotificationUtilClass by lazyClass(
|
||||||
VariousClass(
|
VariousClass(
|
||||||
"${PackageName.SYSTEMUI}.statusbar.notification.NotificationUtil",
|
"${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 oldVersion = it == "mMaxStaticIcons"
|
||||||
|
|
||||||
|
/** 旧版名称 */
|
||||||
|
val oldVersion2 = it == "MAX_STATIC_ICONS"
|
||||||
|
|
||||||
/** 新版本名称 */
|
/** 新版本名称 */
|
||||||
val newVersion = it == "MAX_STATIC_ICONS"
|
val newVersion = it == "mMaxIcons"
|
||||||
oldVersion || newVersion
|
oldVersion || oldVersion2 || newVersion
|
||||||
}
|
}
|
||||||
}.get(instance)
|
}.get(instance)
|
||||||
if (statusBarMaxStaticIcons == -1 ||
|
if (statusBarMaxStaticIcons == -1 ||
|
||||||
@@ -892,7 +896,7 @@ object SystemUIHooker : YukiBaseHooker() {
|
|||||||
}
|
}
|
||||||
method {
|
method {
|
||||||
name = "getSmallIcon"
|
name = "getSmallIcon"
|
||||||
param(ContextClass, ExpandedNotificationClass)
|
param { it[0] == ContextClass && it[1] extends StatusBarNotificationClass }
|
||||||
}.onFind { isUseLegacy = true }
|
}.onFind { isUseLegacy = true }
|
||||||
}.hook().after {
|
}.hook().after {
|
||||||
(globalContext ?: args().first().cast())?.also { context ->
|
(globalContext ?: args().first().cast())?.also { context ->
|
||||||
@@ -921,7 +925,7 @@ object SystemUIHooker : YukiBaseHooker() {
|
|||||||
).also { pair -> iconView.setImageDrawable(pair.first) }
|
).also { pair -> iconView.setImageDrawable(pair.first) }
|
||||||
updateStatusBarIconColor(iconView)
|
updateStatusBarIconColor(iconView)
|
||||||
}
|
}
|
||||||
/** 注入状态栏通知图标容器管理实例 */
|
/** 注入状态栏通知图标容器管理实例 (A15 HyperOS 已移除) */
|
||||||
NotificationIconAreaControllerClass.apply {
|
NotificationIconAreaControllerClass.apply {
|
||||||
/** Hook 深色图标模式改变 */
|
/** Hook 深色图标模式改变 */
|
||||||
method {
|
method {
|
||||||
@@ -1010,7 +1014,7 @@ object SystemUIHooker : YukiBaseHooker() {
|
|||||||
name = "setMaxStaticIcons"
|
name = "setMaxStaticIcons"
|
||||||
param(IntType)
|
param(IntType)
|
||||||
}.ignored().hook().before { isShowNotificationIcons = args().first().int() > 0 }
|
}.ignored().hook().before { isShowNotificationIcons = args().first().int() > 0 }
|
||||||
/** 新版方法 - 旧版不存在 */
|
/** 旧版方法 - 新版 (A15 HyperOS) 不存在 */
|
||||||
method {
|
method {
|
||||||
name = "miuiShowNotificationIcons"
|
name = "miuiShowNotificationIcons"
|
||||||
param(BooleanType)
|
param(BooleanType)
|
||||||
@@ -1100,4 +1104,4 @@ object SystemUIHooker : YukiBaseHooker() {
|
|||||||
} ?: false
|
} ?: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -175,7 +175,7 @@ inline val isNotMIOS get() = !isMIOS
|
|||||||
val isSupportMiSystemVersion
|
val isSupportMiSystemVersion
|
||||||
get() = when {
|
get() = when {
|
||||||
isMIOS -> when (miosVersion) {
|
isMIOS -> when (miosVersion) {
|
||||||
"1.0" -> true
|
"1.0", "1.1" -> true
|
||||||
else -> false
|
else -> false
|
||||||
}
|
}
|
||||||
isMIUI -> when (miuiVersion) {
|
isMIUI -> when (miuiVersion) {
|
||||||
@@ -197,6 +197,7 @@ inline val isNotSupportMiSystemVersion get() = !isSupportMiSystemVersion
|
|||||||
*/
|
*/
|
||||||
val androidVersionCodeName
|
val androidVersionCodeName
|
||||||
get() = when (Build.VERSION.SDK_INT) {
|
get() = when (Build.VERSION.SDK_INT) {
|
||||||
|
35 -> "V"
|
||||||
34 -> "U"
|
34 -> "U"
|
||||||
33 -> "T"
|
33 -> "T"
|
||||||
32 -> "S_V2"
|
32 -> "S_V2"
|
||||||
@@ -719,4 +720,4 @@ fun Context.hideOrShowLauncherIcon(isShow: Boolean) {
|
|||||||
val Context.isLauncherIconShowing
|
val Context.isLauncherIconShowing
|
||||||
get() = packageManager?.getComponentEnabledSetting(
|
get() = packageManager?.getComponentEnabledSetting(
|
||||||
ComponentName(packageName, "${BuildConfigWrapper.APPLICATION_ID}.Home")
|
ComponentName(packageName, "${BuildConfigWrapper.APPLICATION_ID}.Home")
|
||||||
) != PackageManager.COMPONENT_ENABLED_STATE_DISABLED
|
) != PackageManager.COMPONENT_ENABLED_STATE_DISABLED
|
||||||
|
Reference in New Issue
Block a user