[Sprint Samsung Galaxy S 4 Android Development] DarkAngel:
I had posted this in a PM to another member and thought it may help others as well.

Please feel free to correct me in anything I may have stated incorrectly.

==============================================================================

I put this together on a whim so bare with me......I did use some excerpts from the main thread here but modified it some to include the information for NG2.

Original Thread here: http://xdaforums.com/showpost.php?p=47555330&postcount=2

Okay at this point you stated you can smali, backsmali your own files which is great. I also use Note++ to open the smali files for modification unless you use

another program. From this point it will be a breeze for me to just state the facts from here on.......

Download the following resources files (GlobalActions$99$1.smali, GlobalActions$99$2.smali, GlobalActions$99.smali) [New: new patched resources for

non-working hot reboot option, download newPatchedResources]. These are the Original files if you need them.

Old Resource Files: http://www.mediafire.com/?6atf45l77q2dm5k

New Patched Resource Files: http://www.mediafire.com/?3rb893nzgjhj93n

This is the link for the zip of all the smali files that were modified. Uploaded to my GDrive :

https://docs.google.com/file/d/0B77dgB0lHYfiYTJIWDRITTZSbkE/edit?usp=docslist_api

Now like you asked, one will need to baksmali android.policy.jar with your desired program. I just use ROMToolsPCv3 as I just decompile the classes.dex file

only. I just open the jar file with 7-zip and pull only the classes.dex file and decompile it.

Okay once decompiled, open the classout folder and go to \com\android\internal\policy\impl where all the other GolbalActions$ smali's are located and paste

the three resource files I zipped for you there (GlobalActions$99$1.smali, GlobalActions$99$2.smali and GlobalActions$99), recompile and call it a day.....unless you want to modify the originals

above linked yourself ( New Resource Files) then continue reading below.

Open the GlobalActions.smali and change the GlobalActions$8 text to GlobalActions$99on both lines you see, and save it. You can easily find

it by searching for " mRestart ". Example of the code is below which can also be copied and pasted if you like.

[B][COLOR=royalblue]from this[/COLOR][/B]

.line 891
new-instance v0, Lcom/android/internal/policy/impl/GlobalActions$[COLOR=royalblue]8[/COLOR];

const v1, 0x10809b8

const v2, 0x10401d6

invoke-direct {v0, p0, v1, v2}, Lcom/android/internal/policy/impl/GlobalActions$[COLOR=#4169e1]8[/COLOR];-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V

iput-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mRestart:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;

[B][COLOR=royalblue]to this[/COLOR][/B]

.line 891
new-instance v0, Lcom/android/internal/policy/impl/GlobalActions$[COLOR=royalblue]99[/COLOR];

const v1, 0x10809b8

const v2, 0x10401d6

invoke-direct {v0, p0, v1, v2}, Lcom/android/internal/policy/impl/GlobalActions$[COLOR=royalblue]99[/COLOR];-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V

iput-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mRestart:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;

Now open GlobalActions$SinglePressAction.smali. Just between line ".end annotation" and "# instance fields", place your cursor and hit enter 2 times

to make room (i.e leave 2 lines empty above "# instance fields" and 2 lines bellow ".end annotation") to paste the code below (Blue one only).

[B][COLOR=red].end annotation[/COLOR][/B]

[COLOR=royalblue][B]# static fields[/B][/COLOR]
[COLOR=royalblue][B].field protected static rebootMode:I[/B][/COLOR]

[COLOR=royalblue][B].field protected static final rebootOptions:[Ljava/lang/String;[/B][/COLOR]

[B][COLOR=red]# instance fields[/COLOR][/B]

While your still in GlobalActions$SinglePressAction.smali, look for the code "# direct methods" and paste the code bellow (Blue one only):

[B][COLOR=red]# direct methods[/COLOR][/B]
[COLOR=royalblue][B].method static constructor <clinit>()V[/B][/COLOR]
[COLOR=royalblue][B] .registers 3[/B][/COLOR]

[COLOR=royalblue][B] const/4 v0, 0x4[/B][/COLOR]

[COLOR=royalblue][B] new-array v0, v0, [Ljava/lang/String;[/B][/COLOR]

[COLOR=royalblue][B] const/4 v1, 0x0[/B][/COLOR]

[COLOR=royalblue][B] const-string v2, "Reboot"[/B][/COLOR]

[COLOR=royalblue][B] aput-object v2, v0, v1[/B][/COLOR]

[COLOR=royalblue][B] const/4 v1, 0x1[/B][/COLOR]

[COLOR=royalblue][B] const-string v2, "Hot Reboot"[/B][/COLOR]

[COLOR=royalblue][B] aput-object v2, v0, v1[/B][/COLOR]

[COLOR=royalblue][B] const/4 v1, 0x2[/B][/COLOR]

[COLOR=royalblue][B] const-string v2, "Download"[/B][/COLOR]

[COLOR=royalblue][B] aput-object v2, v0, v1[/B][/COLOR]

[COLOR=royalblue][B] const/4 v1, 0x3[/B][/COLOR]

[COLOR=royalblue][B] const-string v2, "Recovery"[/B][/COLOR]

[COLOR=royalblue][B] aput-object v2, v0, v1[/B][/COLOR]

[COLOR=royalblue][B] sput-object v0, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;->rebootOptions:[Ljava/lang/String;[/B][/COLOR]

[COLOR=royalblue][B] return-void[/B][/COLOR]
[COLOR=royalblue][B].end method[/B][/COLOR]

[B][COLOR=red].method protected constructor <init>(II)V[/COLOR][/B]

Once done, Recompile (smali) your jar or the classes.dex file, which ever method you had done or prefer. If only doing the classes.dex file, you would only need to copy the modified file into the jar file overwriting the original one.

============================================

Additionally.....

If you want to change the "Extended Reboot Menu"

text

on top of the popup menu to what ever you like:

- Open the GlobalActions$99.smali you had pasted from the beginning and go to the following code below and make your change.

(Also.... if you delete this entire code, you will disable the head title of "Extended Reboot Menu")

const-string v2, "Extended Reboot Menu"

invoke-virtual {v1, v2}, Landroid/app/AlertDialog$Builder;->setTitle(Ljava/lang/CharSequence;)Landroid/app/AlertDialog$Builder;

move-result-object v1

Also I did not have to change the access$xx or id's as I believe they were coincidentally the same........ I believe........ I just can't remember. To check

just do as it states at the bottom. I hope all this helps. Let me know if you still have questions......

If you are porting to other device, please make sure in GlobalActions$99.smali whether Landroid/content/context has the same access$xx as same in GlobalActions.smali or change it to be like the one in GlobalActions.smali. Also make sure the following ids in GlobalActions$99.smali are pointed to the correct ids in framework-res.apk:

0x104000a = 0x0104000a = "string" name="ok"

0x104 = 0x01040000 = "string" name="cancel"