@@ -36,7 +36,6 @@ import android.graphics.drawable.Icon
3636import android.graphics.drawable.VectorDrawable
3737import android.service.notification.StatusBarNotification
3838import android.util.ArrayMap
39- import android.util.ArraySet
4039import android.view.View
4140import android.view.ViewGroup
4241import android.view.ViewOutlineProvider
@@ -56,6 +55,7 @@ import com.fankes.coloros.notify.utils.factory.*
5655import com.fankes.coloros.notify.utils.tool.IconAdaptationTool
5756import com.highcapable.yukihookapi.hook.bean.VariousClass
5857import com.highcapable.yukihookapi.hook.entity.YukiBaseHooker
58+ import com.highcapable.yukihookapi.hook.factory.current
5959import com.highcapable.yukihookapi.hook.factory.field
6060import com.highcapable.yukihookapi.hook.factory.method
6161import com.highcapable.yukihookapi.hook.log.loggerD
@@ -144,6 +144,12 @@ class SystemUIHooker : YukiBaseHooker() {
144144 " com.coloros.systemui.common.receiver.AbstractReceiver"
145145 )
146146
147+ /* * 根据多个版本存在不同的包名相同的类 */
148+ private val StatusBarNotificationPresenterClass = VariousClass (
149+ " $SYSTEMUI_PACKAGE_NAME .statusbar.phone.StatusBarNotificationPresenter" ,
150+ " $SYSTEMUI_PACKAGE_NAME .statusbar.phone.StatusBar"
151+ )
152+
147153 /* * 根据多个版本存在不同的包名相同的类 */
148154 private val ExpandableNotificationRowClass = VariousClass (
149155 " $SYSTEMUI_PACKAGE_NAME .statusbar.notification.row.ExpandableNotificationRow" ,
@@ -175,8 +181,8 @@ class SystemUIHooker : YukiBaseHooker() {
175181 /* * 状态栏通知图标数组 */
176182 private var notificationIconInstances = ArrayList <View >()
177183
178- /* * 缓存的通知小图标包装纸实例 */
179- private var notificationViewWrappers = ArraySet < Any >()
184+ /* * 通知栏通知控制器 */
185+ private var notificationPresenter : Any? = null
180186
181187 /* * 仅监听一次主题壁纸颜色变化 */
182188 private var isWallpaperColorListenerSetUp = false
@@ -334,8 +340,11 @@ class SystemUIHooker : YukiBaseHooker() {
334340
335341 /* * 刷新通知小图标 */
336342 private fun refreshNotificationIcons () = runInSafe {
337- NotificationHeaderViewWrapperClass .clazz.method { name = " resolveHeaderViews" }.also { result ->
338- notificationViewWrappers.takeIf { it.isNotEmpty() }?.forEach { result.get(it).call() }
343+ notificationPresenter?.current {
344+ method {
345+ name = " updateNotificationsOnDensityOrFontScaleChanged"
346+ emptyParam()
347+ }.call()
339348 }
340349 }
341350
@@ -629,6 +638,13 @@ class SystemUIHooker : YukiBaseHooker() {
629638 }
630639 }
631640 }
641+ /* * 注入通知控制器实例 */
642+ StatusBarNotificationPresenterClass .hook {
643+ injectMember {
644+ allConstructors()
645+ afterHook { notificationPresenter = instance }
646+ }
647+ }
632648 /* * 注入状态栏通知图标容器实例 */
633649 OplusNotificationIconAreaControllerClass .hook {
634650 injectMember {
@@ -684,11 +700,6 @@ class SystemUIHooker : YukiBaseHooker() {
684700 }
685701 }
686702 }
687- /* * 记录实例 */
688- injectMember {
689- constructor { param(ContextClass , ViewClass , ExpandableNotificationRowClass ) }
690- afterHook { notificationViewWrappers.add(instance) }
691- }
692703 }
693704 /* * 发送适配新的 APP 图标通知 */
694705 PluginManagerImplClass .hook {
0 commit comments