From f04fe0a0f554756c7bbe46abdae3ce7fbc840114 Mon Sep 17 00:00:00 2001 From: mu7220 <80700814+mu7220@users.noreply.github.com> Date: Tue, 31 Oct 2023 00:11:20 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BF=AE=E5=A4=8D]=20=E5=B1=8F=E5=B9=95?= =?UTF-8?q?=E5=BD=95=E5=88=B6-=E8=A7=A3=E9=94=81=E6=9B=B4=E5=A4=9A?= =?UTF-8?q?=E5=A3=B0=E9=9F=B3=E6=9D=A5=E6=BA=90=20=E5=A4=B1=E6=95=88?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/app/ScreenRecorder.java | 4 +- .../screenrecorder/UnlockMoreVolumeFromNew.kt | 37 +++++++++++++++++++ .../hyperceiler/utils/devicesdk/SystemSDK.kt | 9 +++++ 3 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 app/src/main/java/com/sevtinge/hyperceiler/module/hook/screenrecorder/UnlockMoreVolumeFromNew.kt diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/app/ScreenRecorder.java b/app/src/main/java/com/sevtinge/hyperceiler/module/app/ScreenRecorder.java index d7f59034f2..9596bab416 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/app/ScreenRecorder.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/app/ScreenRecorder.java @@ -6,7 +6,7 @@ import com.sevtinge.hyperceiler.module.hook.screenrecorder.ForceSupportPlaybackCapture; import com.sevtinge.hyperceiler.module.hook.screenrecorder.SaveToMovies; import com.sevtinge.hyperceiler.module.hook.screenrecorder.ScreenRecorderConfig; -import com.sevtinge.hyperceiler.module.hook.screenrecorder.UnlockMoreVolumeFrom; +import com.sevtinge.hyperceiler.module.hook.screenrecorder.UnlockMoreVolumeFromNew; public class ScreenRecorder extends BaseModule { @@ -15,7 +15,7 @@ public void handleLoadPackage() { // dexKit load initHook(LoadHostDir.INSTANCE); initHook(new ForceSupportPlaybackCapture(), mPrefsMap.getBoolean("screenrecorder_force_support_playback_capture")); - initHook(new UnlockMoreVolumeFrom(), mPrefsMap.getBoolean("screenrecorder_more_volume")); + initHook(UnlockMoreVolumeFromNew.INSTANCE, mPrefsMap.getBoolean("screenrecorder_more_volume")); initHook(ScreenRecorderConfig.INSTANCE, mPrefsMap.getBoolean("screenrecorder_config")); initHook(SaveToMovies.INSTANCE, mPrefsMap.getBoolean("screenrecorder_save_to_movies")); // dexKit finish diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/screenrecorder/UnlockMoreVolumeFromNew.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/screenrecorder/UnlockMoreVolumeFromNew.kt new file mode 100644 index 0000000000..c737d415e7 --- /dev/null +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/screenrecorder/UnlockMoreVolumeFromNew.kt @@ -0,0 +1,37 @@ +package com.sevtinge.hyperceiler.module.hook.screenrecorder + +import com.github.kyuubiran.ezxhelper.EzXHelper +import com.sevtinge.hyperceiler.module.base.BaseHook +import com.sevtinge.hyperceiler.utils.DexKit.addUsingStringsEquals +import com.sevtinge.hyperceiler.utils.DexKit.dexKitBridge +import com.sevtinge.hyperceiler.utils.log.XposedLogUtils +import de.robv.android.xposed.XposedHelpers +import java.lang.reflect.Modifier + +object UnlockMoreVolumeFromNew : BaseHook() { + private val getClass by lazy { + dexKitBridge.findClass { + matcher { + addUsingStringsEquals("ro.vendor.audio.screenrecorder.bothrecor") + } + }.map { it.getInstance(EzXHelper.classLoader) }.first() + } + + private val getObject by lazy { + dexKitBridge.findField { + matcher { + declaredClass { getClass } + modifiers = Modifier.PRIVATE + type = "boolean" + } + }.map { it.getFieldInstance(EzXHelper.classLoader) }.toList() + } + + override fun init() { + XposedLogUtils.logI("hook class $getClass") + for (i in getObject) { + XposedHelpers.setStaticBooleanField(getClass, i.name, true) + logD("hook ${i.name} true") + } + } +} diff --git a/app/src/main/java/com/sevtinge/hyperceiler/utils/devicesdk/SystemSDK.kt b/app/src/main/java/com/sevtinge/hyperceiler/utils/devicesdk/SystemSDK.kt index 9f57e2aff3..786d98a877 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/utils/devicesdk/SystemSDK.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/utils/devicesdk/SystemSDK.kt @@ -32,3 +32,12 @@ fun getMiuiVersion(): Float = when (getProp("ro.miui.ui.version.name")) { fun isMoreMiuiVersion(version: Float): Boolean { return getMiuiVersion() >= version } + +fun getHyperOSVersion(): Float = when (getProp("ro.mi.os.version.name")) { + "OS1.0" -> 1f + else -> 0f +} + +fun isMoreHyperOSVersion(version: Float): Boolean { + return getHyperOSVersion() >= version +}