Skip to content

Commit 1eba1ab

Browse files
uarixSevtinge
andauthored
feat: 软件包管理添加绕过云控功能 (#1521)
* feat: 软件包管理添加绕过云控功能 * invokeOriginalMethod --------- Co-authored-by: 绀漓丨Sevtinge <89193494+Sevtinge@users.noreply.github.com>
1 parent 84957d5 commit 1eba1ab

File tree

6 files changed

+90
-0
lines changed

6 files changed

+90
-0
lines changed

library/core/src/main/res/values-zh-rCN/strings_app.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1297,6 +1297,8 @@
12971297
<string name="miui_package_installer_modify">净化页面</string>
12981298
<string name="miui_package_installer_disable_ad">禁用推广</string>
12991299
<string name="miui_package_installer_install_risk">禁用风险检测</string>
1300+
<string name="miui_package_installer_disable_cloud_check">阻断云端配置下发</string>
1301+
<string name="miui_package_installer_disable_cloud_check_desc">拦截应用安装时的云端配置请求并伪造空响应,可提升加载速度并绕过断网环境下的安装限制和弹窗</string>
13001302
<string name="miui_package_installer_safe_model_tip">禁用安全守护提示</string>
13011303
<string name="miui_package_installer_count_checking">禁用频繁安装应用检查</string>
13021304
<string name="miui_package_installer_update_system_app">解除系统应用安装限制</string>

library/core/src/main/res/values-zh-rTW/strings_app.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,6 +1232,8 @@
12321232
<string name="miui_package_installer_modify">淨化頁面</string>
12331233
<string name="miui_package_installer_disable_ad">停用推廣</string>
12341234
<string name="miui_package_installer_install_risk">停用風險檢測</string>
1235+
<string name="miui_package_installer_disable_cloud_check">阻斷雲端設定下發</string>
1236+
<string name="miui_package_installer_disable_cloud_check_desc">攔截應用程式安裝時的雲端設定請求並偽造空回應,可提升載入速度並繞過斷網環境下的安裝限制與彈跳視窗</string>
12351237
<string name="miui_package_installer_safe_model_tip">停用安全守護提示</string>
12361238
<string name="miui_package_installer_count_checking">停用頻繁安裝應用程式檢查</string>
12371239
<string name="miui_package_installer_update_system_app">解除系統應用程式安裝限制</string>

library/core/src/main/res/values/strings_app.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,6 +1360,8 @@
13601360
<string name="miui_package_installer_modify">Clean page</string>
13611361
<string name="miui_package_installer_disable_ad">Disable ads</string>
13621362
<string name="miui_package_installer_install_risk">Disable risk detection</string>
1363+
<string name="miui_package_installer_disable_cloud_check">Block cloud config fetch</string>
1364+
<string name="miui_package_installer_disable_cloud_check_desc">Intercepts cloud configuration requests during app installation and spoofs an empty response. This improves loading speed and bypasses offline installation restrictions</string>
13631365
<string name="miui_package_installer_safe_model_tip">Disable the security guard prompt</string>
13641366
<string name="miui_package_installer_count_checking">Disable frequently installed app check</string>
13651367
<string name="miui_package_installer_update_system_app">Remove system app installation restrictions</string>

library/core/src/main/res/xml/package_installer.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@
3737
android:title="@string/miui_package_installer_install_risk"
3838
android:defaultValue="false" />
3939

40+
<SwitchPreference
41+
android:key="prefs_key_miui_package_installer_disable_cloud_check"
42+
android:title="@string/miui_package_installer_disable_cloud_check"
43+
android:summary="@string/miui_package_installer_disable_cloud_check_desc"
44+
android:defaultValue="false" />
45+
4046
<SwitchPreference
4147
android:key="prefs_key_miui_package_installer_safe_model_tip"
4248
android:title="@string/miui_package_installer_safe_model_tip"

library/libhook/src/main/java/com/sevtinge/hyperceiler/libhook/app/PackageInstaller.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import com.sevtinge.hyperceiler.libhook.rules.packageinstaller.DisplayMoreApkInfoNew;
3333
import com.sevtinge.hyperceiler.libhook.rules.packageinstaller.InstallRiskDisable;
3434
import com.sevtinge.hyperceiler.libhook.rules.packageinstaller.InstallSource;
35+
import com.sevtinge.hyperceiler.libhook.rules.packageinstaller.DisableCloudCheck;
3536

3637
@HookBase(targetPackage = "com.miui.packageinstaller")
3738
public class PackageInstaller extends BaseLoad {
@@ -51,6 +52,9 @@ public void onPackageLoaded() {
5152
// 禁用风险检测
5253
initHook(InstallRiskDisable.INSTANCE, PrefsBridge.getBoolean("miui_package_installer_install_risk"));
5354

55+
// 阻断云端配置下发
56+
initHook(DisableCloudCheck.INSTANCE, PrefsBridge.getBoolean("miui_package_installer_disable_cloud_check"));
57+
5458
// 禁用安全守护提示
5559
initHook(DisableSafeModelTip.INSTANCE, PrefsBridge.getBoolean("miui_package_installer_safe_model_tip"));
5660

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
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-2026 HyperCeiler Contributions
18+
*/
19+
package com.sevtinge.hyperceiler.libhook.rules.packageinstaller
20+
21+
import android.content.Context
22+
import com.sevtinge.hyperceiler.libhook.base.BaseHook
23+
import com.sevtinge.hyperceiler.libhook.utils.hookapi.dexkit.DexKit
24+
import com.sevtinge.hyperceiler.libhook.utils.hookapi.tool.EzxHelpUtils.invokeOriginalMethod
25+
import io.github.kyuubiran.ezxhelper.xposed.dsl.HookFactory.`-Static`.createHook
26+
import java.lang.reflect.Method
27+
28+
object DisableCloudCheck : BaseHook() {
29+
override fun init() {
30+
// 签名对应:public final java.lang.Object c(Context, g, int, ApkInfo, HashMap, Continuation)
31+
val methods = DexKit.findMemberList<Method>("DisableCloudCheck_Fetch") {
32+
it.findMethod {
33+
matcher {
34+
paramCount = 6
35+
paramTypes(
36+
Context::class.java.name,
37+
"",
38+
Int::class.javaPrimitiveType?.name ?: "int",
39+
"com.miui.packageInstaller.model.ApkInfo",
40+
HashMap::class.java.name,
41+
"kotlin.coroutines.Continuation"
42+
)
43+
returnType = Any::class.java.name
44+
}
45+
}
46+
}
47+
48+
methods.forEach { method ->
49+
try {
50+
method.createHook {
51+
replace { param ->
52+
try {
53+
val cloudParamsClass = findClass("com.miui.packageInstaller.model.CloudParams")
54+
val cloudParamsInstance = cloudParamsClass.newInstance()
55+
56+
val successClass = findClass("com.miui.packageInstaller.model.CloudResult\$Success")
57+
val successConstructor = successClass.getDeclaredConstructor(cloudParamsClass)
58+
59+
successConstructor.newInstance(cloudParamsInstance)
60+
} catch (e: Exception) {
61+
invokeOriginalMethod(
62+
param.executable as Method,
63+
param.thisObject,
64+
param.args
65+
)
66+
}
67+
}
68+
}
69+
} catch (e: Exception) {
70+
// ignore
71+
}
72+
}
73+
}
74+
}

0 commit comments

Comments
 (0)