Skip to content

Commit

Permalink
[修复] 屏幕录制-解锁更多声音来源 失效的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
lingqiqi5211 committed Oct 30, 2023
1 parent 967911f commit f04fe0a
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit f04fe0a

Please sign in to comment.