mirror of
https://github.com/fankes/ColorOSNotifyIcon.git
synced 2025-09-06 02:35:41 +08:00
Make SystemUIHooker singleton
This commit is contained in:
@@ -47,7 +47,7 @@ class HookEntry : IYukiHookXposedInit {
|
|||||||
/** Hook 被手动关闭停止 Hook */
|
/** Hook 被手动关闭停止 Hook */
|
||||||
prefs.get(DataConst.ENABLE_MODULE).not() -> loggerW(msg = "Aborted Hook -> Hook Closed")
|
prefs.get(DataConst.ENABLE_MODULE).not() -> loggerW(msg = "Aborted Hook -> Hook Closed")
|
||||||
/** 开始 Hook */
|
/** 开始 Hook */
|
||||||
else -> loadApp(SYSTEMUI_PACKAGE_NAME, SystemUIHooker())
|
else -> loadApp(SYSTEMUI_PACKAGE_NAME, SystemUIHooker)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -20,6 +20,8 @@
|
|||||||
*
|
*
|
||||||
* This file is Created by fankes on 2022/3/25.
|
* This file is Created by fankes on 2022/3/25.
|
||||||
*/
|
*/
|
||||||
|
@file:Suppress("StaticFieldLeak")
|
||||||
|
|
||||||
package com.fankes.coloros.notify.hook.entity
|
package com.fankes.coloros.notify.hook.entity
|
||||||
|
|
||||||
import android.app.WallpaperManager
|
import android.app.WallpaperManager
|
||||||
@@ -71,111 +73,108 @@ import com.highcapable.yukihookapi.hook.type.java.LongType
|
|||||||
/**
|
/**
|
||||||
* 系统界面核心 Hook 类
|
* 系统界面核心 Hook 类
|
||||||
*/
|
*/
|
||||||
class SystemUIHooker : YukiBaseHooker() {
|
object SystemUIHooker : YukiBaseHooker() {
|
||||||
|
|
||||||
companion object {
|
/** 原生存在的类 */
|
||||||
|
private const val ContrastColorUtilClass = "com.android.internal.util.ContrastColorUtil"
|
||||||
|
|
||||||
/** 原生存在的类 */
|
/** 原生存在的类 */
|
||||||
private const val ContrastColorUtilClass = "com.android.internal.util.ContrastColorUtil"
|
private const val NotificationUtilsClass = "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.NotificationUtils"
|
||||||
|
|
||||||
/** 原生存在的类 */
|
/** 原生存在的类 */
|
||||||
private const val NotificationUtilsClass = "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.NotificationUtils"
|
private const val NotificationEntryClass = "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.collection.NotificationEntry"
|
||||||
|
|
||||||
/** 原生存在的类 */
|
/** 原生存在的类 */
|
||||||
private const val NotificationEntryClass = "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.collection.NotificationEntry"
|
private const val StatusBarIconClass = "com.android.internal.statusbar.StatusBarIcon"
|
||||||
|
|
||||||
/** 原生存在的类 */
|
/** 原生存在的类 */
|
||||||
private const val StatusBarIconClass = "com.android.internal.statusbar.StatusBarIcon"
|
private const val StatusBarIconViewClass = "$SYSTEMUI_PACKAGE_NAME.statusbar.StatusBarIconView"
|
||||||
|
|
||||||
/** 原生存在的类 */
|
/** 原生存在的类 */
|
||||||
private const val StatusBarIconViewClass = "$SYSTEMUI_PACKAGE_NAME.statusbar.StatusBarIconView"
|
private const val IconBuilderClass = "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.icon.IconBuilder"
|
||||||
|
|
||||||
/** 原生存在的类 */
|
/** 原生存在的类 */
|
||||||
private const val IconBuilderClass = "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.icon.IconBuilder"
|
private const val IconManagerClass = "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.icon.IconManager"
|
||||||
|
|
||||||
/** 原生存在的类 */
|
/** ColorOS 存在的类 - 旧版本不存在 */
|
||||||
private const val IconManagerClass = "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.icon.IconManager"
|
private const val OplusContrastColorUtilClass = "com.oplusos.util.OplusContrastColorUtil"
|
||||||
|
|
||||||
/** ColorOS 存在的类 - 旧版本不存在 */
|
/** 原生存在的类 */
|
||||||
private const val OplusContrastColorUtilClass = "com.oplusos.util.OplusContrastColorUtil"
|
private const val PluginManagerImplClass = "$SYSTEMUI_PACKAGE_NAME.shared.plugins.PluginManagerImpl"
|
||||||
|
|
||||||
/** 原生存在的类 */
|
/** 原生存在的类 */
|
||||||
private const val PluginManagerImplClass = "$SYSTEMUI_PACKAGE_NAME.shared.plugins.PluginManagerImpl"
|
private const val NotificationBackgroundViewClass = "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.row.NotificationBackgroundView"
|
||||||
|
|
||||||
/** 原生存在的类 */
|
/** ColorOS 存在的类 - 旧版本不存在 */
|
||||||
private const val NotificationBackgroundViewClass = "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.row.NotificationBackgroundView"
|
private const val OplusNotificationBackgroundViewClass =
|
||||||
|
"com.oplusos.systemui.statusbar.notification.row.OplusNotificationBackgroundView"
|
||||||
|
|
||||||
/** ColorOS 存在的类 - 旧版本不存在 */
|
/** 根据多个版本存在不同的包名相同的类 */
|
||||||
private const val OplusNotificationBackgroundViewClass =
|
private val OplusNotificationIconAreaControllerClass = VariousClass(
|
||||||
"com.oplusos.systemui.statusbar.notification.row.OplusNotificationBackgroundView"
|
"com.oplusos.systemui.statusbar.phone.OplusNotificationIconAreaController",
|
||||||
|
"com.oplusos.systemui.statusbar.policy.OplusNotificationIconAreaController",
|
||||||
|
"com.coloros.systemui.statusbar.policy.ColorNotificationIconAreaController"
|
||||||
|
)
|
||||||
|
|
||||||
/** 根据多个版本存在不同的包名相同的类 */
|
/** 根据多个版本存在不同的包名相同的类 */
|
||||||
private val OplusNotificationIconAreaControllerClass = VariousClass(
|
private val SystemPromptControllerClass = VariousClass(
|
||||||
"com.oplusos.systemui.statusbar.phone.OplusNotificationIconAreaController",
|
"com.oplusos.systemui.statusbar.policy.SystemPromptController",
|
||||||
"com.oplusos.systemui.statusbar.policy.OplusNotificationIconAreaController",
|
"com.coloros.systemui.statusbar.policy.ColorSystemPromptController"
|
||||||
"com.coloros.systemui.statusbar.policy.ColorNotificationIconAreaController"
|
)
|
||||||
)
|
|
||||||
|
|
||||||
/** 根据多个版本存在不同的包名相同的类 */
|
/** 根据多个版本存在不同的包名相同的类 */
|
||||||
private val SystemPromptControllerClass = VariousClass(
|
private val RoundRectDrawableUtilClass = VariousClass(
|
||||||
"com.oplusos.systemui.statusbar.policy.SystemPromptController",
|
"com.oplusos.systemui.notification.util.RoundRectDrawableUtil",
|
||||||
"com.coloros.systemui.statusbar.policy.ColorSystemPromptController"
|
"com.coloros.systemui.notification.util.RoundRectDrawableUtil"
|
||||||
)
|
)
|
||||||
|
|
||||||
/** 根据多个版本存在不同的包名相同的类 */
|
/** 根据多个版本存在不同的包名相同的类 */
|
||||||
private val RoundRectDrawableUtilClass = VariousClass(
|
private val RoundRectDrawableUtil_CompanionClass = VariousClass(
|
||||||
"com.oplusos.systemui.notification.util.RoundRectDrawableUtil",
|
"com.oplusos.systemui.notification.util.RoundRectDrawableUtil\$Companion",
|
||||||
"com.coloros.systemui.notification.util.RoundRectDrawableUtil"
|
"com.oplusos.systemui.notification.util.RoundRectDrawableUtil\$Companion"
|
||||||
)
|
)
|
||||||
|
|
||||||
/** 根据多个版本存在不同的包名相同的类 */
|
/** 根据多个版本存在不同的包名相同的类 */
|
||||||
private val RoundRectDrawableUtil_CompanionClass = VariousClass(
|
private val DndAlertHelperClass = VariousClass(
|
||||||
"com.oplusos.systemui.notification.util.RoundRectDrawableUtil\$Companion",
|
"com.oplusos.systemui.notification.helper.DndAlertHelper",
|
||||||
"com.oplusos.systemui.notification.util.RoundRectDrawableUtil\$Companion"
|
"com.coloros.systemui.notification.helper.DndAlertHelper"
|
||||||
)
|
)
|
||||||
|
|
||||||
/** 根据多个版本存在不同的包名相同的类 */
|
/** 根据多个版本存在不同的包名相同的类 */
|
||||||
private val DndAlertHelperClass = VariousClass(
|
private val OplusPowerNotificationWarningsClass = VariousClass(
|
||||||
"com.oplusos.systemui.notification.helper.DndAlertHelper",
|
"com.oplusos.systemui.notification.power.OplusPowerNotificationWarnings",
|
||||||
"com.coloros.systemui.notification.helper.DndAlertHelper"
|
"com.coloros.systemui.notification.power.ColorosPowerNotificationWarnings"
|
||||||
)
|
)
|
||||||
|
|
||||||
/** 根据多个版本存在不同的包名相同的类 */
|
/** 根据多个版本存在不同的包名相同的类 */
|
||||||
private val OplusPowerNotificationWarningsClass = VariousClass(
|
private val AbstractReceiverClass = VariousClass(
|
||||||
"com.oplusos.systemui.notification.power.OplusPowerNotificationWarnings",
|
"com.oplusos.systemui.common.receiver.AbstractReceiver",
|
||||||
"com.coloros.systemui.notification.power.ColorosPowerNotificationWarnings"
|
"com.coloros.systemui.common.receiver.AbstractReceiver"
|
||||||
)
|
)
|
||||||
|
|
||||||
/** 根据多个版本存在不同的包名相同的类 */
|
/** 根据多个版本存在不同的包名相同的类 */
|
||||||
private val AbstractReceiverClass = VariousClass(
|
private val StatusBarNotificationPresenterClass = VariousClass(
|
||||||
"com.oplusos.systemui.common.receiver.AbstractReceiver",
|
"$SYSTEMUI_PACKAGE_NAME.statusbar.phone.StatusBarNotificationPresenter",
|
||||||
"com.coloros.systemui.common.receiver.AbstractReceiver"
|
"$SYSTEMUI_PACKAGE_NAME.statusbar.phone.StatusBar"
|
||||||
)
|
)
|
||||||
|
|
||||||
/** 根据多个版本存在不同的包名相同的类 */
|
/** 根据多个版本存在不同的包名相同的类 */
|
||||||
private val StatusBarNotificationPresenterClass = VariousClass(
|
private val ExpandableNotificationRowClass = VariousClass(
|
||||||
"$SYSTEMUI_PACKAGE_NAME.statusbar.phone.StatusBarNotificationPresenter",
|
"$SYSTEMUI_PACKAGE_NAME.statusbar.notification.row.ExpandableNotificationRow",
|
||||||
"$SYSTEMUI_PACKAGE_NAME.statusbar.phone.StatusBar"
|
"$SYSTEMUI_PACKAGE_NAME.statusbar.ExpandableNotificationRow"
|
||||||
)
|
)
|
||||||
|
|
||||||
/** 根据多个版本存在不同的包名相同的类 */
|
/** 根据多个版本存在不同的包名相同的类 */
|
||||||
private val ExpandableNotificationRowClass = VariousClass(
|
private val NotificationViewWrapperClass = VariousClass(
|
||||||
"$SYSTEMUI_PACKAGE_NAME.statusbar.notification.row.ExpandableNotificationRow",
|
"$SYSTEMUI_PACKAGE_NAME.statusbar.notification.row.wrapper.NotificationViewWrapper",
|
||||||
"$SYSTEMUI_PACKAGE_NAME.statusbar.ExpandableNotificationRow"
|
"$SYSTEMUI_PACKAGE_NAME.statusbar.notification.NotificationViewWrapper"
|
||||||
)
|
)
|
||||||
|
|
||||||
/** 根据多个版本存在不同的包名相同的类 */
|
/** 根据多个版本存在不同的包名相同的类 */
|
||||||
private val NotificationViewWrapperClass = VariousClass(
|
private val NotificationHeaderViewWrapperClass = VariousClass(
|
||||||
"$SYSTEMUI_PACKAGE_NAME.statusbar.notification.row.wrapper.NotificationViewWrapper",
|
"$SYSTEMUI_PACKAGE_NAME.statusbar.notification.row.wrapper.NotificationHeaderViewWrapper",
|
||||||
"$SYSTEMUI_PACKAGE_NAME.statusbar.notification.NotificationViewWrapper"
|
"$SYSTEMUI_PACKAGE_NAME.statusbar.notification.NotificationHeaderViewWrapper"
|
||||||
)
|
)
|
||||||
|
|
||||||
/** 根据多个版本存在不同的包名相同的类 */
|
|
||||||
private val NotificationHeaderViewWrapperClass = VariousClass(
|
|
||||||
"$SYSTEMUI_PACKAGE_NAME.statusbar.notification.row.wrapper.NotificationHeaderViewWrapper",
|
|
||||||
"$SYSTEMUI_PACKAGE_NAME.statusbar.notification.NotificationHeaderViewWrapper"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 缓存的彩色 APP 图标 */
|
/** 缓存的彩色 APP 图标 */
|
||||||
private var appIcons = ArrayMap<String, Drawable>()
|
private var appIcons = ArrayMap<String, Drawable>()
|
||||||
|
Reference in New Issue
Block a user