From ffb706864a87de8a1bbfac55001f2479b8e04599 Mon Sep 17 00:00:00 2001 From: Fankesyooni Date: Wed, 13 Apr 2022 05:03:30 +0800 Subject: [PATCH] Update YukiHookAPI --- app/build.gradle | 6 +++--- .../coloros/notify/hook/entity/SystemUIHooker.kt | 16 ++++++++-------- build.gradle | 5 +++-- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 19d032a..9a16b44 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -38,7 +38,7 @@ android { buildTypes { release { - minifyEnabled true + minifyEnabled rootProject.ext.enableR8 signingConfig signingConfigs.debug proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } @@ -72,8 +72,8 @@ tasks.whenTaskAdded { dependencies { compileOnly 'de.robv.android.xposed:api:82' - implementation 'com.highcapable.yukihookapi:api:1.0.73' - ksp 'com.highcapable.yukihookapi:ksp-xposed:1.0.73' + implementation 'com.highcapable.yukihookapi:api:1.0.75' + ksp 'com.highcapable.yukihookapi:ksp-xposed:1.0.75' implementation 'com.github.tiann:FreeReflection:3.1.0' implementation "com.github.topjohnwu.libsu:core:3.1.2" implementation 'androidx.annotation:annotation:1.3.0' diff --git a/app/src/main/java/com/fankes/coloros/notify/hook/entity/SystemUIHooker.kt b/app/src/main/java/com/fankes/coloros/notify/hook/entity/SystemUIHooker.kt index a9fcd62..4a07c75 100644 --- a/app/src/main/java/com/fankes/coloros/notify/hook/entity/SystemUIHooker.kt +++ b/app/src/main/java/com/fankes/coloros/notify/hook/entity/SystemUIHooker.kt @@ -549,7 +549,7 @@ class SystemUIHooker : YukiBaseHooker() { } beforeHook { /** 是否移除 */ - if (args().int() == 7 && prefs.get(DataConst.REMOVE_CHANGECP_NOTIFY)) resultNull() + if (args().first().int() == 7 && prefs.get(DataConst.REMOVE_CHANGECP_NOTIFY)) resultNull() } } } @@ -573,7 +573,7 @@ class SystemUIHooker : YukiBaseHooker() { name = "isGrayscaleOplus" param(ImageViewClass, OplusContrastColorUtilClass) } - replaceAny { firstArgs()?.let { isGrayscaleIcon(it.context, it.drawable) } } + replaceAny { args().first().cast()?.let { isGrayscaleIcon(it.context, it.drawable) } } }.ignoredHookingFailure() } /** 替换状态栏图标 */ @@ -588,7 +588,7 @@ class SystemUIHooker : YukiBaseHooker() { .get(field { name = "iconBuilder" }.get(instance).cast()).cast()?.also { context -> NotificationEntryClass.clazz.method { name = "getSbn" - }.get(firstArgs).invoke()?.also { nf -> + }.get(args[0]).invoke()?.also { nf -> nf.notification.smallIcon.loadDrawable(context).also { iconDrawable -> compatStatusIcon( context = context, @@ -620,7 +620,7 @@ class SystemUIHooker : YukiBaseHooker() { param(StatusBarNotificationClass) } afterHook { - if (firstArgs != null) instance().also { + if (args[0] != null) instance().also { /** 注册壁纸颜色监听 */ registerWallpaperColorChanged(it) /** 注册广播 */ @@ -698,7 +698,7 @@ class SystemUIHooker : YukiBaseHooker() { param(ContextClass, IntentClass) } afterHook { - if (isEnableHookColorNotifyIcon()) (lastArgs as? Intent)?.also { + if (isEnableHookColorNotifyIcon()) args().last().cast()?.also { if (it.action.equals(Intent.ACTION_PACKAGE_REPLACED).not() && it.getBooleanExtra(Intent.EXTRA_REPLACING, false) ) return@also @@ -708,11 +708,11 @@ class SystemUIHooker : YukiBaseHooker() { if (iconDatas.takeIf { e -> e.isNotEmpty() } ?.filter { e -> e.packageName == newPkgName } .isNullOrEmpty() - ) IconAdaptationTool.pushNewAppSupportNotify(firstArgs()!!, newPkgName) + ) IconAdaptationTool.pushNewAppSupportNotify(args().first().cast()!!, newPkgName) } Intent.ACTION_PACKAGE_REMOVED -> IconAdaptationTool.removeNewAppSupportNotify( - context = firstArgs()!!, + context = args().first().cast()!!, packageName = it.data?.schemeSpecificPart ?: "" ) } @@ -728,7 +728,7 @@ class SystemUIHooker : YukiBaseHooker() { param(ContextClass, IntentClass) } afterHook { - firstArgs()?.also { + args().first().cast()?.also { /** 注册广播 */ registerReceiver(it) /** 注册定时监听 */ diff --git a/build.gradle b/build.gradle index f4b3ad4..99f0701 100644 --- a/build.gradle +++ b/build.gradle @@ -1,12 +1,13 @@ plugins { - id 'com.android.application' version '7.1.2' apply false - id 'com.android.library' version '7.1.2' apply false + id 'com.android.application' version '7.1.3' apply false + id 'com.android.library' version '7.1.3' apply false id 'org.jetbrains.kotlin.android' version '1.6.10' apply false } ext { appVersionName = "1.53" appVersionCode = 10 + enableR8 = true } task clean(type: Delete) {