diff --git a/app/src/main/java/com/sevtinge/hyperceiler/XposedInit.java b/app/src/main/java/com/sevtinge/hyperceiler/XposedInit.java index 71068fac26..9c14536bec 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/XposedInit.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/XposedInit.java @@ -21,9 +21,6 @@ import com.github.kyuubiran.ezxhelper.EzXHelper; import com.sevtinge.hyperceiler.module.app.SystemFrameworkForCorePatch; import com.sevtinge.hyperceiler.module.base.BaseXposedInit; -import com.sevtinge.hyperceiler.module.hook.home.other.AllowShareApk; -import com.sevtinge.hyperceiler.module.hook.home.title.EnableIconMonetColor; -import com.sevtinge.hyperceiler.module.hook.securitycenter.SidebarLineCustom; import com.sevtinge.hyperceiler.module.hook.systemframework.AllowManageAllNotifications; import com.sevtinge.hyperceiler.module.hook.systemframework.AllowUninstall; import com.sevtinge.hyperceiler.module.hook.systemframework.BackgroundBlurDrawable; @@ -31,12 +28,9 @@ import com.sevtinge.hyperceiler.module.hook.systemframework.CleanShareMenu; import com.sevtinge.hyperceiler.module.hook.systemframework.ScreenRotation; import com.sevtinge.hyperceiler.module.hook.systemsettings.VolumeSeparateControlForSettings; -import com.sevtinge.hyperceiler.module.hook.tsmclient.AutoNfc; -import de.robv.android.xposed.IXposedHookInitPackageResources; import de.robv.android.xposed.IXposedHookLoadPackage; import de.robv.android.xposed.IXposedHookZygoteInit; -import de.robv.android.xposed.callbacks.XC_InitPackageResources; import de.robv.android.xposed.callbacks.XC_LoadPackage; public class XposedInit extends BaseXposedInit implements IXposedHookZygoteInit, IXposedHookLoadPackage { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/app/SystemFramework.java b/app/src/main/java/com/sevtinge/hyperceiler/module/app/SystemFramework.java index f3563c50ba..1908f45509 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/app/SystemFramework.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/app/SystemFramework.java @@ -26,6 +26,7 @@ import com.sevtinge.hyperceiler.module.hook.systemframework.AllowUntrustedTouch; import com.sevtinge.hyperceiler.module.hook.systemframework.AllowUntrustedTouchForU; import com.sevtinge.hyperceiler.module.hook.systemframework.AppLinkVerify; +import com.sevtinge.hyperceiler.module.hook.systemframework.BackgroundBlur; import com.sevtinge.hyperceiler.module.hook.systemframework.CleanOpenMenu; import com.sevtinge.hyperceiler.module.hook.systemframework.CleanShareMenu; import com.sevtinge.hyperceiler.module.hook.systemframework.ClipboardWhitelist; @@ -125,6 +126,7 @@ public void handleLoadPackage() { initHook(new ClipboardWhitelist(), mPrefsMap.getBoolean("system_framework_clipboard_whitelist")); // 显示 + initHook(new BackgroundBlur(), mPrefsMap.getBoolean("system_framework_background_blur_supported")); initHook(DisplayCutout.INSTANCE, mPrefsMap.getBoolean("system_ui_display_hide_cutout_enable")); initHook(UseAOSPScreenShot.INSTANCE, mPrefsMap.getBoolean("system_ui_display_use_aosp_screenshot_enable")); initHook(new ToastTime(), mPrefsMap.getBoolean("system_ui_display_toast_times_enable")); diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemframework/BackgroundBlur.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemframework/BackgroundBlur.java new file mode 100644 index 0000000000..8158277042 --- /dev/null +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemframework/BackgroundBlur.java @@ -0,0 +1,88 @@ +package com.sevtinge.hyperceiler.module.hook.systemframework; + +import com.sevtinge.hyperceiler.module.base.BaseHook; + +import java.lang.reflect.Method; + +import de.robv.android.xposed.XC_MethodHook; +import de.robv.android.xposed.XposedBridge; +import de.robv.android.xposed.XposedHelpers; + +public class BackgroundBlur extends BaseHook { + private final static String TAG = "MYBackgroundBlur"; + private final static String mode = "persist.sys.background_blur_mode"; + private final static String supported = "persist.sys.background_blur_supported"; + private final static String version = "persist.sys.background_blur_version"; + private Class SystemProperties = null; + private boolean done = false; + + @Override + public void init() throws NoSuchMethodException { + SystemProperties = findClassIfExists("android.os.SystemProperties"); + if (SystemProperties == null) return; + Method[] methods = SystemProperties.getDeclaredMethods(); + for (Method method : methods) { + switch (method.getName()) { + case "get", "getInt", "getBoolean" -> { + hookProp(method); + } + } + } + } + + XC_MethodHook xcMethodHook = new XC_MethodHook() { + @Override + protected void afterHookedMethod(MethodHookParam param) { + if (done) return; + Object def = null; + Object result = param.getResult(); + String key = (String) param.args[0]; + if (param.args.length > 1) { + def = param.args[1]; + } + Object get = isBlurProp(key); + // logE(TAG, "key: " + key + " def: " + def + " result: " + result + " get: " + get); + if (get != null) { + if ("get".equals(param.method.getName())) { + param.setResult(String.valueOf(get)); + } else param.setResult(get); + } + if (supported.equals(key)) { + try { + XposedHelpers.callStaticMethod(SystemProperties, "set", supported, String.valueOf(true)); + XposedHelpers.callStaticMethod(SystemProperties, "set", mode, String.valueOf(0)); + XposedHelpers.callStaticMethod(SystemProperties, "set", version, String.valueOf(2)); + done = true; + // logE(TAG, "key: " + key + " set: " + String.valueOf(get)); + } catch (Throwable e) { + done = false; + // logE(TAG, "key: " + key + " e: " + e); + } + } + } + }; + + private void hookProp(Method method) { + XposedBridge.hookMethod(method, xcMethodHook); + } + + private Object isBlurProp(String key) { + switch (key) { + case supported -> { + return true; + } + case mode -> { + return 0; + } + case version -> { + return 2; + } + // case "persist.sys.background_blur_status_default" -> { + // return false; + // } + default -> { + return null; + } + } + } +} diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 9668b165a5..4d3801bc9a 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -426,6 +426,8 @@ 禁用每 72 小时验证锁屏密码 禁用是否允许禁用 APP 校验 允许所有 APP 使用深色模式 + 强开高级材质 + 开启此功能后请在系统设置中控制高级材质开关 禁用 MIUI Lite 检查 允许管理所有通知 秒截图 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 93b7fa62b1..83a055830d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -422,6 +422,8 @@ Disable lock screen verify when per 72 hours Disable to verify can be disabled Allow all apps to use dark mode + Strong open high-grade material + When this feature is turned on, control the Advanced Materials switch in the system settings Disable MIUI Lite Check Allow to manage all notifications Quick screenshot diff --git a/app/src/main/res/xml/framework_display.xml b/app/src/main/res/xml/framework_display.xml index 091e136e86..35da1d5271 100644 --- a/app/src/main/res/xml/framework_display.xml +++ b/app/src/main/res/xml/framework_display.xml @@ -3,6 +3,12 @@ xmlns:app="http://schemas.android.com/apk/res-auto" app:myLocation="@string/system_framework_display_title"> + +