Skip to content
This repository has been archived by the owner on Jan 2, 2025. It is now read-only.

Commit

Permalink
fix: VolumeDisableSafe to a15
Browse files Browse the repository at this point in the history
  • Loading branch information
lingqiqi5211 committed Jan 1, 2025
1 parent 334d5ba commit 7813f5e
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
*/
package com.sevtinge.hyperceiler.module.app;

import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.isMoreAndroidVersion;

import android.text.TextUtils;

import com.hchen.database.HookBase;
Expand All @@ -42,6 +40,6 @@ public void handleLoadPackage() {
initHook(UnlockPrivacyMarking.INSTANCE, mPrefsMap.getBoolean("screenshot_unlock_privacy_marking"));
// 超级剪切板
initHook(UnlockSuperClipboard.INSTANCE, mPrefsMap.getStringAsInt("various_super_clipboard_e", 0) != 0);
initHook(new FlagSecure(), mPrefsMap.getBoolean("system_other_flag_secure") && isMoreAndroidVersion(33));
initHook(new FlagSecure(), mPrefsMap.getBoolean("system_other_flag_secure"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ public void handleLoadPackage() {

// Other
initHook(new PackagePermissions(), true);
initHook(new RotationButton(), mPrefsMap.getStringAsInt("system_framework_other_rotation_button_int", 0) == 2);
initHook(new GlobalActions(), mLoadPackageParam.processName.equals("android"));
initHook(new ThermalBrightness(), mPrefsMap.getBoolean("system_framework_other_thermal_brightness"));
initHook(DisableCleaner.INSTANCE, mPrefsMap.getBoolean("system_framework_other_disable_cleaner"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ public void handleLoadPackage() {

// Other
initHook(new PackagePermissions(), true);
initHook(new RotationButton(), mPrefsMap.getStringAsInt("system_framework_other_rotation_button_int", 0) == 2);
initHook(new GlobalActions(), mLoadPackageParam.processName.equals("android"));
initHook(new ThermalBrightness(), mPrefsMap.getBoolean("system_framework_other_thermal_brightness"));
initHook(DisableCleaner.INSTANCE, mPrefsMap.getBoolean("system_framework_other_disable_cleaner"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ public void handleLoadPackage() {

// Other
initHook(new PackagePermissions(), true);
initHook(new RotationButton(), mPrefsMap.getStringAsInt("system_framework_other_rotation_button_int", 0) == 2);
initHook(new GlobalActions(), mLoadPackageParam.processName.equals("android"));
initHook(new ThermalBrightness(), mPrefsMap.getBoolean("system_framework_other_thermal_brightness"));
initHook(DisableCleaner.INSTANCE, mPrefsMap.getBoolean("system_framework_other_disable_cleaner"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ public void handleLoadPackage() {

// Other
initHook(new PackagePermissions(), true);
initHook(new RotationButton(), mPrefsMap.getStringAsInt("system_framework_other_rotation_button_int", 0) == 2);
initHook(new GlobalActions(), mLoadPackageParam.processName.equals("android"));
initHook(new ThermalBrightness(), mPrefsMap.getBoolean("system_framework_other_thermal_brightness"));
initHook(DisableCleaner.INSTANCE, mPrefsMap.getBoolean("system_framework_other_disable_cleaner"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,17 +145,15 @@ protected void before(MethodHookParam param) throws Throwable {
}

// Xiaomi HyperOS (U)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
try {
var windowManagerServiceImplClazz = XposedHelpers.findClass("com.android.server.wm.WindowManagerServiceImpl", lpparam.classLoader);
XposedHelpers.findAndHookMethod(
windowManagerServiceImplClazz,
"notAllowCaptureDisplay",
XposedHelpers.findClass("com.android.server.wm.RootWindowContainer", lpparam.classLoader), int.class,
XC_MethodReplacement.returnConstant(false));
} catch (Throwable t) {
logE(TAG, this.lpparam.packageName, "hook HyperOS failed", t);
}
try {
var windowManagerServiceImplClazz = XposedHelpers.findClass("com.android.server.wm.WindowManagerServiceImpl", lpparam.classLoader);
XposedHelpers.findAndHookMethod(
windowManagerServiceImplClazz,
"notAllowCaptureDisplay",
XposedHelpers.findClass("com.android.server.wm.RootWindowContainer", lpparam.classLoader), int.class,
XC_MethodReplacement.returnConstant(false));
} catch (Throwable t) {
logE(TAG, this.lpparam.packageName, "hook HyperOS failed", t);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,13 @@ public class VolumeDisableSafe extends BaseHook {
@Override
public void init() {
if (isMoreAndroidVersion(34)) {
String SoundDoseHelperStub = isMoreAndroidVersion(35) ?
"com.android.server.audio.SoundDoseHelperStub" :
"com.android.server.audio.SoundDoseHelperStubImpl";
Class<?> SoundDoseHelperStub;
Class<?> SoundDoseHelper = findClass("com.android.server.audio.SoundDoseHelper", lpparam.classLoader);
try {
SoundDoseHelperStub = findClass("com.android.server.audio.SoundDoseHelperStub", lpparam.classLoader);
} catch (Throwable t) {
SoundDoseHelperStub = findClass("com.android.server.audio.SoundDoseHelperStubImpl", lpparam.classLoader);
}

findAndHookMethod(SoundDoseHelperStub, "updateSafeMediaVolumeIndex", int.class, new MethodHook() {
@Override
Expand All @@ -52,7 +56,7 @@ protected void before(MethodHookParam param) throws Throwable {
}
});

findAndHookMethod("com.android.server.audio.SoundDoseHelper", "safeMediaVolumeIndex", int.class, new MethodHook() {
findAndHookMethod(SoundDoseHelper, "safeMediaVolumeIndex", int.class, new MethodHook() {
@Override
protected void before(MethodHookParam param) throws Throwable {
if (mode == 1) {
Expand All @@ -63,7 +67,7 @@ protected void before(MethodHookParam param) throws Throwable {
}
});

hookAllConstructors("com.android.server.audio.SoundDoseHelper", new MethodHook() {
hookAllConstructors(SoundDoseHelper, new MethodHook() {
@Override
protected void after(MethodHookParam param) throws Throwable {
if (mode == 1) {
Expand Down

0 comments on commit 7813f5e

Please sign in to comment.