Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: DisableMiuiMultiWinSwitch #938

Merged
merged 6 commits into from
Nov 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ public void handleLoadPackage() {
initHook(HideLockScreenHint.INSTANCE, mPrefsMap.getBoolean("system_ui_lock_screen_unlock_tip"));
initHook(HideLockScreenStatusBar.INSTANCE, mPrefsMap.getBoolean("system_ui_lock_screen_hide_status_bar"));
initHook(new BlockEditor(), mPrefsMap.getBoolean("system_ui_lock_screen_block_editor"));
initHook(new AllowThirdLockScreenUseFace(), mPrefsMap.getBoolean("system_ui_lock_screen_allow_third_face"));
initHook(AllowThirdLockScreenUseFace.INSTANCE, mPrefsMap.getBoolean("system_ui_lock_screen_allow_third_face"));
initHook(new DisableUnlockByBleToast(), mPrefsMap.getBoolean("system_ui_lock_screen_disable_unlock_by_ble_toast"));
initHook(new LinkageAnimCustomer(), mPrefsMap.getBoolean("system_ui_lock_screen_linkage_anim"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ public void handleLoadPackage() {
initHook(HideLockScreenHint.INSTANCE, mPrefsMap.getBoolean("system_ui_lock_screen_unlock_tip"));
initHook(HideLockScreenStatusBar.INSTANCE, mPrefsMap.getBoolean("system_ui_lock_screen_hide_status_bar"));
initHook(new BlockEditor(), mPrefsMap.getBoolean("system_ui_lock_screen_block_editor"));
initHook(new AllowThirdLockScreenUseFace(), mPrefsMap.getBoolean("system_ui_lock_screen_allow_third_face"));
initHook(AllowThirdLockScreenUseFace.INSTANCE, mPrefsMap.getBoolean("system_ui_lock_screen_allow_third_face"));
initHook(new DisableUnlockByBleToast(), mPrefsMap.getBoolean("system_ui_lock_screen_disable_unlock_by_ble_toast"));
initHook(new LinkageAnimCustomer(), mPrefsMap.getBoolean("system_ui_lock_screen_linkage_anim"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,13 @@
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.QSControlDetailBackgroundAlpha;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.QSGrid;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.QSGridLabels;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.RedirectToNotificationChannelSetting;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.ReduceBrightColorsTile;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.RemoveNotifNumLimit;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.SunlightMode;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.SwitchCCAndNotification;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.TaplusTile;
import com.sevtinge.hyperceiler.module.hook.systemui.lockscreen.AddBlurEffectToLockScreen;
import com.sevtinge.hyperceiler.module.hook.systemui.lockscreen.AllowThirdLockScreenUseFace;
import com.sevtinge.hyperceiler.module.hook.systemui.lockscreen.BlockEditor;
import com.sevtinge.hyperceiler.module.hook.systemui.lockscreen.BlurButton;
import com.sevtinge.hyperceiler.module.hook.systemui.lockscreen.ChargingCVP;
import com.sevtinge.hyperceiler.module.hook.systemui.lockscreen.ClockDisplaySeconds;
Expand Down Expand Up @@ -356,8 +354,8 @@ public void handleLoadPackage() {
initHook(HideLockscreenZenMode.INSTANCE, mPrefsMap.getBoolean("system_ui_lock_screen_not_disturb_mode"));
initHook(HideLockScreenHint.INSTANCE, mPrefsMap.getBoolean("system_ui_lock_screen_unlock_tip"));
initHook(HideLockScreenStatusBar.INSTANCE, mPrefsMap.getBoolean("system_ui_lock_screen_hide_status_bar"));
initHook(new BlockEditor(), mPrefsMap.getBoolean("system_ui_lock_screen_block_editor"));
initHook(new AllowThirdLockScreenUseFace(), mPrefsMap.getBoolean("system_ui_lock_screen_allow_third_face"));
// initHook(new BlockEditor(), mPrefsMap.getBoolean("system_ui_lock_screen_block_editor"));
initHook(AllowThirdLockScreenUseFace.INSTANCE, mPrefsMap.getBoolean("system_ui_lock_screen_allow_third_face"));
initHook(new DisableUnlockByBleToast(), mPrefsMap.getBoolean("system_ui_lock_screen_disable_unlock_by_ble_toast"));
initHook(new LinkageAnimCustomer(), mPrefsMap.getBoolean("system_ui_lock_screen_linkage_anim"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ public void handleLoadPackage() {
initHook(HideLockScreenHint.INSTANCE, mPrefsMap.getBoolean("system_ui_lock_screen_unlock_tip"));
initHook(HideLockScreenStatusBar.INSTANCE, mPrefsMap.getBoolean("system_ui_lock_screen_hide_status_bar"));
initHook(new BlockEditor(), mPrefsMap.getBoolean("system_ui_lock_screen_block_editor"));
initHook(new AllowThirdLockScreenUseFace(), mPrefsMap.getBoolean("system_ui_lock_screen_allow_third_face"));
initHook(AllowThirdLockScreenUseFace.INSTANCE, mPrefsMap.getBoolean("system_ui_lock_screen_allow_third_face"));
initHook(new DisableUnlockByBleToast(), mPrefsMap.getBoolean("system_ui_lock_screen_disable_unlock_by_ble_toast"));
initHook(new LinkageAnimCustomer(), mPrefsMap.getBoolean("system_ui_lock_screen_linkage_anim"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
*/
package com.sevtinge.hyperceiler.module.app.SystemUI.Phone;

import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.isMoreHyperOSVersion;
import static com.sevtinge.hyperceiler.utils.api.OldFunApisKt.isNewNetworkStyle;
import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.isMoreHyperOSVersion;

import com.hchen.database.HookBase;
import com.sevtinge.hyperceiler.module.base.BaseModule;
Expand Down Expand Up @@ -356,7 +356,7 @@ public void handleLoadPackage() {
initHook(HideLockScreenHint.INSTANCE, mPrefsMap.getBoolean("system_ui_lock_screen_unlock_tip"));
initHook(HideLockScreenStatusBar.INSTANCE, mPrefsMap.getBoolean("system_ui_lock_screen_hide_status_bar"));
initHook(new BlockEditor(), mPrefsMap.getBoolean("system_ui_lock_screen_block_editor"));
initHook(new AllowThirdLockScreenUseFace(), mPrefsMap.getBoolean("system_ui_lock_screen_allow_third_face"));
initHook(AllowThirdLockScreenUseFace.INSTANCE, mPrefsMap.getBoolean("system_ui_lock_screen_allow_third_face"));
initHook(new DisableUnlockByBleToast(), mPrefsMap.getBoolean("system_ui_lock_screen_disable_unlock_by_ble_toast"));
initHook(new LinkageAnimCustomer(), mPrefsMap.getBoolean("system_ui_lock_screen_linkage_anim"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import com.sevtinge.hyperceiler.module.hook.systemui.AutoCollapse;
import com.sevtinge.hyperceiler.module.hook.systemui.BluetoothRestrict;
import com.sevtinge.hyperceiler.module.hook.systemui.BrightnessPct;
import com.sevtinge.hyperceiler.module.hook.systemui.ChargeAnimationStyle;
import com.sevtinge.hyperceiler.module.hook.systemui.DisableBottomBar;
import com.sevtinge.hyperceiler.module.hook.systemui.DisableInfinitymodeGesture;
import com.sevtinge.hyperceiler.module.hook.systemui.DisableMiuiMultiWinSwitch;
Expand All @@ -53,10 +52,7 @@
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.ControlCenterStyle;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.DisableDeviceManaged;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.ExpandNotification;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.FiveGTile;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.FixTilesList;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.FlashLight;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.GmsTile;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.HideDelimiter;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.MediaButton;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.MediaControlPanelBackgroundMix;
Expand All @@ -73,16 +69,10 @@
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.QSColor;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.QSControlDetailBackgroundAlpha;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.QSGrid;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.QSGridLabels;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.RedirectToNotificationChannelSetting;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.ReduceBrightColorsTile;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.RemoveNotifNumLimit;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.SunlightMode;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.SwitchCCAndNotification;
import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.TaplusTile;
import com.sevtinge.hyperceiler.module.hook.systemui.lockscreen.AddBlurEffectToLockScreen;
import com.sevtinge.hyperceiler.module.hook.systemui.lockscreen.AllowThirdLockScreenUseFace;
import com.sevtinge.hyperceiler.module.hook.systemui.lockscreen.BlockEditor;
import com.sevtinge.hyperceiler.module.hook.systemui.lockscreen.BlurButton;
import com.sevtinge.hyperceiler.module.hook.systemui.lockscreen.ChargingCVP;
import com.sevtinge.hyperceiler.module.hook.systemui.lockscreen.ClockDisplaySeconds;
Expand Down Expand Up @@ -113,7 +103,6 @@
import com.sevtinge.hyperceiler.module.hook.systemui.statusbar.clock.StatusBarClockNew;
import com.sevtinge.hyperceiler.module.hook.systemui.statusbar.clock.TimeCustomization;
import com.sevtinge.hyperceiler.module.hook.systemui.statusbar.clock.TimeStyle;
import com.sevtinge.hyperceiler.module.hook.systemui.statusbar.device.DisplayHardwareDetail;
import com.sevtinge.hyperceiler.module.hook.systemui.statusbar.icon.all.BatteryStyle;
import com.sevtinge.hyperceiler.module.hook.systemui.statusbar.icon.all.BluetoothIcon;
import com.sevtinge.hyperceiler.module.hook.systemui.statusbar.icon.all.DataSaverIcon;
Expand Down Expand Up @@ -355,8 +344,8 @@ public void handleLoadPackage() {
initHook(HideLockscreenZenMode.INSTANCE, mPrefsMap.getBoolean("system_ui_lock_screen_not_disturb_mode"));
initHook(HideLockScreenHint.INSTANCE, mPrefsMap.getBoolean("system_ui_lock_screen_unlock_tip"));
initHook(HideLockScreenStatusBar.INSTANCE, mPrefsMap.getBoolean("system_ui_lock_screen_hide_status_bar"));
initHook(new BlockEditor(), mPrefsMap.getBoolean("system_ui_lock_screen_block_editor"));
initHook(new AllowThirdLockScreenUseFace(), mPrefsMap.getBoolean("system_ui_lock_screen_allow_third_face"));
// initHook(new BlockEditor(), mPrefsMap.getBoolean("system_ui_lock_screen_block_editor"));
initHook(AllowThirdLockScreenUseFace.INSTANCE, mPrefsMap.getBoolean("system_ui_lock_screen_allow_third_face"));
initHook(new DisableUnlockByBleToast(), mPrefsMap.getBoolean("system_ui_lock_screen_disable_unlock_by_ble_toast"));
initHook(new LinkageAnimCustomer(), mPrefsMap.getBoolean("system_ui_lock_screen_linkage_anim"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,16 @@ import com.github.kyuubiran.ezxhelper.ClassUtils.loadClass
import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook
import com.github.kyuubiran.ezxhelper.finders.MethodFinder.`-Static`.methodFinder
import com.sevtinge.hyperceiler.module.base.BaseHook
import com.sevtinge.hyperceiler.utils.devicesdk.*

// by ljlvink
object DisableMiuiMultiWinSwitch : BaseHook() {
override fun init() {
loadClass("com.android.wm.shell.miuimultiwinswitch.miuiwindowdecor.MiuiDotView", lpparam.classLoader).methodFinder()
loadClass(
if (isMoreAndroidVersion(35)) "com.android.wm.shell.multitasking.miuimultiwinswitch.miuiwindowdecor.MiuiDotView"
else "com.android.wm.shell.miuimultiwinswitch.miuiwindowdecor.MiuiDotView",
lpparam.classLoader
).methodFinder()
.filterByName("onDraw")
.single().createHook {
returnConstant(null)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* 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 <https://www.gnu.org/licenses/>.

* Copyright (C) 2023-2024 HyperCeiler Contributions
*/
package com.sevtinge.hyperceiler.module.hook.systemui.lockscreen

import com.github.kyuubiran.ezxhelper.ClassUtils.loadClassOrNull
import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook
import com.github.kyuubiran.ezxhelper.finders.MethodFinder.`-Static`.methodFinder
import com.sevtinge.hyperceiler.module.base.*
import com.sevtinge.hyperceiler.utils.devicesdk.*

object AllowThirdLockScreenUseFace : BaseHook() {

Check warning on line 27 in app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemui/lockscreen/AllowThirdLockScreenUseFace.kt

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemui/lockscreen/AllowThirdLockScreenUseFace.kt#L27

AllowThirdLockScreenUseFace is missing required documentation.
override fun init() {
loadClassOrNull("com.android.keyguard.KeyguardUpdateMonitor")?.methodFinder()
?.filterByName("isUnlockWithFacePossible")
?.single()?.createHook {
returnConstant(true)
}
loadClassOrNull(if (isAndroidVersion(35)) "miui.stub.keyguard.KeyguardStub\$registerKeyguardUpdateMonitor\$1" else "miui.stub.MiuiStub\$3")?.methodFinder()
?.filterByName("isUnlockWithFingerprintPossible")
?.single()?.createHook {
returnConstant(true)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package com.sevtinge.hyperceiler.module.hook.systemui.lockscreen;

import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.isMoreAndroidVersion;

import android.content.Context;
import android.widget.Toast;

Expand All @@ -28,7 +30,7 @@
public class DisableUnlockByBleToast extends BaseHook {
@Override
public void init() throws NoSuchMethodException {
findAndHookMethod("com.android.keyguard.KeyguardSecurityContainerController$2", "dismiss", boolean.class, int.class, boolean.class, "com.android.keyguard.KeyguardSecurityModel$SecurityMode", new MethodHook() {
findAndHookMethod(isMoreAndroidVersion(35) ? "com.android.keyguard.KeyguardSecurityContainerController$3" : "com.android.keyguard.KeyguardSecurityContainerController$2", "dismiss", boolean.class, int.class, boolean.class, "com.android.keyguard.KeyguardSecurityModel$SecurityMode", new MethodHook() {
@Override
protected void before(MethodHookParam param) throws Throwable {
findAndHookMethod(Toast.class, "makeText", Context.class, int.class, int.class, new MethodHook() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ object HideLockscreenZenMode : BaseHook() {
// hyperOS fix by hyper helper
if (isMoreHyperOSVersion(1f) && isMoreAndroidVersion(34)) {
zenModeClass.methodFinder()
.filterByName("updateVisibility")
.filterByName(if (isMoreAndroidVersion(35)) "updateVisibility$1" else "updateVisibility")
.single().createHook {
before {
it.thisObject.setObjectField("manuallyDismissed", true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public class LockScreenSettings extends SettingsPreferenceFragment {
SwitchPreference mForceSystemFonts; // 时钟使用系统字体
SwitchPreference mPasswordFree; // 开机免输入密码
SwitchPreference mChangingCVTime; // 充电信息显示刷新间隔
SwitchPreference mBlockEditor; // 禁用长按进入锁屏编辑

@Override
public int getContentResId() {
Expand All @@ -44,14 +45,16 @@ public int getContentResId() {

@Override
public void initPrefs() {
mShowSec = findPreference("prefs_key_system_ui_lock_screen_show_second");
mForceSystemFonts = findPreference("prefs_key_system_ui_lock_screen_force_system_fonts");
mPasswordFree = findPreference("prefs_key_system_ui_lock_screen_password_free");
mChangingCVTime = findPreference("prefs_key_system_ui_lock_screen_show_spacing_value");
mShowSec = findPreference("prefs_key_system_ui_lock_screen_show_second");
mBlockEditor = findPreference("prefs_key_system_ui_lock_screen_block_editor");

mShowSec.setVisible(!isHyperOSVersion(1f));
mForceSystemFonts.setVisible(!isHyperOSVersion(1f));
mChangingCVTime.setVisible(isMoreAndroidVersion(Build.VERSION_CODES.TIRAMISU));
mBlockEditor.setVisible(!isMoreAndroidVersion(Build.VERSION_CODES.VANILLA_ICE_CREAM));

if (isDeviceEncrypted(requireContext())) {
mPasswordFree.setChecked(false);
Expand Down