Make SystemUIHooker singleton

This commit is contained in:
2022-05-08 15:04:21 +08:00
parent 627697d586
commit 826805c552
2 changed files with 61 additions and 62 deletions

View File

@@ -54,7 +54,7 @@ class HookEntry : IYukiHookXposedInit {
/** Hook 被手动关闭停止 Hook */
prefs.get(DataConst.ENABLE_MODULE).not() -> loggerW(msg = "Aborted Hook -> Hook Closed")
/** 开始 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.
*/
@file:Suppress("StaticFieldLeak")
package com.fankes.miui.notify.hook.entity
import android.app.NotificationManager
@@ -65,9 +67,7 @@ import com.highcapable.yukihookapi.hook.type.java.IntType
/**
* 系统界面核心 Hook 类
*/
class SystemUIHooker : YukiBaseHooker() {
companion object {
object SystemUIHooker : YukiBaseHooker() {
/** MIUI 新版本存在的类 */
private const val SystemUIApplicationClass = "$SYSTEMUI_PACKAGE_NAME.SystemUIApplication"
@@ -141,7 +141,6 @@ class SystemUIHooker : YukiBaseHooker() {
"$SYSTEMUI_PACKAGE_NAME.statusbar.notification.ExpandedNotification",
"$SYSTEMUI_PACKAGE_NAME.miui.statusbar.ExpandedNotification"
)
}
/** 缓存的通知图标优化数组 */
private var iconDatas = ArrayList<IconDataBean>()