Update YukiHookAPI

This commit is contained in:
2022-03-29 21:17:09 +08:00
parent f2e27c2702
commit d4f004894e
3 changed files with 15 additions and 17 deletions

View File

@@ -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'

View File

@@ -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<StatusBarNotification>(it) ?: return@Thread
val nf = nfField.get(it).cast<StatusBarNotification>() ?: 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<Context>(field { name = "iconBuilder" }.of(instance))?.also { context ->
.get(field { name = "iconBuilder" }.get(instance).cast()).cast<Context>()?.also { context ->
NotificationEntryClass.clazz.method {
name = "getSbn"
}.get(firstArgs).invoke<StatusBarNotification>()?.also { nf ->
@@ -622,7 +620,7 @@ class SystemUIHooker : YukiBaseHooker() {
method { name = "resolveHeaderViews" }
afterHook {
NotificationHeaderViewWrapperClass.clazz
.field { name = "mIcon" }.of<ImageView>(instance)?.apply {
.field { name = "mIcon" }.get(instance).cast<ImageView>()?.apply {
ExpandableNotificationRowClass.clazz
.method { name = "getEntry" }
.get(NotificationViewWrapperClass.clazz.field {

View File

@@ -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<Array<String>>()
?.get(it.method { name = "getOplusOSVERSION" }.ignoredError().get().callInt() - 1)
it.field { name = "VERSIONS" }.ignoredError().get().array<String>().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}"