|
|
|
@@ -23,6 +23,7 @@
|
|
|
|
|
package com.fankes.miui.notify.hook.entity
|
|
|
|
|
|
|
|
|
|
import android.app.NotificationManager
|
|
|
|
|
import android.app.WallpaperManager
|
|
|
|
|
import android.content.BroadcastReceiver
|
|
|
|
|
import android.content.Context
|
|
|
|
|
import android.content.Intent
|
|
|
|
@@ -71,62 +72,70 @@ class SystemUIHooker : YukiBaseHooker() {
|
|
|
|
|
companion object {
|
|
|
|
|
|
|
|
|
|
/** MIUI 新版本存在的类 */
|
|
|
|
|
private const val SystemUIApplicationClass = "${SYSTEMUI_PACKAGE_NAME}.SystemUIApplication"
|
|
|
|
|
private const val SystemUIApplicationClass = "$SYSTEMUI_PACKAGE_NAME.SystemUIApplication"
|
|
|
|
|
|
|
|
|
|
/** MIUI 新版本存在的类 */
|
|
|
|
|
private const val NotificationHeaderViewWrapperInjectorClass =
|
|
|
|
|
"${SYSTEMUI_PACKAGE_NAME}.statusbar.notification.row.wrapper.NotificationHeaderViewWrapperInjector"
|
|
|
|
|
"$SYSTEMUI_PACKAGE_NAME.statusbar.notification.row.wrapper.NotificationHeaderViewWrapperInjector"
|
|
|
|
|
|
|
|
|
|
/** MIUI 新版本存在的类 */
|
|
|
|
|
private const val MiuiNotificationViewWrapperClass =
|
|
|
|
|
"$SYSTEMUI_PACKAGE_NAME.statusbar.notification.row.wrapper.MiuiNotificationViewWrapper"
|
|
|
|
|
|
|
|
|
|
/** MIUI 新版本存在的类 */
|
|
|
|
|
private const val MiuiNotificationChildrenContainerClass =
|
|
|
|
|
"$SYSTEMUI_PACKAGE_NAME.statusbar.notification.stack.MiuiNotificationChildrenContainer"
|
|
|
|
|
|
|
|
|
|
/** 原生存在的类 */
|
|
|
|
|
private const val NotificationChildrenContainerClass =
|
|
|
|
|
"$SYSTEMUI_PACKAGE_NAME.statusbar.notification.stack.NotificationChildrenContainer"
|
|
|
|
|
|
|
|
|
|
/** 原生存在的类 */
|
|
|
|
|
private const val ContrastColorUtilClass = "com.android.internal.util.ContrastColorUtil"
|
|
|
|
|
|
|
|
|
|
/** 原生存在的类 */
|
|
|
|
|
private const val StatusBarIconViewClass = "${SYSTEMUI_PACKAGE_NAME}.statusbar.StatusBarIconView"
|
|
|
|
|
private const val StatusBarIconViewClass = "$SYSTEMUI_PACKAGE_NAME.statusbar.StatusBarIconView"
|
|
|
|
|
|
|
|
|
|
/** 原生存在的类 */
|
|
|
|
|
private const val NotificationIconContainerClass = "${SYSTEMUI_PACKAGE_NAME}.statusbar.phone.NotificationIconContainer"
|
|
|
|
|
private const val NotificationIconContainerClass = "$SYSTEMUI_PACKAGE_NAME.statusbar.phone.NotificationIconContainer"
|
|
|
|
|
|
|
|
|
|
/** 原生存在的类 */
|
|
|
|
|
private const val PluginManagerImplClass = "${SYSTEMUI_PACKAGE_NAME}.shared.plugins.PluginManagerImpl"
|
|
|
|
|
|
|
|
|
|
/** MIUI 存在的类 - 旧版本没有 */
|
|
|
|
|
private const val MiuiNotificationViewWrapperClass =
|
|
|
|
|
"${SYSTEMUI_PACKAGE_NAME}.statusbar.notification.row.wrapper.MiuiNotificationViewWrapper"
|
|
|
|
|
private const val PluginManagerImplClass = "$SYSTEMUI_PACKAGE_NAME.shared.plugins.PluginManagerImpl"
|
|
|
|
|
|
|
|
|
|
/** 根据多个版本存在不同的包名相同的类 */
|
|
|
|
|
private val MiuiClockClass = VariousClass(
|
|
|
|
|
"${SYSTEMUI_PACKAGE_NAME}.statusbar.views.MiuiClock",
|
|
|
|
|
"${SYSTEMUI_PACKAGE_NAME}.statusbar.policy.MiuiClock"
|
|
|
|
|
"$SYSTEMUI_PACKAGE_NAME.statusbar.views.MiuiClock",
|
|
|
|
|
"$SYSTEMUI_PACKAGE_NAME.statusbar.policy.MiuiClock"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
/** 根据多个版本存在不同的包名相同的类 */
|
|
|
|
|
private val ExpandableNotificationRowClass = VariousClass(
|
|
|
|
|
"${SYSTEMUI_PACKAGE_NAME}.statusbar.notification.row.ExpandableNotificationRow",
|
|
|
|
|
"${SYSTEMUI_PACKAGE_NAME}.statusbar.ExpandableNotificationRow"
|
|
|
|
|
"$SYSTEMUI_PACKAGE_NAME.statusbar.notification.row.ExpandableNotificationRow",
|
|
|
|
|
"$SYSTEMUI_PACKAGE_NAME.statusbar.ExpandableNotificationRow"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
/** 根据多个版本存在不同的包名相同的类 */
|
|
|
|
|
private val NotificationViewWrapperClass = VariousClass(
|
|
|
|
|
"${SYSTEMUI_PACKAGE_NAME}.statusbar.notification.row.wrapper.NotificationViewWrapper",
|
|
|
|
|
"${SYSTEMUI_PACKAGE_NAME}.statusbar.notification.NotificationViewWrapper"
|
|
|
|
|
"$SYSTEMUI_PACKAGE_NAME.statusbar.notification.row.wrapper.NotificationViewWrapper",
|
|
|
|
|
"$SYSTEMUI_PACKAGE_NAME.statusbar.notification.NotificationViewWrapper"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
/** 根据多个版本存在不同的包名相同的类 */
|
|
|
|
|
private val NotificationHeaderViewWrapperClass = VariousClass(
|
|
|
|
|
"${SYSTEMUI_PACKAGE_NAME}.statusbar.notification.row.wrapper.NotificationHeaderViewWrapper",
|
|
|
|
|
"${SYSTEMUI_PACKAGE_NAME}.statusbar.notification.NotificationHeaderViewWrapper"
|
|
|
|
|
"$SYSTEMUI_PACKAGE_NAME.statusbar.notification.row.wrapper.NotificationHeaderViewWrapper",
|
|
|
|
|
"$SYSTEMUI_PACKAGE_NAME.statusbar.notification.NotificationHeaderViewWrapper"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
/** 根据多个版本存在不同的包名相同的类 */
|
|
|
|
|
private val NotificationUtilClass = VariousClass(
|
|
|
|
|
"${SYSTEMUI_PACKAGE_NAME}.statusbar.notification.NotificationUtil",
|
|
|
|
|
"${SYSTEMUI_PACKAGE_NAME}.miui.statusbar.notification.NotificationUtil"
|
|
|
|
|
"$SYSTEMUI_PACKAGE_NAME.statusbar.notification.NotificationUtil",
|
|
|
|
|
"$SYSTEMUI_PACKAGE_NAME.miui.statusbar.notification.NotificationUtil"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
/** 根据多个版本存在不同的包名相同的类 */
|
|
|
|
|
private val ExpandedNotificationClass = VariousClass(
|
|
|
|
|
"${SYSTEMUI_PACKAGE_NAME}.statusbar.notification.ExpandedNotification",
|
|
|
|
|
"${SYSTEMUI_PACKAGE_NAME}.miui.statusbar.ExpandedNotification"
|
|
|
|
|
"$SYSTEMUI_PACKAGE_NAME.statusbar.notification.ExpandedNotification",
|
|
|
|
|
"$SYSTEMUI_PACKAGE_NAME.miui.statusbar.ExpandedNotification"
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -148,6 +157,12 @@ class SystemUIHooker : YukiBaseHooker() {
|
|
|
|
|
/** MIUI 样式下的缓存的通知小图标包装纸实例 */
|
|
|
|
|
private var miuiNotificationViewWrappers = HashSet<Any>()
|
|
|
|
|
|
|
|
|
|
/** MIUI 样式下的缓存的通知小图标折叠通知实例 */
|
|
|
|
|
private var miuiNotificationChildrenContainers = HashSet<ViewGroup>()
|
|
|
|
|
|
|
|
|
|
/** 仅监听一次主题壁纸颜色变化 */
|
|
|
|
|
private var isWallpaperColorListenerSetUp = false
|
|
|
|
|
|
|
|
|
|
/** 是否已经注册广播 */
|
|
|
|
|
private var isRegisterReceiver = false
|
|
|
|
|
|
|
|
|
@@ -232,7 +247,7 @@ class SystemUIHooker : YukiBaseHooker() {
|
|
|
|
|
}.get(it.method {
|
|
|
|
|
name = "getInstance"
|
|
|
|
|
param(ContextClass)
|
|
|
|
|
}.get().invoke(context)).callBoolean(drawable)
|
|
|
|
|
}.get().invoke(context)).boolean(drawable)
|
|
|
|
|
}
|
|
|
|
|
} else BitmapCompatTool.isGrayscaleDrawable(drawable)
|
|
|
|
|
|
|
|
|
@@ -354,12 +369,25 @@ class SystemUIHooker : YukiBaseHooker() {
|
|
|
|
|
SystemUIApplicationClass.clazz.method { name = "getContext" }.ignoredError().get().invoke<Context>()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 注册主题壁纸改变颜色监听
|
|
|
|
|
*
|
|
|
|
|
* - 仅限在 Android 12 以下注册
|
|
|
|
|
* @param view 实例
|
|
|
|
|
*/
|
|
|
|
|
private fun registerWallpaperColorChanged(view: View) = runInSafe {
|
|
|
|
|
if (isWallpaperColorListenerSetUp.not() && isUpperOfAndroidS.not()) view.apply {
|
|
|
|
|
WallpaperManager.getInstance(context).addOnColorsChangedListener({ _, _ -> refreshNotificationIcons() }, handler)
|
|
|
|
|
}
|
|
|
|
|
isWallpaperColorListenerSetUp = true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 刷新状态栏小图标 */
|
|
|
|
|
private fun refreshStatusBarIcons() = runInSafe {
|
|
|
|
|
StatusBarIconViewClass.clazz.field { name = "mNotification" }.also { result ->
|
|
|
|
|
statusBarIconViews.takeIf { it.isNotEmpty() }?.forEach {
|
|
|
|
|
/** 得到通知实例 */
|
|
|
|
|
val nf = result.of<StatusBarNotification>(it) ?: return
|
|
|
|
|
val nf = result.get(it).cast<StatusBarNotification>() ?: return
|
|
|
|
|
/** 刷新状态栏图标 */
|
|
|
|
|
compatStatusIcon(it.context, nf, nf.notification.smallIcon.loadDrawable(it.context)).also { pair ->
|
|
|
|
|
pair.first.let { e -> it.setImageDrawable(e) }
|
|
|
|
@@ -378,6 +406,12 @@ class SystemUIHooker : YukiBaseHooker() {
|
|
|
|
|
MiuiNotificationViewWrapperClass.clazz.method { name = "handleViews" }.ignoredError().also { result ->
|
|
|
|
|
miuiNotificationViewWrappers.takeIf { it.isNotEmpty() }?.forEach { result.get(it).call() }
|
|
|
|
|
}
|
|
|
|
|
MiuiNotificationChildrenContainerClass.clazz.method {
|
|
|
|
|
name = "updateAppIcon"
|
|
|
|
|
param(BooleanType)
|
|
|
|
|
}.ignoredError().also { result ->
|
|
|
|
|
miuiNotificationChildrenContainers.takeIf { it.isNotEmpty() }?.forEach { result.get(it).call(true) }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@@ -498,7 +532,10 @@ class SystemUIHooker : YukiBaseHooker() {
|
|
|
|
|
setColorFilter(if (isUseAndroid12Style || customIconColor == 0) supportColor else customIconColor)
|
|
|
|
|
/** Android 12 设置图标外圈颜色 */
|
|
|
|
|
if (isUseAndroid12Style && customIconColor != 0)
|
|
|
|
|
background = DrawableBuilder().rounded().solidColor(customIconColor).build()
|
|
|
|
|
background = DrawableBuilder()
|
|
|
|
|
.rounded()
|
|
|
|
|
.solidColor(if (context.isSystemInDarkMode) customIconColor.brighter else customIconColor)
|
|
|
|
|
.build()
|
|
|
|
|
/** 设置原生的背景边距 */
|
|
|
|
|
if (isUseAndroid12Style) setPadding(4.dp(context), 4.dp(context), 4.dp(context), 4.dp(context))
|
|
|
|
|
} else {
|
|
|
|
@@ -511,8 +548,13 @@ class SystemUIHooker : YukiBaseHooker() {
|
|
|
|
|
/** 设置图标着色 */
|
|
|
|
|
setColorFilter(supportColor)
|
|
|
|
|
/** Android 12 设置图标外圈颜色 */
|
|
|
|
|
if (isUseAndroid12Style) background =
|
|
|
|
|
DrawableBuilder().rounded().solidColor(if (hasIconColor) iconColor else context.systemAccentColor).build()
|
|
|
|
|
(if (hasIconColor) iconColor else context.systemAccentColor).also {
|
|
|
|
|
if (isUseAndroid12Style)
|
|
|
|
|
background = DrawableBuilder()
|
|
|
|
|
.rounded()
|
|
|
|
|
.solidColor(if (context.isSystemInDarkMode) it.brighter else it)
|
|
|
|
|
.build()
|
|
|
|
|
}
|
|
|
|
|
/** 设置原生的背景边距 */
|
|
|
|
|
if (isUseAndroid12Style) setPadding(4.dp(context), 4.dp(context), 4.dp(context), 4.dp(context))
|
|
|
|
|
} else iconImageView.apply {
|
|
|
|
@@ -572,10 +614,10 @@ class SystemUIHooker : YukiBaseHooker() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 从 [NotificationViewWrapperClass] 中获取 [StatusBarNotification]
|
|
|
|
|
* @return [Pair] - ([Boolean] 通知是否展开,[StatusBarNotification] 通知实例)
|
|
|
|
|
* 从 [NotificationViewWrapperClass] 中获取 [ExpandableNotificationRowClass]
|
|
|
|
|
* @return [Pair] - ([Boolean] 通知是否展开,[Any] 通知 Row 实例)
|
|
|
|
|
*/
|
|
|
|
|
private fun Any.getSbnPair(): Pair<Boolean, StatusBarNotification?> {
|
|
|
|
|
private fun Any.getRowPair(): Pair<Boolean, Any?> {
|
|
|
|
|
/** 通知是否展开 */
|
|
|
|
|
var isExpanded = false
|
|
|
|
|
|
|
|
|
@@ -583,16 +625,25 @@ class SystemUIHooker : YukiBaseHooker() {
|
|
|
|
|
* 从父类中得到 mRow 变量 - [ExpandableNotificationRowClass]
|
|
|
|
|
* 获取其中的得到通知方法
|
|
|
|
|
*/
|
|
|
|
|
val expandedNf = ExpandableNotificationRowClass.clazz
|
|
|
|
|
val row = NotificationViewWrapperClass.clazz.field {
|
|
|
|
|
name = "mRow"
|
|
|
|
|
}.get(this).self?.also {
|
|
|
|
|
isExpanded = ExpandableNotificationRowClass.clazz.method {
|
|
|
|
|
name = "isExpanded"
|
|
|
|
|
returnType = BooleanType
|
|
|
|
|
}.get(it).boolean()
|
|
|
|
|
}
|
|
|
|
|
return Pair(isExpanded, row)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 从 [ExpandableNotificationRowClass] 中获取 [StatusBarNotification]
|
|
|
|
|
* @return [StatusBarNotification] or null
|
|
|
|
|
*/
|
|
|
|
|
private fun Any?.getSbn() =
|
|
|
|
|
ExpandableNotificationRowClass.clazz
|
|
|
|
|
.method { name = "getEntry" }
|
|
|
|
|
.get(NotificationViewWrapperClass.clazz.field {
|
|
|
|
|
name = "mRow"
|
|
|
|
|
}.get(this).self?.also {
|
|
|
|
|
isExpanded = ExpandableNotificationRowClass.clazz.method {
|
|
|
|
|
name = "isExpanded"
|
|
|
|
|
returnType = BooleanType
|
|
|
|
|
}.get(it).callBoolean()
|
|
|
|
|
}).call()?.let {
|
|
|
|
|
.get(this).call()?.let {
|
|
|
|
|
it.javaClass.method {
|
|
|
|
|
name = "getSbn"
|
|
|
|
|
}.get(it).invoke<StatusBarNotification>()
|
|
|
|
@@ -600,8 +651,6 @@ class SystemUIHooker : YukiBaseHooker() {
|
|
|
|
|
.method { name = "getStatusBarNotification" }
|
|
|
|
|
.get(NotificationViewWrapperClass.clazz.field { name = "mRow" }.get(this).self)
|
|
|
|
|
.invoke<StatusBarNotification>()
|
|
|
|
|
return Pair(isExpanded, expandedNf)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 缓存图标数据 */
|
|
|
|
|
private fun cachingIconDatas() {
|
|
|
|
@@ -662,7 +711,7 @@ class SystemUIHooker : YukiBaseHooker() {
|
|
|
|
|
}
|
|
|
|
|
afterHook {
|
|
|
|
|
(globalContext ?: firstArgs())?.also { context ->
|
|
|
|
|
val expandedNf = args(if (isUseLegacy) 1 else 0).of<StatusBarNotification?>()
|
|
|
|
|
val expandedNf = args(if (isUseLegacy) 1 else 0).cast<StatusBarNotification?>()
|
|
|
|
|
/** Hook 状态栏小图标 */
|
|
|
|
|
compatStatusIcon(
|
|
|
|
|
context = context,
|
|
|
|
@@ -681,7 +730,7 @@ class SystemUIHooker : YukiBaseHooker() {
|
|
|
|
|
afterHook {
|
|
|
|
|
instance<ImageView>().also {
|
|
|
|
|
if (hasIgnoreStatusBarIconColor(it.context, field { name = "mNotification" }
|
|
|
|
|
.of<StatusBarNotification>(instance))) it.apply {
|
|
|
|
|
.get(instance).cast<StatusBarNotification>())) it.apply {
|
|
|
|
|
alpha = 1f
|
|
|
|
|
colorFilter = null
|
|
|
|
|
} else it.apply {
|
|
|
|
@@ -690,7 +739,7 @@ class SystemUIHooker : YukiBaseHooker() {
|
|
|
|
|
* 图标在任何场景下跟随状态栏其它图标保持半透明
|
|
|
|
|
* MIUI 12 进行单独判断
|
|
|
|
|
*/
|
|
|
|
|
field { name = "mCurrentSetColor" }.ofInt(instance).also { color ->
|
|
|
|
|
field { name = "mCurrentSetColor" }.get(instance).int().also { color ->
|
|
|
|
|
if (hasIgnoreStatusBarIconColor) {
|
|
|
|
|
alpha = if (color.isWhite) 0.95f else 0.8f
|
|
|
|
|
setColorFilter(if (color.isWhite) color else Color.BLACK)
|
|
|
|
@@ -713,7 +762,11 @@ class SystemUIHooker : YukiBaseHooker() {
|
|
|
|
|
}
|
|
|
|
|
afterHook {
|
|
|
|
|
if (firstArgs != null) instance<ImageView>().also {
|
|
|
|
|
/** 注册壁纸颜色监听 */
|
|
|
|
|
registerWallpaperColorChanged(it)
|
|
|
|
|
/** 注册广播 */
|
|
|
|
|
registerReceiver(it.context)
|
|
|
|
|
/** 缓存实例 */
|
|
|
|
|
statusBarIconViews.add(it)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@@ -769,22 +822,25 @@ class SystemUIHooker : YukiBaseHooker() {
|
|
|
|
|
/** 获取小图标 */
|
|
|
|
|
val iconImageView =
|
|
|
|
|
NotificationHeaderViewWrapperClass.clazz
|
|
|
|
|
.field { name = "mIcon" }.of<ImageView>(instance) ?: return@afterHook
|
|
|
|
|
.field { name = "mIcon" }.get(instance).cast<ImageView>() ?: return@afterHook
|
|
|
|
|
|
|
|
|
|
/** 获取 [ExpandableNotificationRowClass] */
|
|
|
|
|
val rowPair = instance.getRowPair()
|
|
|
|
|
|
|
|
|
|
/** 获取 [StatusBarNotification] */
|
|
|
|
|
val sbnPair = instance.getSbnPair()
|
|
|
|
|
val expandedNf = rowPair.second.getSbn()
|
|
|
|
|
|
|
|
|
|
/** 通知是否展开 */
|
|
|
|
|
var isExpanded = sbnPair.first
|
|
|
|
|
var isExpanded = rowPair.first
|
|
|
|
|
|
|
|
|
|
/** 获取优先级 */
|
|
|
|
|
val importance =
|
|
|
|
|
(iconImageView.context.getSystemService(Context.NOTIFICATION_SERVICE) as? NotificationManager?)
|
|
|
|
|
?.getNotificationChannel(sbnPair.second?.notification?.channelId)?.importance ?: 0
|
|
|
|
|
?.getNotificationChannel(expandedNf?.notification?.channelId)?.importance ?: 0
|
|
|
|
|
/** 非最小化优先级的通知全部设置为展开状态 */
|
|
|
|
|
if (importance != 1) isExpanded = true
|
|
|
|
|
/** 执行 Hook */
|
|
|
|
|
compatNotifyIcon(iconImageView.context, sbnPair.second, iconImageView, isExpanded)
|
|
|
|
|
compatNotifyIcon(iconImageView.context, expandedNf, iconImageView, isExpanded)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/** 记录实例 */
|
|
|
|
@@ -799,8 +855,13 @@ class SystemUIHooker : YukiBaseHooker() {
|
|
|
|
|
injectMember {
|
|
|
|
|
method { name = "handleAppIcon" }
|
|
|
|
|
replaceUnit {
|
|
|
|
|
field { name = "mAppIcon" }.of<ImageView>(instance)?.apply {
|
|
|
|
|
compatNotifyIcon(context, instance.getSbnPair().second, iconImageView = this, isUseAndroid12Style = true)
|
|
|
|
|
field { name = "mAppIcon" }.get(instance).cast<ImageView>()?.apply {
|
|
|
|
|
compatNotifyIcon(
|
|
|
|
|
context = context,
|
|
|
|
|
expandedNf = instance.getRowPair().second.getSbn(),
|
|
|
|
|
iconImageView = this,
|
|
|
|
|
isUseAndroid12Style = true
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@@ -810,6 +871,29 @@ class SystemUIHooker : YukiBaseHooker() {
|
|
|
|
|
afterHook { miuiNotificationViewWrappers.add(instance) }
|
|
|
|
|
}
|
|
|
|
|
}.ignoredHookClassNotFoundFailure()
|
|
|
|
|
/** 修改 MIUI 风格通知栏的通知图标 - 折叠通知 */
|
|
|
|
|
MiuiNotificationChildrenContainerClass.hook {
|
|
|
|
|
/** 替换通知小图标 */
|
|
|
|
|
injectMember {
|
|
|
|
|
method {
|
|
|
|
|
name = "updateAppIcon"
|
|
|
|
|
param(BooleanType)
|
|
|
|
|
}
|
|
|
|
|
afterHook {
|
|
|
|
|
val expandedNf = NotificationChildrenContainerClass.clazz.field {
|
|
|
|
|
name = "mContainingNotification"
|
|
|
|
|
}.get(instance).self.getSbn()
|
|
|
|
|
field { name = "mAppIcon" }.get(instance).cast<ImageView>()?.apply {
|
|
|
|
|
compatNotifyIcon(context, expandedNf, iconImageView = this, isUseAndroid12Style = true)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/** 记录实例 */
|
|
|
|
|
injectMember {
|
|
|
|
|
constructor { param(ContextClass, AttributeSetClass) }
|
|
|
|
|
afterHook { miuiNotificationChildrenContainers.add(instance()) }
|
|
|
|
|
}
|
|
|
|
|
}.ignoredHookClassNotFoundFailure()
|
|
|
|
|
/** 干掉下拉通知图标自动设置回 APP 图标的方法 */
|
|
|
|
|
NotificationHeaderViewWrapperInjectorClass.hook {
|
|
|
|
|
injectMember {
|
|
|
|
@@ -867,11 +951,16 @@ class SystemUIHooker : YukiBaseHooker() {
|
|
|
|
|
injectMember {
|
|
|
|
|
method { name = "updateTime" }
|
|
|
|
|
afterHook {
|
|
|
|
|
if (isEnableHookColorNotifyIcon() && prefs.get(DataConst.ENABLE_NOTIFY_ICON_FIX_AUTO))
|
|
|
|
|
IconAdaptationTool.prepareAutoUpdateIconRule(
|
|
|
|
|
context = instance<View>().context,
|
|
|
|
|
timeSet = prefs.get(DataConst.NOTIFY_ICON_FIX_AUTO_TIME)
|
|
|
|
|
)
|
|
|
|
|
instance<View>().context.also {
|
|
|
|
|
/** 注册广播 */
|
|
|
|
|
registerReceiver(it)
|
|
|
|
|
/** 注册定时监听 */
|
|
|
|
|
if (isEnableHookColorNotifyIcon() && prefs.get(DataConst.ENABLE_NOTIFY_ICON_FIX_AUTO))
|
|
|
|
|
IconAdaptationTool.prepareAutoUpdateIconRule(
|
|
|
|
|
context = it,
|
|
|
|
|
timeSet = prefs.get(DataConst.NOTIFY_ICON_FIX_AUTO_TIME)
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}.ignoredHookClassNotFoundFailure()
|
|
|
|
|