Modify add friendly root permission access fail tips in SystemUITool

This commit is contained in:
2023-01-28 00:15:25 +08:00
parent 0e435cf0e1
commit ec3f07791b

View File

@@ -66,7 +66,16 @@ object SystemUITool {
* 重启系统界面
* @param context 实例
*/
fun restartSystemUI(context: Context) =
fun restartSystemUI(context: Context) {
/** 当 Root 权限获取失败时显示对话框 */
fun showWhenAccessRootFail() =
context.showDialog {
title = "获取 Root 权限失败"
msg = "当前无法获取 Root 权限,请确认你的设备已经被 Root 且同意授予 Root 权限。\n" +
"如果你正在使用 Magisk 并安装了 Shamiko 模块," +
"请确认当前是否正处于白名单模式。 (白名单模式将导致无法申请 Root 权限)"
confirmButton(text = "我知道了")
}
context.showDialog {
title = "重启系统界面"
msg = "你确定要立即重启系统界面吗?\n\n" +
@@ -76,11 +85,12 @@ object SystemUITool {
execShell(cmd = "pgrep systemui").also { pid ->
if (pid.isNotBlank())
execShell(cmd = "kill -9 $pid")
else toast(msg = "ROOT 权限获取失败")
else showWhenAccessRootFail()
}
}
cancelButton()
}
}
/**
* 刷新系统界面状态栏与通知图标