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 +}