一、修改framework-res.apk
1、反编译后添加三张图片到res\drawable-hdpi\目录下。
2、打开res\values\strings.xml,在最下面添加:
<string name="reboot">Reboot</string> <string name="recovery">Recovery</string> <string name="bootloader">Bootloader</string>
<string name="reboot">重启手机</string> <string name="recovery">恢复模式</string> <string name="bootloader">工程模式</string>
二、修改android.policy.jar
1、打开com\android\internal\policy\impl\GlobalActions.smali文件,在
.method private createDialog()Landroid/app/AlertDialog;
范围内(电源选项)查找
[Lcom/android/internal/policy/impl/GlobalActions$Action;
找到后修改为:
const/4 v0, 0x4
new-array v0, v0, [Lcom/android/internal/policy/impl/GlobalActions$Action;
注:0x4表示电源选项中有4个菜单,可修改为自己需要的条目数量。
2、
const/4 v1, 0x0 new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$4; const v3,0x1080030# 所对应的图标 const v4,0x104011a# 所对应的文字 invoke-direct {v2, p0, v3, v4}, Lcom/android/internal/policy/impl/GlobalActions$4;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V aput-object v2, v0, v1
注:0x1080030在framework-res\res\values\public.xml中所对应的数值为:0x01080030。
一般修改的话复制关机的那条命令修改,修改的地方为上面代码红色部分。
3、这段代码最后总的结尾为:
invoke-static {v0}, Lcom/google/android/collect/Lists;->newArrayList([Ljava/lang/Object;)Ljava/util/ArrayList; move-result-object v0 iput-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;
invoke-static {v0, v1}, Lcom/android/internal/app/ShutdownThread;->shutdown(Landroid/content/Context;Z)V
修改为: (重启)
const-string v2, "now"
invoke-static {v0, v2, v1}, Lcom/android/internal/app/ShutdownThread;->reboot(Landroid/content/Context;Ljava/lang/String;Z)V
修改为: (重启到recovery)
const-string v2, "recovery"
invoke-static {v0, v2, v1}, Lcom/android/internal/app/ShutdownThread;->reboot(Landroid/content/Context;Ljava/lang/String;Z)V
修改为: (重启到bootloader)
const-string v2, "bootloader"
invoke-static {v0, v2, v1}, Lcom/android/internal/app/ShutdownThread;->reboot(Landroid/content/Context;Ljava/lang/String;Z)V