@@ -103,7 +103,8 @@ object SystemUIHooker : YukiBaseHooker() {
103103 /* * 根据多个版本存在不同的包名相同的类 */
104104 private val MiuiClockClass = VariousClass (
105105 " $SYSTEMUI_PACKAGE_NAME .statusbar.views.MiuiClock" ,
106- " $SYSTEMUI_PACKAGE_NAME .statusbar.policy.MiuiClock"
106+ " $SYSTEMUI_PACKAGE_NAME .statusbar.policy.MiuiClock" ,
107+ " $SYSTEMUI_PACKAGE_NAME .statusbar.policy.Clock"
107108 )
108109
109110 /* * 根据多个版本存在不同的包名相同的类 */
@@ -198,18 +199,6 @@ object SystemUIHooker : YukiBaseHooker() {
198199 private val hasHandleHeaderViews
199200 get() = safeOfFalse { NotificationHeaderViewWrapperClass .clazz.hasMethod { name = " handleHeaderViews" } }
200201
201- /* *
202- * 获取是否存在忽略图标色彩处理的方法
203- * @return [Boolean]
204- */
205- private val hasIgnoreStatusBarIconColor
206- get() = safeOfFalse {
207- NotificationUtilClass .clazz.hasMethod {
208- name = " ignoreStatusBarIconColor"
209- param(ExpandedNotificationClass )
210- }
211- }
212-
213202 /* *
214203 * 处理为圆角图标
215204 * @return [Drawable]
@@ -289,6 +278,18 @@ object SystemUIHooker : YukiBaseHooker() {
289278 return xmsfPkg.ifBlank { targetPkg.ifBlank { packageName } }
290279 }
291280
281+ /* *
282+ * 是否为 MIUI 样式通知栏 - 旧版 - 新版一律返回 false
283+ * @return [Boolean]
284+ */
285+ private val isShowMiuiStyle get() = NotificationUtilClass .clazz.method { name = " showMiuiStyle" }.ignoredError().get().boolean()
286+
287+ /* *
288+ * 是否没有单独的 MIUI 通知栏样式
289+ * @return [Boolean]
290+ */
291+ private val isNotHasAbsoluteMiuiStyle get() = MiuiNotificationViewWrapperClass .hasClass.not ()
292+
292293 /* *
293294 * 获取全局上下文
294295 * @return [Context] or null
@@ -584,11 +585,10 @@ object SystemUIHooker : YukiBaseHooker() {
584585 .get(this ).call()?.let {
585586 it.javaClass.method {
586587 name = " getSbn"
587- }.get(it).invoke<StatusBarNotification >()
588+ }.ignoredError(). get(it).invoke<StatusBarNotification >()
588589 } ? : ExpandableNotificationRowClass .clazz
589590 .method { name = " getStatusBarNotification" }
590- .get(NotificationViewWrapperClass .clazz.field { name = " mRow" }.get(this ).self)
591- .invoke<StatusBarNotification >()
591+ .get(this ).invoke<StatusBarNotification >()
592592
593593 /* *
594594 * 根据当前 [ImageView] 的父布局克隆一个新的 [ImageView]
@@ -714,10 +714,8 @@ object SystemUIHooker : YukiBaseHooker() {
714714 * MIUI 12 进行单独判断
715715 */
716716 field { name = " mCurrentSetColor" }.get(instance).int().also { color ->
717- if (hasIgnoreStatusBarIconColor) {
718- alpha = if (color.isWhite) 0.95f else 0.8f
719- setColorFilter(if (color.isWhite) color else Color .BLACK )
720- } else setColorFilter(color)
717+ alpha = if (color.isWhite) 0.95f else 0.8f
718+ setColorFilter(if (color.isWhite) color else Color .BLACK )
721719 }
722720 }
723721 }
@@ -796,6 +794,9 @@ object SystemUIHooker : YukiBaseHooker() {
796794 method { name = " handleHeaderViews" }
797795 else method { name = " resolveHeaderViews" }
798796 afterHook {
797+ /* * 忽略较旧版本 - 在没有 MIUI 通知栏样式的时候可能出现奇怪的问题 */
798+ if (isNotHasAbsoluteMiuiStyle && isShowMiuiStyle) return @afterHook
799+
799800 /* * 获取小图标 */
800801 val iconImageView =
801802 NotificationHeaderViewWrapperClass .clazz
@@ -907,11 +908,11 @@ object SystemUIHooker : YukiBaseHooker() {
907908 }
908909 }
909910 }
910- }
911+ }.ignoredHookClassNotFoundFailure()
911912 /* * 自动检查通知图标优化更新的注入监听 */
912913 MiuiClockClass .hook {
913914 injectMember {
914- method { name = " updateTime" }
915+ method { name = " updateTime" }.remedys { method { name = " updateClock " } }
915916 afterHook {
916917 instance<View >().context.also {
917918 /* * 注册定时监听 */
@@ -923,6 +924,6 @@ object SystemUIHooker : YukiBaseHooker() {
923924 }
924925 }
925926 }
926- }.ignoredHookClassNotFoundFailure()
927+ }
927928 }
928929}
0 commit comments