From ed59f12adedc7e0a03a33975d86ec7d0d33e469b Mon Sep 17 00:00:00 2001 From: HChenX Date: Thu, 6 Jun 2024 23:12:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E:=20=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E6=A1=86=E6=9E=B6-=E7=A6=81=E7=94=A8=E6=8C=81=E4=B9=85?= =?UTF-8?q?=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Phone/SystemFrameworkT.java | 4 +- .../systemframework/DisablePersistent.java | 44 +++++++++++++++++++ .../ui/fragment/SystemFrameworkFragment.java | 3 ++ app/src/main/res/values-zh-rCN/strings.xml | 4 ++ app/src/main/res/values/strings.xml | 6 ++- app/src/main/res/xml/framework.xml | 6 +++ gradle/libs.versions.toml | 2 +- 7 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemframework/DisablePersistent.java diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/app/SystemFramework/Phone/SystemFrameworkT.java b/app/src/main/java/com/sevtinge/hyperceiler/module/app/SystemFramework/Phone/SystemFrameworkT.java index 8e7601485e..05b403ee31 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/app/SystemFramework/Phone/SystemFrameworkT.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/app/SystemFramework/Phone/SystemFrameworkT.java @@ -36,6 +36,7 @@ import com.sevtinge.hyperceiler.module.hook.systemframework.DisableFreeformBlackList; import com.sevtinge.hyperceiler.module.hook.systemframework.DisableLowApiCheckForU; import com.sevtinge.hyperceiler.module.hook.systemframework.DisableMiuiLite; +import com.sevtinge.hyperceiler.module.hook.systemframework.DisablePersistent; import com.sevtinge.hyperceiler.module.hook.systemframework.DisablePinVerifyPer72h; import com.sevtinge.hyperceiler.module.hook.systemframework.DisableVerifyCanBeDisabled; import com.sevtinge.hyperceiler.module.hook.systemframework.FlagSecure; @@ -103,7 +104,7 @@ public void handleLoadPackage() { initHook(new VolumeSeparateControl(), mPrefsMap.getBoolean("system_framework_volume_separate_control")); initHook(new VolumeSteps(), mPrefsMap.getInt("system_framework_volume_steps", 0) > 0); initHook(new VolumeMediaSteps(), mPrefsMap.getBoolean("system_framework_volume_media_steps_enable")); - initHook(new VolumeDisableSafe(), mPrefsMap.getBoolean("system_framework_volume_disable_safe")); + initHook(new VolumeDisableSafe(), mPrefsMap.getStringAsInt("system_framework_volume_disable_safe_new", 0) != 0); // 其他 initHook(new SystemLockApp(), mPrefsMap.getBoolean("system_framework_guided_access")); @@ -168,6 +169,7 @@ public void handleLoadPackage() { initHook(new LinkTurboToast(), mPrefsMap.getBoolean("system_framework_disable_link_turbo_toast")); initHook(new DisableLowApiCheckForU(), mPrefsMap.getBoolean("system_framework_disable_low_api_check") && isMoreAndroidVersion(34)); + initHook(new DisablePersistent(), mPrefsMap.getBoolean("system_framework_disable_persistent") && isMoreAndroidVersion(34)); } } diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemframework/DisablePersistent.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemframework/DisablePersistent.java new file mode 100644 index 0000000000..72e7a8c50e --- /dev/null +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemframework/DisablePersistent.java @@ -0,0 +1,44 @@ +package com.sevtinge.hyperceiler.module.hook.systemframework; + +import com.hchen.hooktool.callback.IAction; +import com.hchen.hooktool.tool.ParamTool; +import com.sevtinge.hyperceiler.module.base.BaseTool; + +public class DisablePersistent extends BaseTool { + private boolean isInstall = false; + + @Override + public void doHook() { + hcHook.findClass("pl", "com.android.server.pm.parsing.pkg.PackageImpl") + .getMethod("isPersistent") + .hook(new IAction() { + @Override + public void after(ParamTool param) { + // String pkg = param.getField("packageName"); + boolean isPersistent = param.getResult(); + if (isPersistent) { + if (isInstall) { + param.setResult(false); + } + } + // logI(TAG, "pkg: " + pkg + " isPersistent: " + param.getResult()); + } + }) + .findClass("iph", "com.android.server.pm.InstallPackageHelper") + .getMethod("preparePackageLI", "com.android.server.pm.InstallRequest") + .hook(new IAction() { + @Override + public void before(ParamTool param) { + isInstall = true; + // logI(TAG, "start install: " + param.first()); + } + + @Override + public void after(ParamTool param) { + isInstall = false; + // logI(TAG, "end install: " + param.first()); + } + }) + ; + } +} diff --git a/app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/SystemFrameworkFragment.java b/app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/SystemFrameworkFragment.java index b0daa0024b..83de66706e 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/SystemFrameworkFragment.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/SystemFrameworkFragment.java @@ -33,6 +33,7 @@ public class SystemFrameworkFragment extends SettingsPreferenceFragment { SwitchPreference mShareUser; SwitchPreference mDisableIntegrity; SwitchPreference mDisableLowApiCheck; + SwitchPreference mDisablePersistent; Preference mNetwork; @Override @@ -47,12 +48,14 @@ public void initPrefs() { mShareUser = findPreference("prefs_key_system_framework_core_patch_shared_user"); mDisableIntegrity = findPreference("prefs_key_system_framework_core_patch_disable_integrity"); mDisableLowApiCheck = findPreference("prefs_key_system_framework_disable_low_api_check"); + mDisablePersistent = findPreference("prefs_key_system_framework_disable_persistent"); mNetwork = findPreference("prefs_key_system_framework_network"); mDisableIntegrity.setVisible(isMoreAndroidVersion(33) && !mCreak); mShareUser.setVisible(isMoreAndroidVersion(33)); // 暂时仅开放给 Android 13 及以上使用 mNetwork.setVisible(TelephonyManager.getDefault().isFiveGCapable()); mDisableLowApiCheck.setVisible(isMoreAndroidVersion(34)); + mDisablePersistent.setVisible(isMoreAndroidVersion(34)); mDisableCreak.setOnPreferenceChangeListener((preference, o) -> { if ((boolean) o) { diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 2a26264b53..5d9c8159d6 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -369,6 +369,8 @@ 音量即时调整 音量独立控制 移除高音量安全限制 + 对全部情况启用 + 仅连接耳机时启用 通知音量滑块 媒体音量阶数 可能会导致音量条的滚动卡顿或蓝牙音量异常 @@ -466,6 +468,8 @@ 可以解决一些应用内部的完整性校验,一般无需开启 禁用低 API 校验 允许安装 TargetSDK 低于 23 的应用 + 禁用持久检查 + 允许直接更新持久 APP ,比如直接更新系统界面 浏览器 解锁开发者选项 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d1b13682cd..ad2d32ba9a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -364,6 +364,8 @@ Instant volume adjustment Independent volume control Remove high volume safety restrictions + Enabled for all cases + Enabled only when headphones are connected Notification volume slider Media volume level It may cause the scrolling of the volume bar to freeze or the Bluetooth volume to be abnormal @@ -459,6 +461,8 @@ Pass some validation in the application Disable low API check Apps with APIs lower than 23 are allowed + Disable persistent checks + Allows you to update persistent apps directly, such as updating the system interface directly Browser Unlock developer options @@ -734,7 +738,7 @@ Status Bar Clock Notification Bar Big Clock Notification Bar Mini Clock - Status bar clock format + Status bar clock format Notification bar mini clock format Status bar clock arrangement Power related diff --git a/app/src/main/res/xml/framework.xml b/app/src/main/res/xml/framework.xml index a4dbd28bc8..e1b815a860 100644 --- a/app/src/main/res/xml/framework.xml +++ b/app/src/main/res/xml/framework.xml @@ -77,6 +77,12 @@ android:summary="@string/system_framework_disable_low_api_check_desc" android:title="@string/system_framework_disable_low_api_check" /> + + \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 569ff81413..e43745b771 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] agp = "8.4.1" -hooktool = "v.0.8.7" +hooktool = "v.0.8.9" kotlinAndroid = "2.0.0" lsparanoid = "0.6.0" #lspluginResopt = "1.6"