|
20 | 20 | * |
21 | 21 | * This file is Created by fankes on 2022/3/25. |
22 | 22 | */ |
| 23 | +@file:Suppress("StaticFieldLeak") |
| 24 | + |
23 | 25 | package com.fankes.coloros.notify.hook.entity |
24 | 26 |
|
25 | 27 | import android.app.WallpaperManager |
@@ -71,111 +73,108 @@ import com.highcapable.yukihookapi.hook.type.java.LongType |
71 | 73 | /** |
72 | 74 | * 系统界面核心 Hook 类 |
73 | 75 | */ |
74 | | -class SystemUIHooker : YukiBaseHooker() { |
75 | | - |
76 | | - companion object { |
77 | | - |
78 | | - /** 原生存在的类 */ |
79 | | - private const val ContrastColorUtilClass = "com.android.internal.util.ContrastColorUtil" |
80 | | - |
81 | | - /** 原生存在的类 */ |
82 | | - private const val NotificationUtilsClass = "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.NotificationUtils" |
83 | | - |
84 | | - /** 原生存在的类 */ |
85 | | - private const val NotificationEntryClass = "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.collection.NotificationEntry" |
86 | | - |
87 | | - /** 原生存在的类 */ |
88 | | - private const val StatusBarIconClass = "com.android.internal.statusbar.StatusBarIcon" |
89 | | - |
90 | | - /** 原生存在的类 */ |
91 | | - private const val StatusBarIconViewClass = "$SYSTEMUI_PACKAGE_NAME.statusbar.StatusBarIconView" |
92 | | - |
93 | | - /** 原生存在的类 */ |
94 | | - private const val IconBuilderClass = "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.icon.IconBuilder" |
95 | | - |
96 | | - /** 原生存在的类 */ |
97 | | - private const val IconManagerClass = "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.icon.IconManager" |
98 | | - |
99 | | - /** ColorOS 存在的类 - 旧版本不存在 */ |
100 | | - private const val OplusContrastColorUtilClass = "com.oplusos.util.OplusContrastColorUtil" |
101 | | - |
102 | | - /** 原生存在的类 */ |
103 | | - private const val PluginManagerImplClass = "$SYSTEMUI_PACKAGE_NAME.shared.plugins.PluginManagerImpl" |
104 | | - |
105 | | - /** 原生存在的类 */ |
106 | | - private const val NotificationBackgroundViewClass = "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.row.NotificationBackgroundView" |
107 | | - |
108 | | - /** ColorOS 存在的类 - 旧版本不存在 */ |
109 | | - private const val OplusNotificationBackgroundViewClass = |
110 | | - "com.oplusos.systemui.statusbar.notification.row.OplusNotificationBackgroundView" |
111 | | - |
112 | | - /** 根据多个版本存在不同的包名相同的类 */ |
113 | | - private val OplusNotificationIconAreaControllerClass = VariousClass( |
114 | | - "com.oplusos.systemui.statusbar.phone.OplusNotificationIconAreaController", |
115 | | - "com.oplusos.systemui.statusbar.policy.OplusNotificationIconAreaController", |
116 | | - "com.coloros.systemui.statusbar.policy.ColorNotificationIconAreaController" |
117 | | - ) |
118 | | - |
119 | | - /** 根据多个版本存在不同的包名相同的类 */ |
120 | | - private val SystemPromptControllerClass = VariousClass( |
121 | | - "com.oplusos.systemui.statusbar.policy.SystemPromptController", |
122 | | - "com.coloros.systemui.statusbar.policy.ColorSystemPromptController" |
123 | | - ) |
124 | | - |
125 | | - /** 根据多个版本存在不同的包名相同的类 */ |
126 | | - private val RoundRectDrawableUtilClass = VariousClass( |
127 | | - "com.oplusos.systemui.notification.util.RoundRectDrawableUtil", |
128 | | - "com.coloros.systemui.notification.util.RoundRectDrawableUtil" |
129 | | - ) |
130 | | - |
131 | | - /** 根据多个版本存在不同的包名相同的类 */ |
132 | | - private val RoundRectDrawableUtil_CompanionClass = VariousClass( |
133 | | - "com.oplusos.systemui.notification.util.RoundRectDrawableUtil\$Companion", |
134 | | - "com.oplusos.systemui.notification.util.RoundRectDrawableUtil\$Companion" |
135 | | - ) |
136 | | - |
137 | | - /** 根据多个版本存在不同的包名相同的类 */ |
138 | | - private val DndAlertHelperClass = VariousClass( |
139 | | - "com.oplusos.systemui.notification.helper.DndAlertHelper", |
140 | | - "com.coloros.systemui.notification.helper.DndAlertHelper" |
141 | | - ) |
142 | | - |
143 | | - /** 根据多个版本存在不同的包名相同的类 */ |
144 | | - private val OplusPowerNotificationWarningsClass = VariousClass( |
145 | | - "com.oplusos.systemui.notification.power.OplusPowerNotificationWarnings", |
146 | | - "com.coloros.systemui.notification.power.ColorosPowerNotificationWarnings" |
147 | | - ) |
148 | | - |
149 | | - /** 根据多个版本存在不同的包名相同的类 */ |
150 | | - private val AbstractReceiverClass = VariousClass( |
151 | | - "com.oplusos.systemui.common.receiver.AbstractReceiver", |
152 | | - "com.coloros.systemui.common.receiver.AbstractReceiver" |
153 | | - ) |
154 | | - |
155 | | - /** 根据多个版本存在不同的包名相同的类 */ |
156 | | - private val StatusBarNotificationPresenterClass = VariousClass( |
157 | | - "$SYSTEMUI_PACKAGE_NAME.statusbar.phone.StatusBarNotificationPresenter", |
158 | | - "$SYSTEMUI_PACKAGE_NAME.statusbar.phone.StatusBar" |
159 | | - ) |
160 | | - |
161 | | - /** 根据多个版本存在不同的包名相同的类 */ |
162 | | - private val ExpandableNotificationRowClass = VariousClass( |
163 | | - "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.row.ExpandableNotificationRow", |
164 | | - "$SYSTEMUI_PACKAGE_NAME.statusbar.ExpandableNotificationRow" |
165 | | - ) |
166 | | - |
167 | | - /** 根据多个版本存在不同的包名相同的类 */ |
168 | | - private val NotificationViewWrapperClass = VariousClass( |
169 | | - "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.row.wrapper.NotificationViewWrapper", |
170 | | - "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.NotificationViewWrapper" |
171 | | - ) |
172 | | - |
173 | | - /** 根据多个版本存在不同的包名相同的类 */ |
174 | | - private val NotificationHeaderViewWrapperClass = VariousClass( |
175 | | - "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.row.wrapper.NotificationHeaderViewWrapper", |
176 | | - "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.NotificationHeaderViewWrapper" |
177 | | - ) |
178 | | - } |
| 76 | +object SystemUIHooker : YukiBaseHooker() { |
| 77 | + |
| 78 | + /** 原生存在的类 */ |
| 79 | + private const val ContrastColorUtilClass = "com.android.internal.util.ContrastColorUtil" |
| 80 | + |
| 81 | + /** 原生存在的类 */ |
| 82 | + private const val NotificationUtilsClass = "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.NotificationUtils" |
| 83 | + |
| 84 | + /** 原生存在的类 */ |
| 85 | + private const val NotificationEntryClass = "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.collection.NotificationEntry" |
| 86 | + |
| 87 | + /** 原生存在的类 */ |
| 88 | + private const val StatusBarIconClass = "com.android.internal.statusbar.StatusBarIcon" |
| 89 | + |
| 90 | + /** 原生存在的类 */ |
| 91 | + private const val StatusBarIconViewClass = "$SYSTEMUI_PACKAGE_NAME.statusbar.StatusBarIconView" |
| 92 | + |
| 93 | + /** 原生存在的类 */ |
| 94 | + private const val IconBuilderClass = "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.icon.IconBuilder" |
| 95 | + |
| 96 | + /** 原生存在的类 */ |
| 97 | + private const val IconManagerClass = "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.icon.IconManager" |
| 98 | + |
| 99 | + /** ColorOS 存在的类 - 旧版本不存在 */ |
| 100 | + private const val OplusContrastColorUtilClass = "com.oplusos.util.OplusContrastColorUtil" |
| 101 | + |
| 102 | + /** 原生存在的类 */ |
| 103 | + private const val PluginManagerImplClass = "$SYSTEMUI_PACKAGE_NAME.shared.plugins.PluginManagerImpl" |
| 104 | + |
| 105 | + /** 原生存在的类 */ |
| 106 | + private const val NotificationBackgroundViewClass = "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.row.NotificationBackgroundView" |
| 107 | + |
| 108 | + /** ColorOS 存在的类 - 旧版本不存在 */ |
| 109 | + private const val OplusNotificationBackgroundViewClass = |
| 110 | + "com.oplusos.systemui.statusbar.notification.row.OplusNotificationBackgroundView" |
| 111 | + |
| 112 | + /** 根据多个版本存在不同的包名相同的类 */ |
| 113 | + private val OplusNotificationIconAreaControllerClass = VariousClass( |
| 114 | + "com.oplusos.systemui.statusbar.phone.OplusNotificationIconAreaController", |
| 115 | + "com.oplusos.systemui.statusbar.policy.OplusNotificationIconAreaController", |
| 116 | + "com.coloros.systemui.statusbar.policy.ColorNotificationIconAreaController" |
| 117 | + ) |
| 118 | + |
| 119 | + /** 根据多个版本存在不同的包名相同的类 */ |
| 120 | + private val SystemPromptControllerClass = VariousClass( |
| 121 | + "com.oplusos.systemui.statusbar.policy.SystemPromptController", |
| 122 | + "com.coloros.systemui.statusbar.policy.ColorSystemPromptController" |
| 123 | + ) |
| 124 | + |
| 125 | + /** 根据多个版本存在不同的包名相同的类 */ |
| 126 | + private val RoundRectDrawableUtilClass = VariousClass( |
| 127 | + "com.oplusos.systemui.notification.util.RoundRectDrawableUtil", |
| 128 | + "com.coloros.systemui.notification.util.RoundRectDrawableUtil" |
| 129 | + ) |
| 130 | + |
| 131 | + /** 根据多个版本存在不同的包名相同的类 */ |
| 132 | + private val RoundRectDrawableUtil_CompanionClass = VariousClass( |
| 133 | + "com.oplusos.systemui.notification.util.RoundRectDrawableUtil\$Companion", |
| 134 | + "com.oplusos.systemui.notification.util.RoundRectDrawableUtil\$Companion" |
| 135 | + ) |
| 136 | + |
| 137 | + /** 根据多个版本存在不同的包名相同的类 */ |
| 138 | + private val DndAlertHelperClass = VariousClass( |
| 139 | + "com.oplusos.systemui.notification.helper.DndAlertHelper", |
| 140 | + "com.coloros.systemui.notification.helper.DndAlertHelper" |
| 141 | + ) |
| 142 | + |
| 143 | + /** 根据多个版本存在不同的包名相同的类 */ |
| 144 | + private val OplusPowerNotificationWarningsClass = VariousClass( |
| 145 | + "com.oplusos.systemui.notification.power.OplusPowerNotificationWarnings", |
| 146 | + "com.coloros.systemui.notification.power.ColorosPowerNotificationWarnings" |
| 147 | + ) |
| 148 | + |
| 149 | + /** 根据多个版本存在不同的包名相同的类 */ |
| 150 | + private val AbstractReceiverClass = VariousClass( |
| 151 | + "com.oplusos.systemui.common.receiver.AbstractReceiver", |
| 152 | + "com.coloros.systemui.common.receiver.AbstractReceiver" |
| 153 | + ) |
| 154 | + |
| 155 | + /** 根据多个版本存在不同的包名相同的类 */ |
| 156 | + private val StatusBarNotificationPresenterClass = VariousClass( |
| 157 | + "$SYSTEMUI_PACKAGE_NAME.statusbar.phone.StatusBarNotificationPresenter", |
| 158 | + "$SYSTEMUI_PACKAGE_NAME.statusbar.phone.StatusBar" |
| 159 | + ) |
| 160 | + |
| 161 | + /** 根据多个版本存在不同的包名相同的类 */ |
| 162 | + private val ExpandableNotificationRowClass = VariousClass( |
| 163 | + "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.row.ExpandableNotificationRow", |
| 164 | + "$SYSTEMUI_PACKAGE_NAME.statusbar.ExpandableNotificationRow" |
| 165 | + ) |
| 166 | + |
| 167 | + /** 根据多个版本存在不同的包名相同的类 */ |
| 168 | + private val NotificationViewWrapperClass = VariousClass( |
| 169 | + "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.row.wrapper.NotificationViewWrapper", |
| 170 | + "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.NotificationViewWrapper" |
| 171 | + ) |
| 172 | + |
| 173 | + /** 根据多个版本存在不同的包名相同的类 */ |
| 174 | + private val NotificationHeaderViewWrapperClass = VariousClass( |
| 175 | + "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.row.wrapper.NotificationHeaderViewWrapper", |
| 176 | + "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.NotificationHeaderViewWrapper" |
| 177 | + ) |
179 | 178 |
|
180 | 179 | /** 缓存的彩色 APP 图标 */ |
181 | 180 | private var appIcons = ArrayMap<String, Drawable>() |
|
0 commit comments