要求:手机已root,MT管理器准备好。
*建议使用magisk模块挂载文件,更安全。
效果图
第一步
下载高级电源菜单文件:
https://wws.lanzous.com/ifu8og2b5wb
(记得重命名文件为powermenu)
把/system/media/theme/default/powermenu文件替换掉
第二步
MT管理器打开/system/framework/services.jar
用dex编辑器++打开services.jar里面的dex文件(有两个dex文件就一起勾选打开)。
进入里面搜索.method public onCommand(Ljava/lang/String;Ljava/lang/Double;Ljava/lang/String;)V
找到以后将该函数整个替换。以下是替换后的代码:
.method public onCommand(Ljava/lang/String;Ljava/lang/Double;Ljava/lang/String;)V
.registers 8
.param p1, "command" # Ljava/lang/String;
.param p2, "para1" # Ljava/lang/Double;
.param p3, "para2" # Ljava/lang/String;
.prologue
const/4 v1, 0x0
const-string v0, "airplane"
invoke-virtual {v0, p1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_11
iget-object v0, p0, Lcom/android/server/policy/MiuiGlobalActions$1;->this$0:Lcom/android/server/policy/MiuiGlobalActions;
const/16 v1, 0x9
invoke-static {v0, v1}, Lcom/android/server/policy/MiuiGlobalActions;->access$000(Lcom/android/server/policy/MiuiGlobalActions;I)V
:cond_10
:goto_10
return-void
:cond_11
const-string/jumbo v0, "silent"
invoke-virtual {v0, p1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_21
iget-object v0, p0, Lcom/android/server/policy/MiuiGlobalActions$1;->this$0:Lcom/android/server/policy/MiuiGlobalActions;
const/4 v1, 0x5
invoke-static {v0, v1}, Lcom/android/server/policy/MiuiGlobalActions;->access$000(Lcom/android/server/policy/MiuiGlobalActions;I)V
goto :goto_10
:cond_21
const-string/jumbo v0, "reboot"
invoke-virtual {v0, p1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_37
:try_start_2a
invoke-static {}, Lcom/android/server/policy/MiuiGlobalActions;->access$100()Landroid/os/IPowerManager;
move-result-object v0
const/4 v1, 0x0
const/4 v2, 0x0
const/4 v3, 0x0
invoke-interface {v0, v1, v2, v3}, Landroid/os/IPowerManager;->reboot(ZLjava/lang/String;Z)V
:try_end_34
.catch Landroid/os/RemoteException; {:try_start_2a .. :try_end_34} :catch_35
goto :goto_10
:catch_35
move-exception v0
goto :goto_10
:cond_37
const-string/jumbo v0, "recovery"
invoke-virtual {v0, p1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_4f
:try_start_40
invoke-static {}, Lcom/android/server/policy/MiuiGlobalActions;->access$100()Landroid/os/IPowerManager;
move-result-object v0
const/4 v1, 0x0
const-string/jumbo v2, "recovery"
const/4 v3, 0x0
invoke-interface {v0, v1, v2, v3}, Landroid/os/IPowerManager;->reboot(ZLjava/lang/String;Z)V
:try_end_4c
.catch Landroid/os/RemoteException; {:try_start_40 .. :try_end_4c} :catch_4d
goto :goto_10
:catch_4d
move-exception v0
goto :goto_10
:cond_4f
const-string v0, "bootloader"
invoke-virtual {v0, p1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_65
:try_start_57
invoke-static {}, Lcom/android/server/policy/MiuiGlobalActions;->access$100()Landroid/os/IPowerManager;
move-result-object v0
const/4 v1, 0x0
const-string v2, "bootloader"
const/4 v3, 0x0
invoke-interface {v0, v1, v2, v3}, Landroid/os/IPowerManager;->reboot(ZLjava/lang/String;Z)V
:try_end_62
.catch Landroid/os/RemoteException; {:try_start_57 .. :try_end_62} :catch_63
goto :goto_10
:catch_63
move-exception v0
goto :goto_10
:cond_65
const-string/jumbo v0, "shutdown"
invoke-virtual {v0, p1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_79
new-instance v0, Lcom/android/server/policy/MiuiGlobalActions$1$1;
const-string v1, "ShutdownThread"
invoke-direct {v0, p0, v1}, Lcom/android/server/policy/MiuiGlobalActions$1$1;-><init>(Lcom/android/server/policy/MiuiGlobalActions$1;Ljava/lang/String;)V
invoke-virtual {v0}, Lcom/android/server/policy/MiuiGlobalActions$1$1;->start()V
goto :goto_10
:cond_79
const-string v0, "dismiss"
invoke-virtual {v0, p1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_10
iget-object v0, p0, Lcom/android/server/policy/MiuiGlobalActions$1;->this$0:Lcom/android/server/policy/MiuiGlobalActions;
invoke-static {v0}, Lcom/android/server/policy/MiuiGlobalActions;->access$200(Lcom/android/server/policy/MiuiGlobalActions;)Landroid/os/Handler;
move-result-object v0
invoke-virtual {v0, v1}, Landroid/os/Handler;->sendEmptyMessage(I)Z
goto :goto_10
.end method
然后保存并退出,重启手机即可。