From 7490247e1ae4f96a61f999c95cfe32eb4b7756f0 Mon Sep 17 00:00:00 2001 From: Timeline <53483352+Nep-Timeline@users.noreply.github.com> Date: Wed, 25 Mar 2026 15:52:23 +0800 Subject: [PATCH 1/2] fix: The refreshNotificationIcons does not work on ColorOS 16 --- .../notify/hook/entity/SystemUIHooker.kt | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/fankes/coloros/notify/hook/entity/SystemUIHooker.kt b/app/src/main/java/com/fankes/coloros/notify/hook/entity/SystemUIHooker.kt index 69ea02c..f5bb0a4 100644 --- a/app/src/main/java/com/fankes/coloros/notify/hook/entity/SystemUIHooker.kt +++ b/app/src/main/java/com/fankes/coloros/notify/hook/entity/SystemUIHooker.kt @@ -142,6 +142,9 @@ object SystemUIHooker : YukiBaseHooker() { /** ColorOS 存在的类 - 旧版本不存在 */ private val OplusNotificationGroupTemplateWrapperClass by lazyClassOrNull("com.oplus.systemui.notification.row.oplusgroup.OplusNotificationGroupTemplateWrapper") + + /** 原生存在的类 */ + private val ViewConfigCoordinatorClass by lazyClassOrNull("${PackageName.SYSTEMUI}.statusbar.notification.collection.coordinator.ViewConfigCoordinator") /** 根据多个版本存在不同的包名相同的类 */ private val OplusNotificationIconAreaControllerClass by lazyClass( @@ -293,6 +296,13 @@ object SystemUIHooker : YukiBaseHooker() { name = "proxyOnContentUpdated" parameterCount = 1 } != null + + private val isNotificationPresenter + get() = StatusBarNotificationPresenterClass.resolve().optional(silent = true) + .firstMethodOrNull { + name = "updateNotificationsOnDensityOrFontScaleChanged" + emptyParameters() + } != null /** * 打印日志 @@ -785,7 +795,10 @@ object SystemUIHooker : YukiBaseHooker() { if (args().first().any() != null) instance().also { registerWallpaperColorChanged(it) } } /** 注入通知控制器实例 */ - StatusBarNotificationPresenterClass.resolve().optional().constructor {}.hookAll().after { notificationPresenter = instance } + if (isNotificationPresenter) + StatusBarNotificationPresenterClass.resolve().optional().constructor {}.hookAll().after { notificationPresenter = instance } + else + ViewConfigCoordinatorClass?.resolve()?.optional()?.constructor {}?.hookAll()?.after { notificationPresenter = instance } /** 替换通知面板背景 - 新版本 */ if (!isOldNotificationBackground) OplusNotificationBackgroundViewClass?.resolve()?.optional()?.apply { @@ -1023,4 +1036,4 @@ object SystemUIHooker : YukiBaseHooker() { } } } -} \ No newline at end of file +} From 07b12e1342ee3b84741ad2905e2d7786bf4e9dd5 Mon Sep 17 00:00:00 2001 From: Timeline <53483352+Nep-Timeline@users.noreply.github.com> Date: Wed, 25 Mar 2026 15:55:00 +0800 Subject: [PATCH 2/2] optimize field position Removed duplicate declaration of ViewConfigCoordinatorClass. --- .../fankes/coloros/notify/hook/entity/SystemUIHooker.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/fankes/coloros/notify/hook/entity/SystemUIHooker.kt b/app/src/main/java/com/fankes/coloros/notify/hook/entity/SystemUIHooker.kt index f5bb0a4..29c2a83 100644 --- a/app/src/main/java/com/fankes/coloros/notify/hook/entity/SystemUIHooker.kt +++ b/app/src/main/java/com/fankes/coloros/notify/hook/entity/SystemUIHooker.kt @@ -115,6 +115,9 @@ object SystemUIHooker : YukiBaseHooker() { /** 原生存在的类 */ private val MediaDataClass by lazyClassOrNull("${PackageName.SYSTEMUI}.media.MediaData") + + /** 原生存在的类 */ + private val ViewConfigCoordinatorClass by lazyClassOrNull("${PackageName.SYSTEMUI}.statusbar.notification.collection.coordinator.ViewConfigCoordinator") /** 原生存在的类 - 旧版本不存在 */ private val LegacyNotificationIconAreaControllerImpl by lazyClassOrNull("${PackageName.SYSTEMUI}.statusbar.phone.LegacyNotificationIconAreaControllerImpl") @@ -142,10 +145,7 @@ object SystemUIHooker : YukiBaseHooker() { /** ColorOS 存在的类 - 旧版本不存在 */ private val OplusNotificationGroupTemplateWrapperClass by lazyClassOrNull("com.oplus.systemui.notification.row.oplusgroup.OplusNotificationGroupTemplateWrapper") - - /** 原生存在的类 */ - private val ViewConfigCoordinatorClass by lazyClassOrNull("${PackageName.SYSTEMUI}.statusbar.notification.collection.coordinator.ViewConfigCoordinator") - + /** 根据多个版本存在不同的包名相同的类 */ private val OplusNotificationIconAreaControllerClass by lazyClass( VariousClass(