diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/app/SystemUI/Phone/SystemUiV.java b/app/src/main/java/com/sevtinge/hyperceiler/module/app/SystemUI/Phone/SystemUiV.java index 3afb35ec9..b785bb81b 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/app/SystemUI/Phone/SystemUiV.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/app/SystemUI/Phone/SystemUiV.java @@ -98,6 +98,7 @@ import com.sevtinge.hyperceiler.module.hook.systemui.navigation.RotationButton; import com.sevtinge.hyperceiler.module.hook.systemui.plugin.FocusNotifLyricPluginHelper; import com.sevtinge.hyperceiler.module.hook.systemui.plugin.NewPluginHelper; +import com.sevtinge.hyperceiler.module.hook.systemui.plugin.NewPluginHelperKt; import com.sevtinge.hyperceiler.module.hook.systemui.statusbar.BlurEnable; import com.sevtinge.hyperceiler.module.hook.systemui.statusbar.DoubleTapToSleep; import com.sevtinge.hyperceiler.module.hook.systemui.statusbar.HideStatusBarBeforeScreenshot; @@ -133,8 +134,9 @@ public class SystemUiV extends BaseModule { @Override public void handleLoadPackage() { // PluginHelper - initHook(new NewPluginHelper()); - initHook(FocusNotifLyricPluginHelper.INSTANCE, mPrefsMap.getBoolean("system_ui_statusbar_music_switch")); + initHook(NewPluginHelperKt.INSTANCE); + /*initHook(new NewPluginHelper()); + initHook(FocusNotifLyricPluginHelper.INSTANCE, mPrefsMap.getBoolean("system_ui_statusbar_music_switch"));*/ // initHook(Island.INSTANCE, true); // 灵动岛 // 小窗 diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemui/controlcenter/CCGridForHyperOS.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemui/controlcenter/CCGridForHyperOS.java new file mode 100644 index 000000000..d88448e70 --- /dev/null +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemui/controlcenter/CCGridForHyperOS.java @@ -0,0 +1,135 @@ +/* + * This file is part of HyperCeiler. + + * HyperCeiler is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + + * Copyright (C) 2023-2024 HyperCeiler Contributions + */ +package com.sevtinge.hyperceiler.module.hook.systemui.controlcenter; + +import static com.sevtinge.hyperceiler.utils.prefs.PrefsUtils.mPrefsMap; + +import android.content.Context; +import android.graphics.drawable.Drawable; +import android.graphics.drawable.GradientDrawable; +import android.view.View; + +import com.sevtinge.hyperceiler.module.base.tool.HookTool; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +import de.robv.android.xposed.XC_MethodHook; +import de.robv.android.xposed.XposedHelpers; + +public class CCGridForHyperOS { + private static final float radius = (float) mPrefsMap.getInt("system_ui_control_center_rounded_rect_radius", 72); + + private static Drawable warningD = null; + private static Drawable enabledD = null; + private static Drawable restrictedD = null; + private static Drawable disabledD = null; + private static Drawable unavailableD = null; + private static int configuration = 0; + private static int orientation; + + public static void initCCGridForHyperOS(ClassLoader classLoader) { + Class clazz = XposedHelpers.findClass("miui.systemui.controlcenter.qs.tileview.QSTileItemIconView", classLoader); + XposedHelpers.findAndHookMethod(clazz, "getCornerRadius", + new HookTool.MethodHook() { + @Override + protected void before(XC_MethodHook.MethodHookParam param) { + param.setResult((float) mPrefsMap.getInt("system_ui_control_center_rounded_rect_radius", 72)); + } + } + ); + XposedHelpers.findAndHookMethod("miui.systemui.controlcenter.qs.tileview.QSTileItemIconView", classLoader, "updateIcon", + "com.android.systemui.plugins.qs.QSTile$State", boolean.class, boolean.class, + new HookTool.MethodHook() { + @Override + protected void before(MethodHookParam param) { + XposedHelpers.callMethod(param.thisObject, "updateResources"); + } + } + ); + + XposedHelpers.findAndHookMethod("miui.systemui.controlcenter.qs.tileview.QSTileItemIconView", classLoader, + "updateResources", + new HookTool.MethodHook() { + @Override + protected void before(MethodHookParam param) { + orientation = ((View) param.thisObject).getContext().getResources().getConfiguration().orientation; + + StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace(); + Set targetMethods = new HashSet<>(Arrays.asList( + "miui.systemui.controlcenter.qs.tileview.QSTileItemView.updateState", + "miui.systemui.controlcenter.panel.main.recyclerview.MainPanelItemViewHolder.onSuperSaveModeChanged", + "miui.systemui.controlcenter.qs.tileview.QSTileItemView.updateCustomizeState", + "miui.systemui.controlcenter.qs.tileview.QSTileItemView.onModeChanged" + )); + + boolean isMethodFound = Arrays.stream(stackTrace) + .anyMatch(element -> targetMethods.contains(element.getClassName() + "." + element.getMethodName())); + + if (configuration == orientation && isMethodFound) return; + + Context pluginContext = (Context) XposedHelpers.getObjectField(param.thisObject, "pluginContext"); + int warning = pluginContext.getResources().getIdentifier("qs_background_warning", "drawable", "miui.systemui.plugin"); + int enabled = pluginContext.getResources().getIdentifier("qs_background_enabled", "drawable", "miui.systemui.plugin"); + int restricted = pluginContext.getResources().getIdentifier("qs_background_restricted", "drawable", "miui.systemui.plugin"); + int disabled = pluginContext.getResources().getIdentifier("qs_background_disabled", "drawable", "miui.systemui.plugin"); + int unavailable = pluginContext.getResources().getIdentifier("qs_background_unavailable", "drawable", "miui.systemui.plugin"); + warningD = pluginContext.getTheme().getDrawable(warning); + enabledD = pluginContext.getTheme().getDrawable(enabled); + restrictedD = pluginContext.getTheme().getDrawable(restricted); + disabledD = pluginContext.getTheme().getDrawable(disabled); + unavailableD = pluginContext.getTheme().getDrawable(unavailable); + if (warningD != null) { + GradientDrawable warningG = (GradientDrawable) warningD; + warningG.setCornerRadius(radius); + } + if (enabledD != null) { + GradientDrawable enabledG = (GradientDrawable) enabledD; + enabledG.setCornerRadius(radius); + } + if (restrictedD != null) { + GradientDrawable restrictedG = (GradientDrawable) restrictedD; + restrictedG.setCornerRadius(radius); + } + if (disabledD != null) { + GradientDrawable disabledG = (GradientDrawable) disabledD; + disabledG.setCornerRadius(radius); + } + if (unavailableD != null) { + GradientDrawable unavailableG = (GradientDrawable) unavailableD; + unavailableG.setCornerRadius(radius); + } + + configuration = orientation; + } + } + ); + + XposedHelpers.findAndHookMethod("miui.systemui.controlcenter.qs.tileview.QSTileItemIconView", classLoader, + "setCornerRadius", float.class, + new HookTool.MethodHook() { + @Override + protected void before(MethodHookParam param) { + param.setResult(null); + } + } + ); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemui/controlcenter/CCGridForHyperOS.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemui/controlcenter/CCGridForHyperOS.kt deleted file mode 100644 index 5ac89a1e0..000000000 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemui/controlcenter/CCGridForHyperOS.kt +++ /dev/null @@ -1,93 +0,0 @@ -/* - * This file is part of HyperCeiler. - - * HyperCeiler is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - - * Copyright (C) 2023-2024 HyperCeiler Contributions - */ -package com.sevtinge.hyperceiler.module.hook.systemui.controlcenter - -import android.content.* -import android.graphics.drawable.* -import android.view.* -import com.sevtinge.hyperceiler.module.base.tool.HookTool.* -import com.sevtinge.hyperceiler.utils.prefs.* -import de.robv.android.xposed.* - -object CCGridForHyperOS { - private val radius by lazy { - PrefsUtils.mPrefsMap.getInt("system_ui_control_center_rounded_rect_radius", 72).toFloat() } - - @JvmStatic - fun initCCGridForHyperOS(classLoader: ClassLoader?) { - var warningD: Drawable? = null - var enabledD: Drawable? = null - var restrictedD: Drawable? = null - var disabledD: Drawable? = null - var unavailableD: Drawable? = null - var configuration = 0 - var orientation: Int - - XposedHelpers.findAndHookMethod("miui.systemui.controlcenter.qs.tileview.QSTileItemIconView", classLoader, "updateIcon", "com.android.systemui.plugins.qs.QSTile\$State", Boolean::class.javaPrimitiveType, Boolean::class.javaPrimitiveType, object : MethodHook() { - override fun before(param: MethodHookParam) { - orientation = (param.thisObject as View).context.resources.configuration.orientation - val stackTrace = Thread.currentThread().stackTrace - val targetMethods = setOf( - "miui.systemui.controlcenter.qs.tileview.QSTileItemView.updateState", - "miui.systemui.controlcenter.panel.main.recyclerview.MainPanelItemViewHolder.onSuperSaveModeChanged", - "miui.systemui.controlcenter.qs.tileview.QSTileItemView.updateCustomizeState", - "miui.systemui.controlcenter.qs.tileview.QSTileItemView.onModeChanged" - ) - - val isMethodFound = stackTrace.any { element -> - "${element.className}.${element.methodName}" in targetMethods - } - - if (configuration == orientation && isMethodFound) return - - val pluginContext: Context = XposedHelpers.getObjectField(param.thisObject, "pluginContext") as Context - - val warning: Int = pluginContext.resources.getIdentifier("qs_background_warning", "drawable", "miui.systemui.plugin") - val enabled: Int = pluginContext.resources.getIdentifier("qs_background_enabled", "drawable", "miui.systemui.plugin") - val restricted: Int = pluginContext.resources.getIdentifier("qs_background_restricted", "drawable", "miui.systemui.plugin") - val disabled: Int = pluginContext.resources.getIdentifier("qs_background_disabled", "drawable", "miui.systemui.plugin") - val unavailable: Int = pluginContext.resources.getIdentifier("qs_background_unavailable", "drawable", "miui.systemui.plugin") - warningD = pluginContext.theme.getDrawable(warning) - enabledD = pluginContext.theme.getDrawable(enabled) - restrictedD = pluginContext.theme.getDrawable(restricted) - disabledD = pluginContext.theme.getDrawable(disabled) - unavailableD = pluginContext.theme.getDrawable(unavailable) - - if (warningD is GradientDrawable) { - (warningD as GradientDrawable).cornerRadius = radius - } - if (enabledD is GradientDrawable) { - (enabledD as GradientDrawable).cornerRadius = radius - } - if (restrictedD is GradientDrawable) { - (restrictedD as GradientDrawable).cornerRadius = radius - } - if (disabledD is GradientDrawable) { - (disabledD as GradientDrawable).cornerRadius = radius - } - if (unavailableD is GradientDrawable) { - (unavailableD as GradientDrawable).cornerRadius = radius - } - - configuration = orientation - } - } - ) - } -} diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemui/controlcenter/CCGridForHyperOSKt.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemui/controlcenter/CCGridForHyperOSKt.kt new file mode 100644 index 000000000..11e044d2f --- /dev/null +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemui/controlcenter/CCGridForHyperOSKt.kt @@ -0,0 +1,93 @@ +/* + * This file is part of HyperCeiler. + + * HyperCeiler is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + + * Copyright (C) 2023-2024 HyperCeiler Contributions + */ +package com.sevtinge.hyperceiler.module.hook.systemui.controlcenter + +import android.content.* +import android.graphics.drawable.* +import android.view.* +import com.sevtinge.hyperceiler.module.base.tool.HookTool.* +import com.sevtinge.hyperceiler.utils.prefs.* +import de.robv.android.xposed.* + +object CCGridForHyperOSKt { + private val radius by lazy { + PrefsUtils.mPrefsMap.getInt("system_ui_control_center_rounded_rect_radius", 72).toFloat() } + + @JvmStatic + fun initCCGridForHyperOS(classLoader: ClassLoader?) { + var warningD: Drawable? = null + var enabledD: Drawable? = null + var restrictedD: Drawable? = null + var disabledD: Drawable? = null + var unavailableD: Drawable? = null + var configuration = 0 + var orientation: Int + + XposedHelpers.findAndHookMethod("miui.systemui.controlcenter.qs.tileview.QSTileItemIconView", classLoader, "updateIcon", "com.android.systemui.plugins.qs.QSTile\$State", Boolean::class.javaPrimitiveType, Boolean::class.javaPrimitiveType, object : MethodHook() { + override fun before(param: MethodHookParam) { + orientation = (param.thisObject as View).context.resources.configuration.orientation + val stackTrace = Thread.currentThread().stackTrace + val targetMethods = setOf( + "miui.systemui.controlcenter.qs.tileview.QSTileItemView.updateState", + "miui.systemui.controlcenter.panel.main.recyclerview.MainPanelItemViewHolder.onSuperSaveModeChanged", + "miui.systemui.controlcenter.qs.tileview.QSTileItemView.updateCustomizeState", + "miui.systemui.controlcenter.qs.tileview.QSTileItemView.onModeChanged" + ) + + val isMethodFound = stackTrace.any { element -> + "${element.className}.${element.methodName}" in targetMethods + } + + if (configuration == orientation && isMethodFound) return + + val pluginContext: Context = XposedHelpers.getObjectField(param.thisObject, "pluginContext") as Context + + val warning: Int = pluginContext.resources.getIdentifier("qs_background_warning", "drawable", "miui.systemui.plugin") + val enabled: Int = pluginContext.resources.getIdentifier("qs_background_enabled", "drawable", "miui.systemui.plugin") + val restricted: Int = pluginContext.resources.getIdentifier("qs_background_restricted", "drawable", "miui.systemui.plugin") + val disabled: Int = pluginContext.resources.getIdentifier("qs_background_disabled", "drawable", "miui.systemui.plugin") + val unavailable: Int = pluginContext.resources.getIdentifier("qs_background_unavailable", "drawable", "miui.systemui.plugin") + warningD = pluginContext.theme.getDrawable(warning) + enabledD = pluginContext.theme.getDrawable(enabled) + restrictedD = pluginContext.theme.getDrawable(restricted) + disabledD = pluginContext.theme.getDrawable(disabled) + unavailableD = pluginContext.theme.getDrawable(unavailable) + + if (warningD is GradientDrawable) { + (warningD as GradientDrawable).cornerRadius = radius + } + if (enabledD is GradientDrawable) { + (enabledD as GradientDrawable).cornerRadius = radius + } + if (restrictedD is GradientDrawable) { + (restrictedD as GradientDrawable).cornerRadius = radius + } + if (disabledD is GradientDrawable) { + (disabledD as GradientDrawable).cornerRadius = radius + } + if (unavailableD is GradientDrawable) { + (unavailableD as GradientDrawable).cornerRadius = radius + } + + configuration = orientation + } + } + ) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemui/plugin/NewPluginHelperKt.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemui/plugin/NewPluginHelperKt.kt new file mode 100644 index 000000000..bde0a480d --- /dev/null +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemui/plugin/NewPluginHelperKt.kt @@ -0,0 +1,163 @@ +/* + * This file is part of HyperCeiler. + + * HyperCeiler is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + + * Copyright (C) 2023-2024 HyperCeiler Contributions + */ +package com.sevtinge.hyperceiler.module.hook.systemui.plugin + +import android.content.* +import android.text.* +import com.github.kyuubiran.ezxhelper.ClassUtils.loadClass +import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createAfterHook +import com.github.kyuubiran.ezxhelper.finders.MethodFinder.`-Static`.methodFinder +import com.sevtinge.hyperceiler.module.base.* +import com.sevtinge.hyperceiler.module.hook.systemui.* +import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.* +import com.sevtinge.hyperceiler.module.hook.systemui.statusbar.icon.v.* +import com.sevtinge.hyperceiler.utils.api.* +import java.lang.ref.* + +// https://github.com/buffcow/Hyper5GSwitch/blob/master/app/src/main/kotlin/cn/buffcow/hyper5g/hooker/PluginLoader.kt +object NewPluginHelperKt : BaseHook() { + override fun init() { + loadClass("com.android.systemui.shared.plugins.PluginInstance\$PluginFactory") + .methodFinder().filterByName("createPluginContext") + .first().createAfterHook { + runCatching { + val wrapper = it.result as ContextWrapper + onPluginLoaded(PluginFactory(it.thisObject).also { it.pluginCtxRef = WeakReference(wrapper) }) + }.onFailure { + logE(TAG, lpparam.packageName, "Failed to create plugin context.") + return@createAfterHook + } + } + } + + private fun onPluginLoaded(factory: PluginFactory) { + val mCardStyleTiles = getTileList() + val mIsDefaultMode = mPrefsMap.getStringAsInt("system_ui_plugin_tiles_load_way", 0) == 0 || mPrefsMap.getStringAsInt("system_ui_plugin_tiles_load_way", 0) == 1 + val mIsCompatibilityMode = mPrefsMap.getStringAsInt("system_ui_plugin_tiles_load_way", 0) == 0 || mPrefsMap.getStringAsInt("system_ui_plugin_tiles_load_way", 0) == 2 + try { + when (factory.mComponentName) { + factory.componentNames("miui.systemui.volume.VolumeDialogPlugin") -> { + val classLoader: ClassLoader = factory.pluginCtxRef.get()!!.classLoader + logD(TAG, lpparam.packageName, "Plugin for sysui volume loaded.") + + if (mPrefsMap.getBoolean("system_ui_plugin_enable_volume_blur")) + EnableVolumeBlur.initEnableVolumeBlur(classLoader) + if (mPrefsMap.getBoolean("system_cc_volume_showpct_title")) + NewShowVolumePct.initLoader(classLoader) // 声音百分比 + if (mPrefsMap.getBoolean("system_ui_unlock_super_volume")) + NewSuperVolume.initSuperVolume(classLoader) // 超大音量 + if (mPrefsMap.getBoolean("system_framework_volume_separate_control") && + mPrefsMap.getBoolean("system_framework_volume_separate_slider")) + NotificationVolumeSeparateSlider.initHideDeviceControlEntry(classLoader) + } + + factory.componentNames("miui.systemui.miplay.MiPlayPluginImpl") -> { + val classLoader: ClassLoader = factory.pluginCtxRef.get()!!.classLoader + logD(TAG, lpparam.packageName, "Plugin for sysui mipay loaded.") + + if (mPrefsMap.getStringAsInt("system_ui_control_center_mi_play_entry", 0) != 0) + HideMiPlayEntry.initHideMiPlayEntry(classLoader) + } + + factory.componentNames("miui.systemui.quicksettings.LocalMiuiQSTilePlugin") -> { + val classLoader: ClassLoader = factory.pluginCtxRef.get()!!.classLoader + logD(TAG, lpparam.packageName, "Plugin for sysui qs tiles loaded.") + + if (mPrefsMap.getBoolean("systemui_plugin_card_tiles_enabled") && + mPrefsMap.getString("systemui_plugin_card_tiles", "").isNotEmpty() && + mIsCompatibilityMode + ) { + CustomCardTiles.initCustomCardTiles(classLoader, mCardStyleTiles) + } + if (mPrefsMap.getBoolean("system_ui_control_center_rounded_rect") && mIsDefaultMode) + CCGridForHyperOS.initCCGridForHyperOS(classLoader) // 控制中心磁贴圆角 //A + if (mPrefsMap.getBoolean("system_ui_control_center_qs_open_color") || + mPrefsMap.getBoolean("system_ui_control_center_qs_big_open_color") + ) { + QSColor.pluginHook(classLoader) + } + } + + factory.componentNames("miui.systemui.controlcenter.MiuiControlCenter") -> { + val classLoader: ClassLoader = factory.pluginCtxRef.get()!!.classLoader + logD(TAG, lpparam.packageName, "Plugin for sysui control center loaded.") + + if (mPrefsMap.getBoolean("systemui_plugin_card_tiles_enabled") && + mPrefsMap.getString("systemui_plugin_card_tiles", "").isNotEmpty() && + mIsDefaultMode + ) { + CustomCardTiles.initCustomCardTiles(classLoader, mCardStyleTiles) //A + } + if (mPrefsMap.getBoolean("system_ui_control_center_hide_edit_botton")) + HideEditButton.initHideEditButton(classLoader) + if (mPrefsMap.getBoolean("system_ui_control_center_rounded_rect") && mIsCompatibilityMode) + CCGridForHyperOS.initCCGridForHyperOS(classLoader) // 控制中心磁贴圆角 + if (mPrefsMap.getBoolean("system_ui_control_center_qs_open_color") || + mPrefsMap.getBoolean("system_ui_control_center_qs_big_open_color") + ) { + QSColor.pluginHook(classLoader) + } + } + + factory.componentNames("miui.systemui.notification.NotificationStatPluginImpl") -> { + val classLoader: ClassLoader = factory.pluginCtxRef.get()!!.classLoader + logD(TAG, lpparam.packageName, "Plugin for sysui NotificationStatPluginImpl loaded.") + + if (mPrefsMap.getBoolean("system_ui_statusbar_music_switch")) + FocusNotifLyric.initLoader(classLoader); + } + + else -> { + val classLoader: ClassLoader = factory.pluginCtxRef.get()!!.classLoader + + if (mPrefsMap.getStringAsInt("system_ui_control_center_mi_smart_hub_entry", 0) != 0) + HideMiSmartHubEntry.initHideMiSmartHubEntry(classLoader) + if (mPrefsMap.getStringAsInt("system_ui_control_center_device_ctrl_entry", 0) != 0) + HideDeviceControlEntry.initHideDeviceControlEntry(classLoader) + if (mPrefsMap.getStringAsInt("system_ui_control_center_cc_bluetooth_tile_style", 1) > 1) + BluetoothTileStyle.initHideDeviceControlEntry(classLoader) + if (mPrefsMap.getStringAsInt("system_ui_control_center_hide_operator", 0) == 3) + ShowDeviceName.initShowDeviceName(classLoader) + if (mPrefsMap.getBoolean("system_ui_control_center_disable_device_managed")) + DisableDeviceManaged.initDisableDeviceManaged(classLoader) + + // logD(TAG, lpparam.packageName, "Plugin is ${factory.mComponentName}") + // 仅备份当前可用注入 ClassLoader + // miui.systemui.volume.VolumeDialogPlugin + // miui.systemui.miplay.MiPlayPluginImpl + // miui.systemui.quicksettings.LocalMiuiQSTilePlugin + // miui.systemui.controlcenter.MiuiControlCenter + // ↓ + // miui.systemui.notification.NotificationStatPluginImpl + // miui.systemui.globalactions.GlobalActionsPlugin + // miui.systemui.notification.FocusNotificationPluginImpl + // miui.systemui.notification.unimportant.UnimportantSdkPluginImpl + } + } + } catch (_: Exception) {} + } + + private fun getTileList(): List { + val cardTiles = + mPrefsMap.getString("systemui_plugin_card_tiles", "").replace("List_", "") + + return if (TextUtils.isEmpty(cardTiles.replace("List_", ""))) ArrayList() + else listOf(*cardTiles.split("\\|".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/app/systemui/ControlCenterSettings.java b/app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/app/systemui/ControlCenterSettings.java index 3cc073cb1..25b822604 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/app/systemui/ControlCenterSettings.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/app/systemui/ControlCenterSettings.java @@ -73,6 +73,7 @@ public class ControlCenterSettings extends DashboardFragment implements Preferen ColorPickerPreference mProgressBarColor; SwitchPreference mRedirectNotice; SwitchPreference mShadeHeaderBlur; + DropDownPreference mPluginLoadMode; DropDownPreference mSunshineMode; DropDownPreference mSunshineModeHigh; SeekBarPreferenceCompat mSunshineModeHighBrightness; @@ -121,6 +122,7 @@ public void initPrefs() { mProgressBarColor = findPreference("prefs_key_system_ui_control_center_media_control_seekbar_color"); mRedirectNotice = findPreference("prefs_key_system_ui_control_center_redirect_notice"); mShadeHeaderBlur = findPreference("prefs_key_system_ui_shade_header_gradient_blur"); + mPluginLoadMode = findPreference("prefs_key_system_ui_plugin_tiles_load_way"); mSunshineMode = findPreference("prefs_key_system_control_center_sunshine_new_mode"); mSunshineModeHigh = findPreference("prefs_key_system_control_center_sunshine_new_mode_high"); mSunshineModeHighBrightness = findPreference("prefs_key_system_control_center_sunshine_mode_brightness"); @@ -158,6 +160,7 @@ public void initPrefs() { mSunshineModeHighBrightness.setVisible(false); } + mPluginLoadMode.setVisible(isMoreHyperOSVersion(2f)); if (isMoreHyperOSVersion(1f)) { mNewCCGrid.setVisible(false); mCard.setVisible(false); diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index b7e907a6b..b25b8c248 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -1073,6 +1073,12 @@ 禁用通知白名单 音量条模糊 仅供 Android 12 及以上的 MTK 机型使用,可能存在 GPU 负载较高的情况 + + 磁贴 hook 加载方式 + 全局加载可能会导致不必要的卡顿;请根据实际可用性选择加载方式 + 全局 + 默认 + 兼容 设置 国际版本设置页面 diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index 5336f8430..d6f6aeda1 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -1127,6 +1127,18 @@ @color/update_text_border1 + + @string/system_ui_plugin_tiles_load_way_global + @string/system_ui_plugin_tiles_load_way_default + @string/system_ui_plugin_tiles_load_way_compatibility + + + + 0 + 1 + 2 + + @string/array_global_actions_none @string/array_global_actions_lock diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 966fb1349..9251177d0 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1013,6 +1013,11 @@ There is no restriction on background blur for Advanced textures, only for third-party theme removal. Remove notification count limit Allow display 10, 17 or more notifications. + Tiles hook loading mode + Global mode may cause unnecessary lag. Please choose the loading mode based on actual availability. + Global + Default + Compatibility Others Native volume bar diff --git a/app/src/main/res/xml/system_ui_control_center.xml b/app/src/main/res/xml/system_ui_control_center.xml index 64b5da121..c710c1a59 100644 --- a/app/src/main/res/xml/system_ui_control_center.xml +++ b/app/src/main/res/xml/system_ui_control_center.xml @@ -21,6 +21,17 @@ app:myLocation="@string/system_ui_controlcenter_title" app:quick_restart="com.android.systemui"> + + + + +