From d4f004894ea4daf6a727099ab1b032781663c42c Mon Sep 17 00:00:00 2001 From: Fankesyooni Date: Tue, 29 Mar 2022 21:17:09 +0800 Subject: [PATCH] Update YukiHookAPI --- app/build.gradle | 12 ++++++------ .../coloros/notify/hook/entity/SystemUIHooker.kt | 16 +++++++--------- .../notify/utils/factory/FunctionFactory.kt | 4 ++-- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index d6a7a8d..3b70348 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,7 +1,7 @@ plugins { id 'com.android.application' id 'org.jetbrains.kotlin.android' - id 'com.google.devtools.ksp' version '1.6.10-1.0.2' + id 'com.google.devtools.ksp' version '1.6.10-1.0.4' } android { @@ -44,11 +44,11 @@ android { } } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '11' } buildFeatures { viewBinding true @@ -72,8 +72,8 @@ tasks.whenTaskAdded { dependencies { compileOnly 'de.robv.android.xposed:api:82' - implementation 'com.highcapable.yukihookapi:api:1.0.67' - ksp 'com.highcapable.yukihookapi:ksp-xposed:1.0.67' + implementation 'com.highcapable.yukihookapi:api:1.0.68' + ksp 'com.highcapable.yukihookapi:ksp-xposed:1.0.68' 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 5da11ed..aa4e971 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 @@ -20,8 +20,6 @@ * * This file is Created by fankes on 2022/3/25. */ -@file:Suppress("Recycle") - package com.fankes.coloros.notify.hook.entity import android.app.WallpaperManager @@ -295,7 +293,7 @@ class SystemUIHooker : YukiBaseHooker() { statusBarIconViews.takeIf { it.isNotEmpty() }?.forEach { runInSafe { /** 得到通知实例 */ - val nf = nfField.of(it) ?: return@Thread + val nf = nfField.get(it).cast() ?: return@Thread /** 得到原始通知图标 */ val iconDrawable = nf.notification.smallIcon.loadDrawable(it.context) @@ -308,10 +306,10 @@ class SystemUIHooker : YukiBaseHooker() { drawable = iconDrawable ).also { pair -> /** 得到图标圆角 */ - val sRadius = sRadiusField.ofFloat(it) + val sRadius = sRadiusField.get(it).float() /** 得到缩放大小 */ - val sNfSize = sNfSizeField.ofInt(it) + val sNfSize = sNfSizeField.get(it).int() /** 在主线程设置图标 */ it.post { it.setImageDrawable(roundUtil.invoke(pair.first, sRadius, sNfSize, sNfSize, it.context)) } } @@ -343,7 +341,7 @@ class SystemUIHooker : YukiBaseHooker() { }.get(it.method { name = "getInstance" param(ContextClass) - }.get().invoke(context)).callBoolean(drawable) + }.get().invoke(context)).boolean(drawable) } /** @@ -537,7 +535,7 @@ class SystemUIHooker : YukiBaseHooker() { } beforeHook { /** 是否移除 */ - if (args().ofInt() == 7 && prefs.get(DataConst.REMOVE_CHANGECP_NOTIFY)) resultNull() + if (args().int() == 7 && prefs.get(DataConst.REMOVE_CHANGECP_NOTIFY)) resultNull() } } } @@ -573,7 +571,7 @@ class SystemUIHooker : YukiBaseHooker() { } afterHook { IconBuilderClass.clazz.field { name = "context" } - .of(field { name = "iconBuilder" }.of(instance))?.also { context -> + .get(field { name = "iconBuilder" }.get(instance).cast()).cast()?.also { context -> NotificationEntryClass.clazz.method { name = "getSbn" }.get(firstArgs).invoke()?.also { nf -> @@ -622,7 +620,7 @@ class SystemUIHooker : YukiBaseHooker() { method { name = "resolveHeaderViews" } afterHook { NotificationHeaderViewWrapperClass.clazz - .field { name = "mIcon" }.of(instance)?.apply { + .field { name = "mIcon" }.get(instance).cast()?.apply { ExpandableNotificationRowClass.clazz .method { name = "getEntry" } .get(NotificationViewWrapperClass.clazz.field { diff --git a/app/src/main/java/com/fankes/coloros/notify/utils/factory/FunctionFactory.kt b/app/src/main/java/com/fankes/coloros/notify/utils/factory/FunctionFactory.kt index d118d22..ebb360e 100644 --- a/app/src/main/java/com/fankes/coloros/notify/utils/factory/FunctionFactory.kt +++ b/app/src/main/java/com/fankes/coloros/notify/utils/factory/FunctionFactory.kt @@ -140,8 +140,8 @@ val colorOSFullVersion get() = "${if (isRealmeUI) "RealmeUI " else ""}$colorOSVe val colorOSVersion get() = safeOf(default = "无法获取") { (classOf(name = "com.oplus.os.OplusBuild").let { - it.field { name = "VERSIONS" }.ignoredError().of>() - ?.get(it.method { name = "getOplusOSVERSION" }.ignoredError().get().callInt() - 1) + it.field { name = "VERSIONS" }.ignoredError().get().array().takeIf { e -> e.isNotEmpty() } + ?.get(it.method { name = "getOplusOSVERSION" }.ignoredError().get().int() - 1) } ?: findPropString( key = "ro.system.build.fingerprint", default = "无法获取" ).split("ssi:")[1].split("/")[0].trim()) + " ${Build.DISPLAY}"