反编译framework-res.apk
添加:
res\values\strings.xml
<string name="reboot">重启</string>
res\drawable-***\
laoli_reboot.png
回编译后重新反编译。
打开res\values\public.xml
记住两个ID
<public type="string" name="reboot"
<public type="drawable" name="laoli_reboot"
反编译 android.policy.jar
打开com\android\internal\policy\impl\GlobalActions.smali
查找 new-array v0, v0, [Lcom/android/internal/policy/impl/GlobalActions$Action;
改上面的const/4 v0, 0x3 选项中有3个菜单,我们要增加一个。
改为const/4 v0, 0x4
查找 invoke-static {v0}, Lcom/google/android/collect/Lists;->newArrayList([Ljava/lang/Object;)Ljava/util/ArrayList;
记住上面的GlobalActions$值是多少,我是GlobalActions$3
在 invoke-static {v0}, Lcom/google/android/collect/Lists;->newArrayList([Ljava/lang/Object;)Ljava/util/ArrayList; 上面添加
const/4 v1, 0x3
new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$999;
const v3, 0x10803eb
const v4, 0x104042d
invoke-direct {v2, p0, v3, v4}, Lcom/android/internal/policy/impl/GlobalActions$999;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
aput-object v2, v0, v1
3是4-1
然后把GlobalActions$3.smali复制一份改为GlobalActions$999.smali
打开GlobalActions$999.smali把里面的GlobalActions$3全部替换为GlobalActions$999
把 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
回编译...替换进手机