Make SystemUIHooker singleton

This commit is contained in:
2022-05-08 15:08:05 +08:00
parent 6ae1d3e726
commit 399cfafd29
2 changed files with 83 additions and 84 deletions

View File

@@ -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)
} }
} }
} }

View File

@@ -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,9 +73,7 @@ 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"
@@ -175,7 +175,6 @@ class SystemUIHooker : YukiBaseHooker() {
"$SYSTEMUI_PACKAGE_NAME.statusbar.notification.row.wrapper.NotificationHeaderViewWrapper", "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.row.wrapper.NotificationHeaderViewWrapper",
"$SYSTEMUI_PACKAGE_NAME.statusbar.notification.NotificationHeaderViewWrapper" "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.NotificationHeaderViewWrapper"
) )
}
/** 缓存的彩色 APP 图标 */ /** 缓存的彩色 APP 图标 */
private var appIcons = ArrayMap<String, Drawable>() private var appIcons = ArrayMap<String, Drawable>()