• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

[DEV] [MOD] [HOW-TO] 4-1 Reboot MOD on LG8 Based Sprint ROMS [MOD]

Search This thread

clark44

Senior Member
Mar 31, 2011
2,863
6,997
East Lansing
Hey everyone! In response to sudden events i am deciding to make tutorials for all my MODS for interested DEVS. Here is the 4-1 reboot MOD :)

First decompile the smali in the android.policy.jar file

Download the following zip containing needed smali files for the MOD. Place the files in: \com\android\internal\policy\impl\

Next edit the following smali file: \com\android\internal\policy\impl\GlobalActions$SinglePressAction.smali

Now edit the following code:

Code:
.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x40a
    name = "SinglePressAction"
.end annotation


[COLOR="Green"]++# static fields
.field protected static rebootMode:I

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


# instance fields
.field private final mIconResId:I

.field private final mMessageResId:I


# direct methods
[COLOR="Green"]++.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]
.method protected constructor <init>(II)V
    .registers 3
    .parameter "iconResId"
    .parameter "messageResId"

Next edit the following smali: \com\android\internal\policy\impl\GlobalActions.smali (Removed anything in red and add anything in green)

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

    .line 392
[COLOR="Red"]--  new-instance v0, Lcom/android/internal/policy/impl/GlobalActions$6;
[/COLOR][COLOR="Green"]++  new-instance v0, Lcom/android/internal/policy/impl/GlobalActions$99;
[/COLOR]    const v1, 0x10807e1

    const v2, 0x1040169

[COLOR="Red"]--  invoke-direct {v0, p0, v1, v2}, Lcom/android/internal/policy/impl/GlobalActions$6;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
[/COLOR][COLOR="Green"]++  invoke-direct {v0, p0, v1, v2}, Lcom/android/internal/policy/impl/GlobalActions$99;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V[/COLOR]
    iput-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mRestart:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;

    .line 413
    const/4 v0, 0x6

Recompile the smali and push android.policy.jar back into /system/framework/

Have fun :)
 
Last edited:

6uPMAH

Senior Member
Jan 6, 2010
157
54
Miami
I gave this MOD a go, and... got stuck at reboot screen. Looks like a straight forward edit. I must be missing something. Do I need to keep the "++" in the code, or is that just a label for "add this line"?

UPDATE: Nevermind. A total brain freeze on my part. I decompiled and recompiled android.policy.jar, not classes.dex inside it... Duh! Anyway, works as advertised. The reboot options appear when you choose "Restart". Thanks, OP. Sweet edit.
 
Last edited:

6uPMAH

Senior Member
Jan 6, 2010
157
54
Miami
Here's a copy of the modded file. Just rename it to andoid.policy.jar and push it to /system/framework. This file is stock and has no other mods besides Reboot. If the ROM you're running now has any other MODs built into the file, this will overwrite them.
 

Attachments

  • MODDED_android.policy.jar
    288.9 KB · Views: 98
  • Like
Reactions: zeron89 and Bizdady

Bizdady

Senior Member
Jul 24, 2010
2,355
569
818
Here's a copy of the modded file. Just rename it to andoid.policy.jar and push it to /system/framework. This file is stock and has no other mods besides Reboot. If the ROM you're running now has any other MODs built into the file, this will overwrite them.

Thanks! Ill make sure to save this for my stock rom. Im running CM10 at the moment but this will sure come in handy in a few days once the camera bug really annoys me lol
 

Optimal Carnage

Senior Member
Nov 5, 2010
300
39
Cleveland, OH
Here's a copy of the modded file. Just rename it to andoid.policy.jar and push it to /system/framework. This file is stock and has no other mods besides Reboot. If the ROM you're running now has any other MODs built into the file, this will overwrite them.

Is this for a deodexed Rom? I copied the file to system/framework and renamed the original android.policy.bak and the modded file to android.policy.jar restarted but there's no reboot option just restart

Sent from my SPH-L710 using xda premium

---------- Post added at 03:20 PM ---------- Previous post was at 03:17 PM ----------

Is this for a deodexed Rom? I copied the file to system/framework and renamed the original android.policy.bak and the modded file to android.policy.jar restarted but there's no reboot option just restart

Sent from my SPH-L710 using xda premium

I'm guessing I need to also do the edits you spoke of in red or green also...not so good with decompiling and recompiling I guess I'll have to wait on a flashable zip

Sent from my SPH-L710 using xda premium
 

6uPMAH

Senior Member
Jan 6, 2010
157
54
Miami
When you click Restart, reboot options open in a separate pop-up window.

reboot1.png


reboot2.png
 
Last edited:

6uPMAH

Senior Member
Jan 6, 2010
157
54
Miami
Yeah but I didn't do the edits we said in the being of the post do I not need to if I just push the file to system/framework? When I click restart it just asks me to confirm...no additional pop-up window

Sent from my SPH-L710 using xda premium

Yeah, the file I posted has the edits in it...Weird. Unless I posted the unmodded file by mistake.:rolleyes: Try this one.
 

Attachments

  • android.policy.jar
    288.9 KB · Views: 19

Top Liked Posts

  • There are no posts matching your filters.
  • 26
    Hey everyone! In response to sudden events i am deciding to make tutorials for all my MODS for interested DEVS. Here is the 4-1 reboot MOD :)

    First decompile the smali in the android.policy.jar file

    Download the following zip containing needed smali files for the MOD. Place the files in: \com\android\internal\policy\impl\

    Next edit the following smali file: \com\android\internal\policy\impl\GlobalActions$SinglePressAction.smali

    Now edit the following code:

    Code:
    .annotation system Ldalvik/annotation/InnerClass;
        accessFlags = 0x40a
        name = "SinglePressAction"
    .end annotation
    
    
    [COLOR="Green"]++# static fields
    .field protected static rebootMode:I
    
    .field protected static final rebootOptions:[Ljava/lang/String;[/COLOR]
    
    
    # instance fields
    .field private final mIconResId:I
    
    .field private final mMessageResId:I
    
    
    # direct methods
    [COLOR="Green"]++.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]
    .method protected constructor <init>(II)V
        .registers 3
        .parameter "iconResId"
        .parameter "messageResId"

    Next edit the following smali: \com\android\internal\policy\impl\GlobalActions.smali (Removed anything in red and add anything in green)

    Code:
        iput-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mPowerOff:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
    
        .line 392
    [COLOR="Red"]--  new-instance v0, Lcom/android/internal/policy/impl/GlobalActions$6;
    [/COLOR][COLOR="Green"]++  new-instance v0, Lcom/android/internal/policy/impl/GlobalActions$99;
    [/COLOR]    const v1, 0x10807e1
    
        const v2, 0x1040169
    
    [COLOR="Red"]--  invoke-direct {v0, p0, v1, v2}, Lcom/android/internal/policy/impl/GlobalActions$6;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
    [/COLOR][COLOR="Green"]++  invoke-direct {v0, p0, v1, v2}, Lcom/android/internal/policy/impl/GlobalActions$99;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V[/COLOR]
        iput-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mRestart:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
    
        .line 413
        const/4 v0, 0x6

    Recompile the smali and push android.policy.jar back into /system/framework/

    Have fun :)
    4
    Thanks for posting this! I knew it was in android.policy not services.jar lol

    Sent from my SPH-L710 using xda premium

    No problem I'm just trying to help the community :)

    Sent from my SPH-L710 using Tapatalk 2
    2
    Here's a copy of the modded file. Just rename it to andoid.policy.jar and push it to /system/framework. This file is stock and has no other mods besides Reboot. If the ROM you're running now has any other MODs built into the file, this will overwrite them.
    2
    Updated the how-to and removed hot boot since it really doesn't work on our phones.
    2
    Ok, so here's another version of android.policy.jar with "Hot Boot" option (don't use it) and WORKING "Download". This was the original MOD that Clark44 later edited to remove "Hot Boot" because it wasn't working. For some reason that broke "Download". So... you can either have a non-working "Download" and no "Hot Boot", or the other way around. At least until Clark44 fixes it.