修复一个问题

This commit is contained in:
2022-02-01 22:48:27 +08:00
parent 95160d30b3
commit 2ab36dd2f3

View File

@@ -459,8 +459,7 @@ class HookMain : IXposedHookLoadPackage {
"getSmallIcon", "getSmallIcon",
lpparam.findClass(ExpandedNotificationClass), lpparam.findClass(ExpandedNotificationClass),
Int::class.java Int::class.java
) ).apply { isAccessible = true }
.apply { isAccessible = true }
} catch (_: Throwable) { } catch (_: Throwable) {
/** 旧版方法 */ /** 旧版方法 */
lpparam.findClass(NotificationUtilClass) lpparam.findClass(NotificationUtilClass)
@@ -477,6 +476,7 @@ class HookMain : IXposedHookLoadPackage {
} }
/** 修复下拉通知图标自动设置回 APP 图标的方法 */ /** 修复下拉通知图标自动设置回 APP 图标的方法 */
runWithoutError(error = "AutoSetAppIcon") { runWithoutError(error = "AutoSetAppIcon") {
var isNewWay = true
try { try {
/** 新版方法 */ /** 新版方法 */
lpparam.findClass(NotificationHeaderViewWrapperInjectorClass) lpparam.findClass(NotificationHeaderViewWrapperInjectorClass)
@@ -487,6 +487,7 @@ class HookMain : IXposedHookLoadPackage {
lpparam.findClass(ExpandedNotificationClass) lpparam.findClass(ExpandedNotificationClass)
).apply { isAccessible = true } ).apply { isAccessible = true }
} catch (_: Throwable) { } catch (_: Throwable) {
isNewWay = false
/** 旧版方法 */ /** 旧版方法 */
lpparam.findClass(NotificationHeaderViewWrapperInjectorClass) lpparam.findClass(NotificationHeaderViewWrapperInjectorClass)
.getDeclaredMethod( .getDeclaredMethod(
@@ -497,7 +498,7 @@ class HookMain : IXposedHookLoadPackage {
}.also { }.also {
XposedBridge.hookMethod(it, object : XC_MethodReplacement() { XposedBridge.hookMethod(it, object : XC_MethodReplacement() {
override fun replaceHookedMethod(param: MethodHookParam): Any? { override fun replaceHookedMethod(param: MethodHookParam): Any? {
lpparam.hookNotifyIconOnSet(param, isNew = true) lpparam.hookNotifyIconOnSet(param, isNew = isNewWay)
return null return null
} }
}) })