mirror of
https://github.com/fankes/ColorOSNotifyIcon.git
synced 2025-09-08 03:24:11 +08:00
fix: block coloros 15 useAppIconForSmallIcon method (#77)
This commit is contained in:
@@ -88,6 +88,8 @@ import com.highcapable.yukihookapi.hook.type.java.FloatType
|
|||||||
import com.highcapable.yukihookapi.hook.type.java.IntType
|
import com.highcapable.yukihookapi.hook.type.java.IntType
|
||||||
import com.highcapable.yukihookapi.hook.type.java.LongType
|
import com.highcapable.yukihookapi.hook.type.java.LongType
|
||||||
import top.defaults.drawabletoolbox.DrawableBuilder
|
import top.defaults.drawabletoolbox.DrawableBuilder
|
||||||
|
import androidx.core.graphics.drawable.toDrawable
|
||||||
|
import com.highcapable.yukihookapi.hook.type.android.NotificationClass
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统界面核心 Hook 类
|
* 系统界面核心 Hook 类
|
||||||
@@ -143,6 +145,9 @@ object SystemUIHooker : YukiBaseHooker() {
|
|||||||
/** ColorOS 存在的类 - 旧版本不存在 */
|
/** ColorOS 存在的类 - 旧版本不存在 */
|
||||||
private val BasePlayViewHolderClass by lazyClassOrNull("com.oplusos.systemui.media.base.BasePlayViewHolder")
|
private val BasePlayViewHolderClass by lazyClassOrNull("com.oplusos.systemui.media.base.BasePlayViewHolder")
|
||||||
|
|
||||||
|
/** ColorOS 存在的类 - 旧版本不存在 */
|
||||||
|
private val OplusNotificationSmallIconUtilClass by lazyClassOrNull("com.oplus.systemui.statusbar.notification.util.OplusNotificationSmallIconUtil")
|
||||||
|
|
||||||
/** 根据多个版本存在不同的包名相同的类 */
|
/** 根据多个版本存在不同的包名相同的类 */
|
||||||
private val OplusNotificationIconAreaControllerClass by lazyClass(
|
private val OplusNotificationIconAreaControllerClass by lazyClass(
|
||||||
VariousClass(
|
VariousClass(
|
||||||
@@ -434,7 +439,7 @@ object SystemUIHooker : YukiBaseHooker() {
|
|||||||
iconDatas.takeIf { it.isNotEmpty() }?.forEach {
|
iconDatas.takeIf { it.isNotEmpty() }?.forEach {
|
||||||
if (packageName == it.packageName && isAppNotifyHookOf(it)) {
|
if (packageName == it.packageName && isAppNotifyHookOf(it)) {
|
||||||
if (isGrayscaleIcon.not() || isAppNotifyHookAllOf(it))
|
if (isGrayscaleIcon.not() || isAppNotifyHookAllOf(it))
|
||||||
customPair = Triple(BitmapDrawable(context.resources, it.iconBitmap), it.iconColor, false)
|
customPair = Triple(it.iconBitmap.toDrawable(context.resources), it.iconColor, false)
|
||||||
return@run
|
return@run
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -696,6 +701,13 @@ object SystemUIHooker : YukiBaseHooker() {
|
|||||||
/** 是否移除 */
|
/** 是否移除 */
|
||||||
if (ConfigData.isEnableRemoveDndAlertNotify) resultNull()
|
if (ConfigData.isEnableRemoveDndAlertNotify) resultNull()
|
||||||
}
|
}
|
||||||
|
/** 拦截ColorOS使用应用图标判断 */
|
||||||
|
OplusNotificationSmallIconUtilClass?.method {
|
||||||
|
name = "useAppIconForSmallIcon"
|
||||||
|
param(NotificationClass)
|
||||||
|
}?.hook()?.before {
|
||||||
|
resultFalse()
|
||||||
|
}
|
||||||
/** 修复并替换 ColorOS 以及原生灰度图标色彩判断 */
|
/** 修复并替换 ColorOS 以及原生灰度图标色彩判断 */
|
||||||
NotificationUtilsClass.apply {
|
NotificationUtilsClass.apply {
|
||||||
method {
|
method {
|
||||||
@@ -768,8 +780,8 @@ object SystemUIHooker : YukiBaseHooker() {
|
|||||||
}.onFind { way = 2 }
|
}.onFind { way = 2 }
|
||||||
}.hook().after {
|
}.hook().after {
|
||||||
when (way) {
|
when (way) {
|
||||||
1 -> notificationIconContainer = OplusNotificationIconAreaControllerClass.method { name = "getNotificationIcons" }.get(instance).invoke()
|
2 -> notificationIconContainer = OplusNotificationIconAreaControllerClass.method { name = "getNotificationIcons" }.get(instance).invoke()
|
||||||
2 -> {
|
1 -> {
|
||||||
notificationIconInstances.clear()
|
notificationIconInstances.clear()
|
||||||
field { name = "mLastToShow" }.get(instance).list<View>()
|
field { name = "mLastToShow" }.get(instance).list<View>()
|
||||||
.takeIf { it.isNotEmpty() }?.forEach { notificationIconInstances.add(it) }
|
.takeIf { it.isNotEmpty() }?.forEach { notificationIconInstances.add(it) }
|
||||||
|
Reference in New Issue
Block a user