fix: coloros 15 removed updateIconsForLayout method (#76)

This commit is contained in:
YuSaki丶Kanade
2025-04-21 22:40:21 +08:00
committed by GitHub
parent ee77842fbb
commit 9aae48c785

View File

@@ -749,7 +749,7 @@ object SystemUIHooker : YukiBaseHooker() {
StatusBarNotificationPresenterClass.constructor().hookAll().after { notificationPresenter = instance } StatusBarNotificationPresenterClass.constructor().hookAll().after { notificationPresenter = instance }
/** 注入状态栏通知图标容器实例 */ /** 注入状态栏通知图标容器实例 */
OplusNotificationIconAreaControllerClass.apply { OplusNotificationIconAreaControllerClass.apply {
var isOldWay = false var way = 0
method { method {
name = "updateIconsForLayout" name = "updateIconsForLayout"
paramCount = 10 paramCount = 10
@@ -762,13 +762,20 @@ object SystemUIHooker : YukiBaseHooker() {
method { method {
name = "updateIconsForLayout" name = "updateIconsForLayout"
paramCount = 1 paramCount = 1
}.onFind { isOldWay = true } }.onFind { way = 1 }
method {
name = "updateStatusBarIcons"
}.onFind { way = 2 }
}.hook().after { }.hook().after {
if (isOldWay) { when (way) {
notificationIconInstances.clear() 1 -> notificationIconContainer = OplusNotificationIconAreaControllerClass.method { name = "getNotificationIcons" }.get(instance).invoke()
field { name = "mLastToShow" }.get(instance).list<View>() 2 -> {
.takeIf { it.isNotEmpty() }?.forEach { notificationIconInstances.add(it) } notificationIconInstances.clear()
} else notificationIconContainer = args(index = 1).cast() field { name = "mLastToShow" }.get(instance).list<View>()
.takeIf { it.isNotEmpty() }?.forEach { notificationIconInstances.add(it) }
}
else -> notificationIconContainer = args(index = 1).cast()
}
} }
/** 注入状态栏通知图标容器实例 */ /** 注入状态栏通知图标容器实例 */
NotificationIconAreaControllerClass.apply { NotificationIconAreaControllerClass.apply {
@@ -896,4 +903,4 @@ object SystemUIHooker : YukiBaseHooker() {
} }
} }
} }
} }