This is just a quick how to. Spend a few hours writing this yesterday (see - post and post.) The GlobalActions$SinglePressAction.smali part is from Cristiano Matos Thanks bro! The rest I put together from trail and error. Feel free to use it, a thanks and some credit would be cool. Enjoy. Also huge shout out to my team mate @Mr Impossible for fixing my error. Thanks Bro!!
Flashable zip - http://d-h.st/Hnt
For developers, if you would like to see the diff you can see them on my github:
First you need to decompile the framework-res.apk and navigate and open res/values/layouts.xml and add this to the bottom.
This will fix the compile error that you get from the stock framework-res.
Now you need to add the strings and the icon for reboot since stock there are none. Navigate to res/values/strings.xml and add
Now you need to add the icon to res/drawable-xhdpi/ic_lock_reboot.png (I will attach it later). Now compile the framework-res.apk then decompile it again. We do this so the apktool will add these to the public.xml and assign ID's to them that we will need later. You can put the new compiled framework aside to add to your ROM later.
Now we will move to the android.policy.jar. You will need decompile the classout. Now go to classout/com/android/internal/policy/impl/GlobalActions.smali and find
Also pro tip: ID's for apps will be in this format 0x01080c11 and in the android.policy.jar is 0x1080c11. Notice that in the android.policy.jar the 0 after the x is removed. 0x01080c11. So when you are comparing remove the 0 if pulling from the public.xml or if you if you are taking from the android.policy.jar you will need to add it to match up.
This part is from Cristiano Matos Thanks bro!
classout/com/android/internal/policy/impl/GlobalActions$SinglePressAction.smali
Find this
And between .end annotation and # instance fields, add this
Find this
And between # direct methods and .method protected constructor <init>(II)V, add this
Last you need to add the files GlobalActions$99.smali, GlobalActions$99$1.smali, and GlobalActions$99$2.smali to Classout/com/android/internal/policy/impl then recomplie the Classout.
Flashable zip - http://d-h.st/Hnt
For developers, if you would like to see the diff you can see them on my github:
First you need to decompile the framework-res.apk and navigate and open res/values/layouts.xml and add this to the bottom.
Code:
<item type="layout" name="keyguard_transport_control">false</item>
Now you need to add the strings and the icon for reboot since stock there are none. Navigate to res/values/strings.xml and add
Code:
<string name="reboot">Reboot menu</string>
Now we will move to the android.policy.jar. You will need decompile the classout. Now go to classout/com/android/internal/policy/impl/GlobalActions.smali and find
Code:
invoke-virtual {v0, v1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
iget-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;
iget-object v1, p0, Lcom/android/internal/policy/impl/GlobalActions;->mAirplaneModeOn:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;
invoke-virtual {v0, v1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
Code:
invoke-virtual {v0, v1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
[COLOR="Blue"]+
+ new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$99;
+
+ const v2, 0x1080c11 (This is the ID for the Ic_lock_reboot we added to framework-res. add yours)
+
+ const v3, 0x10408eb (this is the String ID for reboot)
+
+ invoke-direct {v1, p0, v2, v3}, Lcom/android/internal/policy/impl/GlobalActions$99;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
+
+ invoke-virtual {v0, v1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
+[/COLOR]
iget-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;
iget-object v1, p0, Lcom/android/internal/policy/impl/GlobalActions;->mAirplaneModeOn:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;
invoke-virtual {v0, v1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
Also pro tip: ID's for apps will be in this format 0x01080c11 and in the android.policy.jar is 0x1080c11. Notice that in the android.policy.jar the 0 after the x is removed. 0x01080c11. So when you are comparing remove the 0 if pulling from the public.xml or if you if you are taking from the android.policy.jar you will need to add it to match up.
This part is from Cristiano Matos Thanks bro!
classout/com/android/internal/policy/impl/GlobalActions$SinglePressAction.smali
Find this
Code:
.end annotation
# instance fields
.field private final mIconResId:I
.field private final mMessage:Ljava/lang/CharSequence;
.field private final mMessageResId:I
And between .end annotation and # instance fields, add this
Code:
[COLOR="Blue"]# static fields
.field protected static rebootMode:I
.field protected static final rebootOptions:[Ljava/lang/String;[/COLOR]
Find this
Code:
# direct methods
.method protected constructor <init>(II)V
.registers 4
.parameter "iconResId"
.parameter "messageResId"
And between # direct methods and .method protected constructor <init>(II)V, add this
Code:
[COLOR="Blue"].method static constructor <clinit>()V
.registers 3
const/4 v0, 0x3
new-array v0, v0, [Ljava/lang/String;
const/4 v1, 0x0
const-string v2, "Reboot"
aput-object v2, v0, v1
const/4 v1, 0x1
const-string v2, "Download"
aput-object v2, v0, v1
const/4 v1, 0x2
const-string v2, "Recovery"
aput-object v2, v0, v1
sput-object v0, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;->rebootOptions:[Ljava/lang/String;
return-void
.end method[/COLOR]
Last you need to add the files GlobalActions$99.smali, GlobalActions$99$1.smali, and GlobalActions$99$2.smali to Classout/com/android/internal/policy/impl then recomplie the Classout.
Attachments
Last edited: