From cbb3e9ab00c28641dfe182b885f85e4db979a795 Mon Sep 17 00:00:00 2001 From: DubheBroken Date: Wed, 24 Jun 2026 01:31:58 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=8C=E9=9A=90=E8=97=8F=E6=89=8B=E5=8A=BF?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E7=BA=BF=E3=80=8D=E5=8A=9F=E8=83=BD=E9=80=82?= =?UTF-8?q?=E9=85=8DOS3=20A16=EF=BC=88=E9=87=8D=E5=86=99onDraw=EF=BC=89=20?= =?UTF-8?q?=E5=BC=80=E5=85=B3=E3=80=8C=E9=9A=90=E8=97=8F=E6=89=8B=E5=8A=BF?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E7=BA=BF=E3=80=8D=E5=8A=9F=E8=83=BD=E6=97=B6?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=E8=AF=A2=E9=97=AE=E6=98=AF=E5=90=A6=E7=AB=8B?= =?UTF-8?q?=E5=8D=B3=E9=87=8D=E5=90=AF=20=E6=8F=90=E5=8D=87=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E4=BB=A3=E7=A0=81=E5=81=A5=E5=A3=AE=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hooker/systemui/NavigationSettings.java | 43 --------- .../hooker/systemui/NavigationSettings.kt | 56 ++++++++++++ .../src/main/res/values-ar-rSA/strings.xml | 4 + .../src/main/res/values-de-rDE/strings.xml | 4 + .../src/main/res/values-es-rES/strings.xml | 4 + .../src/main/res/values-in-rID/strings.xml | 4 + .../src/main/res/values-it-rIT/strings.xml | 4 + .../src/main/res/values-ja-rJP/strings.xml | 4 + .../src/main/res/values-pl-rPL/strings.xml | 4 + .../src/main/res/values-pt-rBR/strings.xml | 4 + .../src/main/res/values-ru-rRU/strings.xml | 4 + .../src/main/res/values-tr-rTR/strings.xml | 4 + .../src/main/res/values-uk-rUA/strings.xml | 4 + .../src/main/res/values-vi-rVN/strings.xml | 4 + .../src/main/res/values-zh-rCN/strings.xml | 4 + .../src/main/res/values-zh-rHK/strings.xml | 4 + .../src/main/res/values-zh-rME/strings.xml | 4 + .../src/main/res/values-zh-rTW/strings.xml | 4 + library/core/src/main/res/values/strings.xml | 4 + .../libhook/app/SystemUI/SystemUIB.java | 2 + .../home/navigation/HideNavigationBar.java | 90 +++++++++++++------ 21 files changed, 188 insertions(+), 71 deletions(-) delete mode 100644 library/core/src/main/java/com/sevtinge/hyperceiler/hooker/systemui/NavigationSettings.java create mode 100644 library/core/src/main/java/com/sevtinge/hyperceiler/hooker/systemui/NavigationSettings.kt diff --git a/library/core/src/main/java/com/sevtinge/hyperceiler/hooker/systemui/NavigationSettings.java b/library/core/src/main/java/com/sevtinge/hyperceiler/hooker/systemui/NavigationSettings.java deleted file mode 100644 index 926002b78d..0000000000 --- a/library/core/src/main/java/com/sevtinge/hyperceiler/hooker/systemui/NavigationSettings.java +++ /dev/null @@ -1,43 +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-2026 HyperCeiler Contributions - */ -package com.sevtinge.hyperceiler.hooker.systemui; - -import androidx.preference.SwitchPreference; - -import com.sevtinge.hyperceiler.core.R; -import com.sevtinge.hyperceiler.dashboard.DashboardFragment; -import com.sevtinge.hyperceiler.libhook.utils.hookapi.tool.AppsTool; - -public class NavigationSettings extends DashboardFragment { - SwitchPreference navigation; - - @Override - public int getPreferenceScreenResId() { - return R.xml.system_ui_navigation; - } - - @Override - public void initPrefs() { - navigation = findPreference("prefs_key_system_ui_hide_navigation_bar"); - navigation.setOnPreferenceChangeListener((preference, o) -> { - AppsTool.killApps("com.miui.home", "com.android.systemui"); - return true; - }); - } -} diff --git a/library/core/src/main/java/com/sevtinge/hyperceiler/hooker/systemui/NavigationSettings.kt b/library/core/src/main/java/com/sevtinge/hyperceiler/hooker/systemui/NavigationSettings.kt new file mode 100644 index 0000000000..8987d37e02 --- /dev/null +++ b/library/core/src/main/java/com/sevtinge/hyperceiler/hooker/systemui/NavigationSettings.kt @@ -0,0 +1,56 @@ +/* + * 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-2026 HyperCeiler Contributions + */ +package com.sevtinge.hyperceiler.hooker.systemui + +import androidx.preference.Preference +import androidx.preference.SwitchPreference +import com.sevtinge.hyperceiler.core.R +import com.sevtinge.hyperceiler.dashboard.DashboardFragment +import com.sevtinge.hyperceiler.libhook.utils.hookapi.tool.AppsTool +import fan.appcompat.app.AlertDialog + +/** + * Navigation settings fragment for SystemUI. + */ +class NavigationSettings : DashboardFragment() { + var navigation: SwitchPreference? = null + + override fun getPreferenceScreenResId(): Int { + return R.xml.system_ui_navigation + } + + override fun initPrefs() { + navigation = findPreference("prefs_key_system_ui_hide_navigation_bar") + navigation?.setOnPreferenceChangeListener { preference: Preference, newValue: Any? -> + // 询问是否立即重启 + val systemUiName = getString(R.string.system_ui) + val homeName = getString(R.string.mihome) + AlertDialog.Builder(requireActivity()) + .setTitle(R.string.navigation_restart_confirm_title) + .setMessage(getString(R.string.navigation_restart_confirm_message, + systemUiName, + homeName)) + .setPositiveButton(R.string.navigation_restart_confirm_ok) { _, _ -> + // 重启“系统界面”和“系统桌面” + AppsTool.killApps("com.miui.home", "com.android.systemui") + }.setNegativeButton(android.R.string.cancel, null).show() + true + } + } +} diff --git a/library/core/src/main/res/values-ar-rSA/strings.xml b/library/core/src/main/res/values-ar-rSA/strings.xml index a557156bcc..2565d3a0a5 100644 --- a/library/core/src/main/res/values-ar-rSA/strings.xml +++ b/library/core/src/main/res/values-ar-rSA/strings.xml @@ -87,4 +87,8 @@ تمكين الاقتراحات يبدو أن التطبيق المستهدف هو إصدار معدل. هذه الإضافة غير قادرة على توفير خدمات الربط له. حاول استخدام إصدار مختلف من التطبيق أو تمكين وضع التصحيح وحاول مرة أخرى. التطبيق المستهدف قيد التصحيح!\nإصدار التطبيق الحالي: %1$s\nالإصدار المستهدف المحدد: %2$s\nتم تطبيق الرابط بنجاح: %3$s + + إعادة التشغيل + هل تريد إعادة تشغيل %1$s و%2$s الآن؟ + إعادة التشغيل الآن diff --git a/library/core/src/main/res/values-de-rDE/strings.xml b/library/core/src/main/res/values-de-rDE/strings.xml index b757a441ab..c763bafc19 100644 --- a/library/core/src/main/res/values-de-rDE/strings.xml +++ b/library/core/src/main/res/values-de-rDE/strings.xml @@ -84,4 +84,8 @@ Ignorieren Vorschlag deaktivieren Vorschlag aktivieren + + Neustart + Möchten Sie %1$s und %2$s jetzt neu starten? + Jetzt neu starten diff --git a/library/core/src/main/res/values-es-rES/strings.xml b/library/core/src/main/res/values-es-rES/strings.xml index aed8b7acbb..920833b1f3 100644 --- a/library/core/src/main/res/values-es-rES/strings.xml +++ b/library/core/src/main/res/values-es-rES/strings.xml @@ -71,4 +71,8 @@ Ignorar Desactivar sugerencias Activar sugerencias + + Reiniciar + ¿Quieres reiniciar %1$s y %2$s ahora? + Reiniciar ahora diff --git a/library/core/src/main/res/values-in-rID/strings.xml b/library/core/src/main/res/values-in-rID/strings.xml index 71ec45bb04..e46e8d7a0e 100644 --- a/library/core/src/main/res/values-in-rID/strings.xml +++ b/library/core/src/main/res/values-in-rID/strings.xml @@ -68,4 +68,8 @@ HyperCeiler tiba-tiba tertutup. Untuk membantu kami memperbaiki masalah ini, berikan informasi berikut:\n\nTekan dan tahan pesan apa pun untuk menyalin semuanya. Nonaktifkan mode aman Batal + + Mulai ulang + Apakah Anda ingin memulai ulang %1$s dan %2$s sekarang? + Mulai ulang sekarang diff --git a/library/core/src/main/res/values-it-rIT/strings.xml b/library/core/src/main/res/values-it-rIT/strings.xml index a20e70f506..8b4db93813 100644 --- a/library/core/src/main/res/values-it-rIT/strings.xml +++ b/library/core/src/main/res/values-it-rIT/strings.xml @@ -54,4 +54,8 @@ Ignora Disabilita suggerimento Abilita suggerimento + + Riavvia + Vuoi riavviare %1$s e %2$s ora? + Riavvia ora diff --git a/library/core/src/main/res/values-ja-rJP/strings.xml b/library/core/src/main/res/values-ja-rJP/strings.xml index 70e9dbb987..ea92114413 100644 --- a/library/core/src/main/res/values-ja-rJP/strings.xml +++ b/library/core/src/main/res/values-ja-rJP/strings.xml @@ -91,4 +91,8 @@ %d 個のアプリを検索 アプリリストの読み込みに失敗しました この機能は、お使いのデバイスではサポートされていないか、一部の設定の下に隠れている可能性があります + + 再起動 + %1$sと%2$sを今すぐ再起動しますか? + 今すぐ再起動 diff --git a/library/core/src/main/res/values-pl-rPL/strings.xml b/library/core/src/main/res/values-pl-rPL/strings.xml index f8ef1e0dde..0bf69d2598 100644 --- a/library/core/src/main/res/values-pl-rPL/strings.xml +++ b/library/core/src/main/res/values-pl-rPL/strings.xml @@ -74,4 +74,8 @@ Eksperymentalne funkcje Podstawowe wiadomości Aplikacja HyperCeiler została nieoczekiwanie zamknięta. Aby pomóc nam to naprawić, podaj poniższe informacje:\n\nNaciśnij i przytrzymaj dowolną wiadomość, aby skopiować całą jej treść. + + Zrestartuj + Czy chcesz teraz zrestartować %1$s i %2$s? + Zrestartuj teraz diff --git a/library/core/src/main/res/values-pt-rBR/strings.xml b/library/core/src/main/res/values-pt-rBR/strings.xml index 5aa824bf03..ee409aa0fd 100644 --- a/library/core/src/main/res/values-pt-rBR/strings.xml +++ b/library/core/src/main/res/values-pt-rBR/strings.xml @@ -87,4 +87,8 @@ Ativar sugestão O app de destino parece ser uma versão modificada. Esse módulo não consegue fornecer serviços de hook para ele. Tente usar uma versão diferente do app ou ative o Modo de depuração e tente novamente. O app de destino está sendo depurado!\nVersão atual do app: %1$s\nVersão de destino selecionada: %2$s\nHook aplicado com sucesso: %3$s + + Reiniciar + Você quer reiniciar %1$s e %2$s agora? + Reiniciar agora diff --git a/library/core/src/main/res/values-ru-rRU/strings.xml b/library/core/src/main/res/values-ru-rRU/strings.xml index 7ef0ed7d23..eb4b00eed9 100644 --- a/library/core/src/main/res/values-ru-rRU/strings.xml +++ b/library/core/src/main/res/values-ru-rRU/strings.xml @@ -90,4 +90,8 @@ Версия отладки Неудалось загрузить список приложений Поиск %d приложений + + Перезагрузка + Вы хотите перезагрузить %1$s и %2$s сейчас? + Перезагрузить сейчас diff --git a/library/core/src/main/res/values-tr-rTR/strings.xml b/library/core/src/main/res/values-tr-rTR/strings.xml index e615b4e6d3..4ca589164d 100644 --- a/library/core/src/main/res/values-tr-rTR/strings.xml +++ b/library/core/src/main/res/values-tr-rTR/strings.xml @@ -85,4 +85,8 @@ Yoksay Tavsiyeleri devre dışı bırak Tavsiyeleri etkinleştir + + Yeniden başlat + %1$s ve %2$s şimdi yeniden başlatmak istiyor musunuz? + Şimdi yeniden başlat diff --git a/library/core/src/main/res/values-uk-rUA/strings.xml b/library/core/src/main/res/values-uk-rUA/strings.xml index 491c88c54d..9c8f92a6c2 100644 --- a/library/core/src/main/res/values-uk-rUA/strings.xml +++ b/library/core/src/main/res/values-uk-rUA/strings.xml @@ -85,4 +85,8 @@ Ігнорувати Вимкнути пропозиції Увімкнути пропозиції + + Перезавантажити + Ви хочете перезапустити %1$s та %2$s зараз? + Перезапустити зараз diff --git a/library/core/src/main/res/values-vi-rVN/strings.xml b/library/core/src/main/res/values-vi-rVN/strings.xml index d918fbeb13..bc0cd18e70 100644 --- a/library/core/src/main/res/values-vi-rVN/strings.xml +++ b/library/core/src/main/res/values-vi-rVN/strings.xml @@ -91,4 +91,8 @@ Tìm kiếm %d ứng dụng Không tải được danh sách ứng dụng Tính năng này có thể không được hỗ trợ trên thiết bị này hoặc có thể bị ẩn trong một số tùy chọn + + Khởi động lại + Bạn có muốn khởi động lại %1$s và %2$s ngay bây giờ không? + Khởi động lại ngay diff --git a/library/core/src/main/res/values-zh-rCN/strings.xml b/library/core/src/main/res/values-zh-rCN/strings.xml index 1cddd29859..4fd2acfc1f 100644 --- a/library/core/src/main/res/values-zh-rCN/strings.xml +++ b/library/core/src/main/res/values-zh-rCN/strings.xml @@ -76,4 +76,8 @@ 当前目标作用域来源可能并不是 Xiaomi 官方,出于安全考虑,已停止加载此作用域的所有功能,请尝试更改为 Xiaomi 官方发布的应用包,或前往 \"HyperCeiler 设置-开发者选项-调试模式\" 指定挂载版本后重试。 当前目标作用域正处于调试模式,若无必要开启请前往关闭。\n当前应用版本:%1$s\n选择目标版本:%2$s\n是否成功挂钩:%3$s 调试版本 + + 重启 + 要立即重启%1$s和%2$s吗? + 立即重启 diff --git a/library/core/src/main/res/values-zh-rHK/strings.xml b/library/core/src/main/res/values-zh-rHK/strings.xml index 8542e8e06c..5b3612e674 100644 --- a/library/core/src/main/res/values-zh-rHK/strings.xml +++ b/library/core/src/main/res/values-zh-rHK/strings.xml @@ -94,4 +94,8 @@ 搜尋 %d 個應用 加載應用程式列表失敗 此功能可能不支持此裝置或隱藏到部分選項下 + + 重新啟動 + 要立即重新啟動%1$s和%2$s嗎? + 立即重新啟動 diff --git a/library/core/src/main/res/values-zh-rME/strings.xml b/library/core/src/main/res/values-zh-rME/strings.xml index 3ffd891885..ffb9808e81 100644 --- a/library/core/src/main/res/values-zh-rME/strings.xml +++ b/library/core/src/main/res/values-zh-rME/strings.xml @@ -44,4 +44,8 @@ 今日无事可做?\n 你可以选择为 HyperCeiler 点一支蜡烛并祝 HyperCeiler 生日快乐! 进程\"System UI\" + + 重启 + 要立即重启%1$s和%2$s吗? + 立即重启 diff --git a/library/core/src/main/res/values-zh-rTW/strings.xml b/library/core/src/main/res/values-zh-rTW/strings.xml index 55c43a1090..2d7eb514a4 100644 --- a/library/core/src/main/res/values-zh-rTW/strings.xml +++ b/library/core/src/main/res/values-zh-rTW/strings.xml @@ -90,4 +90,8 @@ 當前目標作用域來源可能並不是 Xiaomi 官方,出於安全考量,已停止載入此作用域的所有功能,請嘗試更改為 Xiaomi 官方發布的應用包,或前往「HyperCeiler 設定-開發者選項-除錯模式」指定掛載版本後重試。 當前目標作用域正處於除錯模式,若無必要開啟請前往關閉。\n當前應用版本:%1$s\n選擇目標版本:%2$s\n是否成功掛鉤:%3$s 調試版本 + + 重啟 + 要立即重啟%1$s和%2$s嗎? + 立即重啟 diff --git a/library/core/src/main/res/values/strings.xml b/library/core/src/main/res/values/strings.xml index c1bb96418d..07906eeb54 100644 --- a/library/core/src/main/res/values/strings.xml +++ b/library/core/src/main/res/values/strings.xml @@ -96,5 +96,9 @@ The current target scope source may not be official Xiaomi. For security reasons, all functions of this scope have been disabled. Please try switching to an app package released by official Xiaomi, or go to "HyperCeiler Settings - Developer options - Debug mode" to specify the mounted version and try again. The current target scope is in debug mode. If not necessary, please go and turn it off.\nCurrent app version: %1$s\nSelected target version: %2$s\nSuccessfully hooked: %3$s Debug version + + Restart + Do you want to restart %1$s and %2$s now? + Restart now diff --git a/library/libhook/src/main/java/com/sevtinge/hyperceiler/libhook/app/SystemUI/SystemUIB.java b/library/libhook/src/main/java/com/sevtinge/hyperceiler/libhook/app/SystemUI/SystemUIB.java index 8c17f863e3..5de8fa1fd6 100644 --- a/library/libhook/src/main/java/com/sevtinge/hyperceiler/libhook/app/SystemUI/SystemUIB.java +++ b/library/libhook/src/main/java/com/sevtinge/hyperceiler/libhook/app/SystemUI/SystemUIB.java @@ -64,6 +64,7 @@ import com.sevtinge.hyperceiler.libhook.rules.systemui.lockscreen.LockScreenDoubleTapToSleep; import com.sevtinge.hyperceiler.libhook.rules.systemui.lockscreen.NotificationShowOnKeyguard; import com.sevtinge.hyperceiler.libhook.rules.systemui.lockscreen.ScramblePIN; +import com.sevtinge.hyperceiler.libhook.rules.home.navigation.HideNavigationBar; import com.sevtinge.hyperceiler.libhook.rules.systemui.navigation.RotationButtonB; import com.sevtinge.hyperceiler.libhook.rules.systemui.other.AutoSEffSwitchForSystemUi; import com.sevtinge.hyperceiler.libhook.rules.systemui.other.BrightnessPct; @@ -168,6 +169,7 @@ public void onPackageLoaded() { initHook(HideStrongToast.INSTANCE, PrefsBridge.getBoolean("system_ui_status_bar_hide_smart_strong_toast")); // 导航栏 + initHook(new HideNavigationBar(), PrefsBridge.getBoolean("system_ui_hide_navigation_bar")); initHook(RotationButtonB.INSTANCE, PrefsBridge.getStringAsInt("system_framework_other_rotation_button_int", 0) != 0); // 控制与通知中心 diff --git a/library/libhook/src/main/java/com/sevtinge/hyperceiler/libhook/rules/home/navigation/HideNavigationBar.java b/library/libhook/src/main/java/com/sevtinge/hyperceiler/libhook/rules/home/navigation/HideNavigationBar.java index 14c9e1da51..5b165efea6 100644 --- a/library/libhook/src/main/java/com/sevtinge/hyperceiler/libhook/rules/home/navigation/HideNavigationBar.java +++ b/library/libhook/src/main/java/com/sevtinge/hyperceiler/libhook/rules/home/navigation/HideNavigationBar.java @@ -18,13 +18,17 @@ */ package com.sevtinge.hyperceiler.libhook.rules.home.navigation; +import static com.sevtinge.hyperceiler.libhook.utils.api.DeviceHelper.System.isMoreAndroidVersion; +import static com.sevtinge.hyperceiler.libhook.utils.api.DeviceHelper.System.isMoreHyperOSVersion; import static com.sevtinge.hyperceiler.libhook.utils.hookapi.tool.EzxHelpUtils.getBooleanField; import static com.sevtinge.hyperceiler.libhook.utils.hookapi.tool.EzxHelpUtils.setBooleanField; +import android.graphics.Canvas; import android.provider.Settings; import android.view.MotionEvent; import android.view.View; +import com.sevtinge.hyperceiler.common.log.XposedLog; import com.sevtinge.hyperceiler.libhook.base.BaseHook; import com.sevtinge.hyperceiler.libhook.callback.IMethodHook; @@ -33,43 +37,73 @@ public class HideNavigationBar extends BaseHook { @Override public void init() { - findAndHookMethod("com.miui.home.recents.views.RecentsContainer", "showLandscapeOverviewGestureView", boolean.class, - new IMethodHook() { + if (isMoreAndroidVersion(36) && isMoreHyperOSVersion(3.0f)) { + // >= Android 16 & >= HyperOS 3.0+: 使用 onDraw Hook 隐藏方案 + // 尝试从 systemui 主进程查找类 + Class bottomViewClass = findClassIfExists("com.android.wm.shell.multitasking.miuimultiwinswitch.miuiwindowdecor.decoration.MiuiDecorationBottomView"); + // 尝试从 systemui 插件中查找类 + if (bottomViewClass == null) { + bottomViewClass = findClassIfExists("miui.systemui.plugin.MiuiDecorationBottomView"); + } + if (bottomViewClass == null) { + XposedLog.w(TAG, getPackageName(), "MiuiDecorationBottomView class not found"); + return; + } + XposedLog.d(TAG, "bottomViewClass founded"); + try { + findAndHookMethod(bottomViewClass, "onDraw", Canvas.class, new IMethodHook() { + @Override + public void before(HookParam param) { + try { + // 跳过原始绘制逻辑,隐藏手势提示线 + param.setResult(null); + XposedLog.d(TAG, "bottomViewClass hide done"); + } catch (Throwable t) { + XposedLog.w(TAG, getPackageName(), "HideNavigationBar before error", t); + } + } + }); + } catch (Throwable t) { + XposedLog.e(TAG, getPackageName(), "Hook MiuiDecorationBottomView.onDraw failed", t); + } + } else { + // < Android 16 或 < HyperOS 3.0+: 使用旧的资源替换方案 + findAndHookMethod("com.miui.home.recents.views.RecentsContainer", "showLandscapeOverviewGestureView", boolean.class, + new IMethodHook() { + @Override + public void before(HookParam param) { + param.setResult(null); + } + }); + + findAndHookMethod("com.miui.home.recents.NavStubView", "isMistakeTouch", new IMethodHook() { @Override public void before(HookParam param) { - param.setResult(null); + View navView = (View) param.getThisObject(); + boolean setting = Settings.Global.getInt(navView.getContext().getContentResolver(), "show_mistake_touch_toast", 1) == 1; + boolean misTouch = (boolean) callMethod(param.getThisObject(), "isLandScapeActually"); + param.setResult(misTouch && setting); } }); - findAndHookMethod("com.miui.home.recents.NavStubView", "isMistakeTouch", new IMethodHook() { - @Override - public void before(HookParam param) { - View navView = (View) param.getThisObject(); - boolean setting = Settings.Global.getInt(navView.getContext().getContentResolver(), "show_mistake_touch_toast", 1) == 1; - boolean misTouch = (boolean) callMethod(param.getThisObject(), "isLandScapeActually"); - param.setResult(misTouch && setting); - } - }); - - findAndHookMethod("com.miui.home.recents.NavStubView", "onPointerEvent", MotionEvent.class, new IMethodHook() { - @Override - public void before(HookParam param) { - boolean mIsInFsMode = getBooleanField(param.getThisObject(), "mIsInFsMode"); - MotionEvent motionEvent = (MotionEvent) param.getArgs()[0]; - if (!mIsInFsMode) { - if (motionEvent.getAction() == 0) { + findAndHookMethod("com.miui.home.recents.NavStubView", "onPointerEvent", MotionEvent.class, new IMethodHook() { + @Override + public void before(HookParam param) { + boolean mIsInFsMode = getBooleanField(param.getThisObject(), "mIsInFsMode"); + MotionEvent motionEvent = (MotionEvent) param.getArgs()[0]; + if (!mIsInFsMode && motionEvent != null && motionEvent.getAction() == 0) { setBooleanField(param.getThisObject(), "mHideGestureLine", true); } } - } - }); + }); - findAndHookMethod("com.miui.home.recents.NavStubView", "updateScreenSize", new IMethodHook() { - @Override - public void before(HookParam param) { - setBooleanField(param.getThisObject(), "mHideGestureLine", false); - } - }); + findAndHookMethod("com.miui.home.recents.NavStubView", "updateScreenSize", new IMethodHook() { + @Override + public void before(HookParam param) { + setBooleanField(param.getThisObject(), "mHideGestureLine", false); + } + }); + } } }