fix: DND and updateIconsForLayout hook (#79)

This commit is contained in:
YuSaki丶Kanade
2025-05-28 22:50:39 +08:00
committed by GitHub
parent d9520cb484
commit d26f68c1a7

View File

@@ -129,6 +129,9 @@ object SystemUIHooker : YukiBaseHooker() {
/** 原生存在的类 */ /** 原生存在的类 */
private val MediaDataClass by lazyClassOrNull("${PackageName.SYSTEMUI}.media.MediaData") private val MediaDataClass by lazyClassOrNull("${PackageName.SYSTEMUI}.media.MediaData")
/** 原生存在的类 - 旧版本不存在 */
private val LegacyNotificationIconAreaControllerImpl by lazyClassOrNull("${PackageName.SYSTEMUI}.statusbar.phone.LegacyNotificationIconAreaControllerImpl")
/** ColorOS 存在的类 - 旧版本不存在 */ /** ColorOS 存在的类 - 旧版本不存在 */
private val OplusContrastColorUtilClass by lazyClassOrNull("com.oplusos.util.OplusContrastColorUtil") private val OplusContrastColorUtilClass by lazyClassOrNull("com.oplusos.util.OplusContrastColorUtil")
@@ -697,6 +700,11 @@ object SystemUIHooker : YukiBaseHooker() {
DndAlertHelperClass.method { DndAlertHelperClass.method {
name { it.lowercase() == "sendnotificationwithendtime" } name { it.lowercase() == "sendnotificationwithendtime" }
param(LongType) param(LongType)
}.remedys {
method {
name = "operateNotification"
param(LongType, IntType, BooleanType)
}
}.hook().before { }.hook().before {
/** 是否移除 */ /** 是否移除 */
if (ConfigData.isEnableRemoveDndAlertNotify) resultNull() if (ConfigData.isEnableRemoveDndAlertNotify) resultNull()
@@ -789,7 +797,21 @@ object SystemUIHooker : YukiBaseHooker() {
else -> notificationIconContainer = args(index = 1).cast() else -> notificationIconContainer = args(index = 1).cast()
} }
} }
/** 注入状态栏通知图标容器实例 */ }
/** 注入状态栏通知图标容器实例 */
if (LegacyNotificationIconAreaControllerImpl != null) {
/** ColorOS 15.0.1 */
LegacyNotificationIconAreaControllerImpl?.apply {
method {
name = "updateIconsForLayout"
paramCount = 8
}.hook().after {
notificationIconContainer = args(index = 1).cast()
}
}
} else {
/** ColorOS 15 */
NotificationIconAreaControllerClass.apply { NotificationIconAreaControllerClass.apply {
method { method {
name = "updateIconsForLayout" name = "updateIconsForLayout"
@@ -799,6 +821,7 @@ object SystemUIHooker : YukiBaseHooker() {
} }
} }
} }
/** 替换通知面板背景 - 新版本 */ /** 替换通知面板背景 - 新版本 */
if (isOldNotificationBackground.not()) if (isOldNotificationBackground.not())
OplusNotificationBackgroundViewClass?.apply { OplusNotificationBackgroundViewClass?.apply {