Skip to content

Commit

Permalink
feat: framework - others - Allows to disable protected apps
Browse files Browse the repository at this point in the history
  • Loading branch information
Sevtinge committed Jun 12, 2024
1 parent 0af75f1 commit e9c1028
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.sevtinge.hyperceiler.module.base.HookExpand;
import com.sevtinge.hyperceiler.module.hook.GlobalActions;
import com.sevtinge.hyperceiler.module.hook.systemframework.AllowAutoStart;
import com.sevtinge.hyperceiler.module.hook.systemframework.AllowDisableProtectedPackage;
import com.sevtinge.hyperceiler.module.hook.systemframework.AllowUntrustedTouch;
import com.sevtinge.hyperceiler.module.hook.systemframework.AllowUntrustedTouchForU;
import com.sevtinge.hyperceiler.module.hook.systemframework.AppLinkVerify;
Expand Down Expand Up @@ -125,6 +126,7 @@ public void handleLoadPackage() {
initHook(new DisableMiuiLite(), mPrefsMap.getBoolean("system_framework_disablt_miuilite_check"));
initHook(new HookEntry(), mPrefsMap.getBoolean("system_framework_hook_entry"));
initHook(new PstedClipboard(), mPrefsMap.getBoolean("system_framework_posted_clipboard"));
initHook(new AllowDisableProtectedPackage(), mPrefsMap.getBoolean("system_framework_allow_disable_protected_package"));
// 允许应用后台读取剪切板
initHook(new ClipboardWhitelist(), mPrefsMap.getBoolean("system_framework_clipboard_whitelist"));

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.sevtinge.hyperceiler.module.hook.systemframework;

import com.sevtinge.hyperceiler.module.base.BaseHook;

import java.util.List;

public class AllowDisableProtectedPackage extends BaseHook {
@Override
public void init() throws NoSuchMethodException {
findAndHookMethod("com.android.server.pm.PackageManagerService", "setEnabledSettings", List.class, int.class, String.class, new MethodHook(){
@Override
protected void before(MethodHookParam param) throws Throwable {
findAndHookMethod("com.android.server.pm.ProtectedPackages", "isPackageStateProtected", int.class, String.class, new MethodHook(){
@Override
protected void before(MethodHookParam param) throws Throwable {
param.setResult(false);
}
});
}
});
}
}
1 change: 1 addition & 0 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@
<string name="system_framework_quick_screenshot_desc">禁用截图延迟</string>
<string name="system_framework_disable_link_turbo_toast">隐藏正在使用流量加速 Toast</string>
<string name="system_framework_allow_third_theme">允许使用第三方主题</string>
<string name="system_framework_allow_disable_protected_package">允许冻结受保护的应用</string>
<!--核心破解-->
<string name="system_framework_corepatch_title">包管理服务</string>
<string name="system_framework_core_patch_downgr">允许降级安装应用</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@
<string name="system_framework_quick_screenshot_desc">Disable screenshot delay</string>
<string name="system_framework_disable_link_turbo_toast">Hide LinkTurbo Toast</string>
<string name="system_framework_allow_third_theme">Allows to use third-party themes</string>
<string name="system_framework_allow_disable_protected_package">Allows to disable protected apps</string>
<!--Package Manager Service-->
<string name="system_framework_corepatch_title">Package Manager Service</string>
<string name="system_framework_core_patch_downgr">Allow downgrade</string>
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/xml/framework_other.xml
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@
android:title="@string/system_framework_clipboard_whitelist_list"
app:isPreferenceVisible="false" />

<SwitchPreference
android:defaultValue="false"
android:key="prefs_key_system_framework_allow_disable_protected_package"
android:title="@string/system_framework_allow_disable_protected_package" />

</PreferenceCategory>

<PreferenceCategory android:title="@string/system_framework_shortcut_title">
Expand Down

0 comments on commit e9c1028

Please sign in to comment.