Skip to content

Commit d26f68c

Browse files
authored
fix: DND and updateIconsForLayout hook (#79)
1 parent d9520cb commit d26f68c

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

app/src/main/java/com/fankes/coloros/notify/hook/entity/SystemUIHooker.kt

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ object SystemUIHooker : YukiBaseHooker() {
129129
/** 原生存在的类 */
130130
private val MediaDataClass by lazyClassOrNull("${PackageName.SYSTEMUI}.media.MediaData")
131131

132+
/** 原生存在的类 - 旧版本不存在 */
133+
private val LegacyNotificationIconAreaControllerImpl by lazyClassOrNull("${PackageName.SYSTEMUI}.statusbar.phone.LegacyNotificationIconAreaControllerImpl")
134+
132135
/** ColorOS 存在的类 - 旧版本不存在 */
133136
private val OplusContrastColorUtilClass by lazyClassOrNull("com.oplusos.util.OplusContrastColorUtil")
134137

@@ -697,6 +700,11 @@ object SystemUIHooker : YukiBaseHooker() {
697700
DndAlertHelperClass.method {
698701
name { it.lowercase() == "sendnotificationwithendtime" }
699702
param(LongType)
703+
}.remedys {
704+
method {
705+
name = "operateNotification"
706+
param(LongType, IntType, BooleanType)
707+
}
700708
}.hook().before {
701709
/** 是否移除 */
702710
if (ConfigData.isEnableRemoveDndAlertNotify) resultNull()
@@ -789,7 +797,21 @@ object SystemUIHooker : YukiBaseHooker() {
789797
else -> notificationIconContainer = args(index = 1).cast()
790798
}
791799
}
792-
/** 注入状态栏通知图标容器实例 */
800+
}
801+
802+
/** 注入状态栏通知图标容器实例 */
803+
if (LegacyNotificationIconAreaControllerImpl != null) {
804+
/** ColorOS 15.0.1 */
805+
LegacyNotificationIconAreaControllerImpl?.apply {
806+
method {
807+
name = "updateIconsForLayout"
808+
paramCount = 8
809+
}.hook().after {
810+
notificationIconContainer = args(index = 1).cast()
811+
}
812+
}
813+
} else {
814+
/** ColorOS 15 */
793815
NotificationIconAreaControllerClass.apply {
794816
method {
795817
name = "updateIconsForLayout"
@@ -799,6 +821,7 @@ object SystemUIHooker : YukiBaseHooker() {
799821
}
800822
}
801823
}
824+
802825
/** 替换通知面板背景 - 新版本 */
803826
if (isOldNotificationBackground.not())
804827
OplusNotificationBackgroundViewClass?.apply {

0 commit comments

Comments
 (0)