Skip to content

Commit 2d1c329

Browse files
authored
Fix Something on HyperOS 3 (#1380)
* fix: CorePatch on Android 16 * fix: DisableMrm on newer versions
1 parent b5f9f29 commit 2d1c329

5 files changed

Lines changed: 69 additions & 20 deletions

File tree

library/hook/src/main/java/com/sevtinge/hyperceiler/hook/module/app/SystemFramework/Pad/SystemFrameworkB.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import com.sevtinge.hyperceiler.hook.module.base.BaseModule;
2525
import com.sevtinge.hyperceiler.hook.module.hook.systemframework.AllowManageAllNotifications;
2626
import com.sevtinge.hyperceiler.hook.module.hook.systemframework.AutoEffectSwitchForSystem;
27-
import com.sevtinge.hyperceiler.hook.module.hook.systemframework.DisableLowApiCheckForU;
27+
import com.sevtinge.hyperceiler.hook.module.hook.systemframework.DisableLowApiCheckForB;
2828
import com.sevtinge.hyperceiler.hook.module.hook.systemframework.DisableMiuiWatermark;
2929
import com.sevtinge.hyperceiler.hook.module.hook.systemframework.DisablePersistent;
3030
import com.sevtinge.hyperceiler.hook.module.hook.systemframework.DisableThermal;
@@ -46,7 +46,7 @@ public void handleLoadPackage() {
4646
initHook(BypassSignCheckForT.INSTANCE, mPrefsMap.getBoolean("system_framework_core_patch_auth_creak") || mPrefsMap.getBoolean("system_framework_core_patch_disable_integrity"));
4747
initHook(new BypassIsolationViolation(), mPrefsMap.getBoolean("system_framework_core_patch_bypass_isolation_violation"));
4848
initHook(new AllowUpdateSystemApp(), mPrefsMap.getBoolean("system_framework_core_patch_allow_update_system_app"));
49-
initHook(new DisableLowApiCheckForU(), mPrefsMap.getBoolean("system_framework_disable_low_api_check"));
49+
initHook(new DisableLowApiCheckForB(), mPrefsMap.getBoolean("system_framework_disable_low_api_check"));
5050
initHook(new DisablePersistent(), mPrefsMap.getBoolean("system_framework_disable_persistent"));
5151

5252
// 显示

library/hook/src/main/java/com/sevtinge/hyperceiler/hook/module/app/SystemFramework/Phone/SystemFrameworkB.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import com.sevtinge.hyperceiler.hook.module.base.BaseModule;
2525
import com.sevtinge.hyperceiler.hook.module.hook.systemframework.AllowManageAllNotifications;
2626
import com.sevtinge.hyperceiler.hook.module.hook.systemframework.AutoEffectSwitchForSystem;
27-
import com.sevtinge.hyperceiler.hook.module.hook.systemframework.DisableLowApiCheckForU;
27+
import com.sevtinge.hyperceiler.hook.module.hook.systemframework.DisableLowApiCheckForB;
2828
import com.sevtinge.hyperceiler.hook.module.hook.systemframework.DisableMiuiWatermark;
2929
import com.sevtinge.hyperceiler.hook.module.hook.systemframework.DisablePersistent;
3030
import com.sevtinge.hyperceiler.hook.module.hook.systemframework.DisableThermal;
@@ -45,7 +45,7 @@ public void handleLoadPackage() {
4545
initHook(BypassSignCheckForT.INSTANCE, mPrefsMap.getBoolean("system_framework_core_patch_auth_creak") || mPrefsMap.getBoolean("system_framework_core_patch_disable_integrity"));
4646
initHook(new BypassIsolationViolation(), mPrefsMap.getBoolean("system_framework_core_patch_bypass_isolation_violation"));
4747
initHook(new AllowUpdateSystemApp(), mPrefsMap.getBoolean("system_framework_core_patch_allow_update_system_app"));
48-
initHook(new DisableLowApiCheckForU(), mPrefsMap.getBoolean("system_framework_disable_low_api_check"));
48+
initHook(new DisableLowApiCheckForB(), mPrefsMap.getBoolean("system_framework_disable_low_api_check"));
4949
initHook(new DisablePersistent(), mPrefsMap.getBoolean("system_framework_disable_persistent"));
5050

5151
// 显示
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* This file is part of HyperCeiler.
3+
4+
* HyperCeiler is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU Affero General Public License as
6+
* published by the Free Software Foundation, either version 3 of the
7+
* License.
8+
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Affero General Public License for more details.
13+
14+
* You should have received a copy of the GNU Affero General Public License
15+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
17+
* Copyright (C) 2023-2025 HyperCeiler Contributions
18+
*/
19+
package com.sevtinge.hyperceiler.hook.module.hook.systemframework;
20+
21+
import com.sevtinge.hyperceiler.hook.module.base.BaseHook;
22+
23+
import de.robv.android.xposed.XposedHelpers;
24+
25+
public class DisableLowApiCheckForB extends BaseHook {
26+
@Override
27+
public void init() throws NoSuchMethodException {
28+
findAndHookMethod("com.android.server.pm.InstallPackageHelper", "preparePackage", "com.android.server.pm.InstallRequest", new MethodHook(){
29+
@Override
30+
protected void before(MethodHookParam param) throws Throwable {
31+
Object mInstallArgs = XposedHelpers.getObjectField(param.args[0], "mInstallArgs");
32+
if (mInstallArgs == null) return;
33+
XposedHelpers.setIntField(mInstallArgs, "mInstallFlags", XposedHelpers.getIntField(mInstallArgs, "mInstallFlags") | 0x01000000);
34+
}
35+
});
36+
}
37+
}

library/hook/src/main/java/com/sevtinge/hyperceiler/hook/module/hook/systemframework/DisablePersistent.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ protected void after(MethodHookParam param) throws Throwable {
4646
logE(TAG, lpparam.packageName, "Not found class: " + packageName);
4747
}
4848

49-
findAndHookMethod("com.android.server.pm.InstallPackageHelper", "preparePackageLI", "com.android.server.pm.InstallRequest", new MethodHook() {
49+
findAndHookMethod("com.android.server.pm.InstallPackageHelper", isMoreAndroidVersion(36) ?
50+
"preparePackage" : "preparePackageLI", "com.android.server.pm.InstallRequest", new MethodHook() {
5051
@Override
5152
protected void before(MethodHookParam param) throws Throwable {
5253
isInstall = true;

library/hook/src/main/java/com/sevtinge/hyperceiler/hook/module/hook/trustservice/DisableMrm.java

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,40 @@
11
/*
2-
* This file is part of HyperCeiler.
2+
* This file is part of HyperCeiler.
33
4-
* HyperCeiler is free software: you can redistribute it and/or modify
5-
* it under the terms of the GNU Affero General Public License as
6-
* published by the Free Software Foundation, either version 3 of the
7-
* License.
4+
* HyperCeiler is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU Affero General Public License as
6+
* published by the Free Software Foundation, either version 3 of the
7+
* License.
88
9-
* This program is distributed in the hope that it will be useful,
10-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12-
* GNU Affero General Public License for more details.
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Affero General Public License for more details.
1313
14-
* You should have received a copy of the GNU Affero General Public License
15-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
14+
* You should have received a copy of the GNU Affero General Public License
15+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
1616
17-
* Copyright (C) 2023-2025 HyperCeiler Contributions
18-
*/
17+
* Copyright (C) 2023-2025 HyperCeiler Contributions
18+
*/
1919
package com.sevtinge.hyperceiler.hook.module.hook.trustservice;
2020

2121
import com.sevtinge.hyperceiler.hook.module.base.BaseHook;
22+
import com.sevtinge.hyperceiler.hook.module.base.dexkit.DexKit;
23+
24+
import org.luckypray.dexkit.query.FindMethod;
25+
import org.luckypray.dexkit.query.matchers.MethodMatcher;
26+
27+
import java.lang.reflect.Method;
2228

2329
public class DisableMrm extends BaseHook {
2430
@Override
25-
public void init() throws NoSuchMethodException {
26-
findAndHookMethod("com.xiaomi.trustservice.remoteservice.eventhandle.statusEventHandle", "initIMrmService" ,new MethodHook(){
31+
public void init() {
32+
Method method1 = DexKit.findMember("Method1", bridge -> bridge.findMethod(FindMethod.create()
33+
.matcher(MethodMatcher.create()
34+
.usingStrings("MiTrustService/statusEventHandle", "try init mrmd Service")
35+
.returnType(boolean.class)
36+
)).singleOrNull());
37+
if (method1 != null) hookMethod(method1, new MethodHook() {
2738
@Override
2839
protected void before(MethodHookParam param) throws Throwable {
2940
param.setResult(false);

0 commit comments

Comments
 (0)