Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,806,279 Members 52,133 Now Online
XDA Developers Android and Mobile Development Forum

[MOD / How To][5/11/13] - Extended Reboot Menu - De-Odex - MDL

Tip us?
 
scrosler
Old
(Last edited by scrosler; 13th May 2013 at 11:19 PM.)
#1  
scrosler's Avatar
Recognized Developer - OP
Thanks Meter 51,644
Posts: 23,570
Join Date: Feb 2007
Location: Fargo

 
DONATE TO ME
Wink [MOD / How To][5/11/13] - Extended Reboot Menu - De-Odex - MDL

Reboot options as show

Pre-requisites
  • De-Odex'ed devices only! Will not work on stock ROM!
  • Must have the the MDL De-Odex mod by Nottach to use this mod!



Installation
  • I used similar install method as Nottach to apply this mod.
  • Download the attachment. Unzip it to your desktop.
  • Simply copy the "Mods" folder to your internal storage
  • Run the "Mod Me.bat" file after copying
  • It will copy the mod to the correct location, clear cache, then reboot phone.




Feel free to use this in any mod or ROM you make.

Hit Thanks!
Attached Thumbnails
Click image for larger version

Name:	Reboot.jpg
Views:	7973
Size:	20.8 KB
ID:	1953909  
Attached Files
File Type: zip Reboot Menu.zip - [Click for QR Code] (546.9 KB, 797 views)
File Type: zip Reboot Menu - Alt Install.zip - [Click for QR Code] (1,002.6 KB, 553 views)
The Following 23 Users Say Thank You to scrosler For This Useful Post: [ Click to Expand ]
 
scrosler
Old
(Last edited by scrosler; 13th May 2013 at 02:29 AM.)
#2  
scrosler's Avatar
Recognized Developer - OP
Thanks Meter 51,644
Posts: 23,570
Join Date: Feb 2007
Location: Fargo

 
DONATE TO ME
To make this mod your self or further modify it do the following;

First decompile classes.dex in android.policy.jar. I wont get into that part as this mini tutorial assumes you know how to modify smali code.




Add the following BOLD ITALIC code to \com\android\internal\policy\impl\GlobalActions$Si nglePressAction.smali

Modded Code:
Code:
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/android/internal/policy/impl/GlobalActions;
.end annotation

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

# static fields
.field protected static rebootMode:I

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


# instance fields
.field private final mIcon:Landroid/graphics/drawable/Drawable;

.field private final mIconResId:I

.field private final mMessage:Ljava/lang/CharSequence;

.field private final mMessageResId:I


# direct methods
.method static constructor <clinit>()V
    .registers 3

    const/4 v0, 0x4

    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, "Restart Shell"

    aput-object v2, v0, v1

    const/4 v1, 0x2

    const-string v2, "Download"

    aput-object v2, v0, v1

    const/4 v1, 0x3

    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

.method protected constructor <init>(II)V

FYI: You can change the string names to what you like best. For example most people word the second string as "Hot reboot" but I think that sounds lame so I call it what it is and that is a shell restart. Another example would be to change "Download" to "Download Mode"


Then change \com\android\internal\policy\impl\GlobalActions.sm ali

right below .line 566
new-instance v0, Lcom/android/internal/policy/impl/GlobalActions$5;
to
new-instance v0, Lcom/android/internal/policy/impl/GlobalActions$99;

Then create three smali files as shown below and add them to: \com\android\internal\policy\impl\



GlobalActions$99.smali
Code:
.class Lcom/android/internal/policy/impl/GlobalActions$99;
.super Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
.source "GlobalActions.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lcom/android/internal/policy/impl/GlobalActions;->createDialog()Landroid/app/AlertDialog;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation


# instance fields
.field final synthetic this$0:Lcom/android/internal/policy/impl/GlobalActions;


# direct methods
.method constructor <init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
    .registers 4

    iput-object p1, p0, Lcom/android/internal/policy/impl/GlobalActions$99;->this$0:Lcom/android/internal/policy/impl/GlobalActions;

    invoke-direct {p0, p2, p3}, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;-><init>(II)V

    return-void
.end method


# virtual methods
.method public onPress()V
    .registers 7

    const/4 v5, 0x4

    new-instance v1, Landroid/app/AlertDialog$Builder;

    iget-object v2, p0, Lcom/android/internal/policy/impl/GlobalActions$99;->this$0:Lcom/android/internal/policy/impl/GlobalActions;

    #getter for: Lcom/android/internal/policy/impl/GlobalActions;->mContext:Landroid/content/Context;
    invoke-static {v2}, Lcom/android/internal/policy/impl/GlobalActions;->access$000(Lcom/android/internal/policy/impl/GlobalActions;)Landroid/content/Context;

    move-result-object v2

    invoke-direct {v1, v2}, Landroid/app/AlertDialog$Builder;-><init>(Landroid/content/Context;)V

    const-string v2, "Reboot Menu"

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

    move-result-object v1

    sget-object v2, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;->rebootOptions:[Ljava/lang/String;

    const/4 v3, 0x0

    new-instance v4, Lcom/android/internal/policy/impl/GlobalActions$99$2;

    invoke-direct {v4, p0}, Lcom/android/internal/policy/impl/GlobalActions$99$2;-><init>(Lcom/android/internal/policy/impl/GlobalActions$99;)V

    invoke-virtual {v1, v2, v3, v4}, Landroid/app/AlertDialog$Builder;->setSingleChoiceItems([Ljava/lang/CharSequence;ILandroid/content/DialogInterface$OnClickListener;)Landroid/app/AlertDialog$Builder;

    move-result-object v1

    const v2, 0x104000a

    new-instance v3, Lcom/android/internal/policy/impl/GlobalActions$99$1;

    invoke-direct {v3, p0}, Lcom/android/internal/policy/impl/GlobalActions$99$1;-><init>(Lcom/android/internal/policy/impl/GlobalActions$99;)V

    invoke-virtual {v1, v2, v3}, Landroid/app/AlertDialog$Builder;->setPositiveButton(ILandroid/content/DialogInterface$OnClickListener;)Landroid/app/AlertDialog$Builder;

    move-result-object v1

    const/high16 v2, 0x104

    const/4 v3, 0x0

    invoke-virtual {v1, v2, v3}, Landroid/app/AlertDialog$Builder;->setNegativeButton(ILandroid/content/DialogInterface$OnClickListener;)Landroid/app/AlertDialog$Builder;

    move-result-object v1

    invoke-virtual {v1}, Landroid/app/AlertDialog$Builder;->create()Landroid/app/AlertDialog;

    move-result-object v0

    invoke-virtual {v0}, Landroid/app/AlertDialog;->getWindow()Landroid/view/Window;

    move-result-object v1

    const/16 v2, 0x7d9

    invoke-virtual {v1, v2}, Landroid/view/Window;->setType(I)V

    iget-object v1, p0, Lcom/android/internal/policy/impl/GlobalActions$99;->this$0:Lcom/android/internal/policy/impl/GlobalActions;

    #getter for: Lcom/android/internal/policy/impl/GlobalActions;->mContext:Landroid/content/Context;
    invoke-static {v1}, Lcom/android/internal/policy/impl/GlobalActions;->access$000(Lcom/android/internal/policy/impl/GlobalActions;)Landroid/content/Context;

    move-result-object v1

    invoke-virtual {v1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v1

    const v2, 0x111000f

    invoke-virtual {v1, v2}, Landroid/content/res/Resources;->getBoolean(I)Z

    move-result v1

    if-nez v1, :cond_58

    invoke-virtual {v0}, Landroid/app/AlertDialog;->getWindow()Landroid/view/Window;

    move-result-object v1

    invoke-virtual {v1, v5, v5}, Landroid/view/Window;->setFlags(II)V

    :cond_58
    invoke-virtual {v0}, Landroid/app/AlertDialog;->show()V

    return-void
.end method

.method public showBeforeProvisioning()Z
    .registers 2

    .prologue
    .line 307
    const/4 v0, 0x1

    return v0
.end method

.method public showConditional()Z
    .registers 2

    .prologue
    .line 311
    const/4 v0, 0x1

    return v0
.end method

.method public showDuringKeyguard()Z
    .registers 2

    .prologue
    .line 304
    const/4 v0, 0x1

    return v0
.end method

GlobalActions$99$1.smali
Code:
.class Lcom/android/internal/policy/impl/GlobalActions$99$1;
.super Ljava/lang/Object;
.source "GlobalActions.java"

# interfaces
.implements Landroid/content/DialogInterface$OnClickListener;


# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lcom/android/internal/policy/impl/GlobalActions$99;->onPress()V
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation


# instance fields
.field final synthetic this$1:Lcom/android/internal/policy/impl/GlobalActions$99;


# direct methods
.method constructor <init>(Lcom/android/internal/policy/impl/GlobalActions$99;)V
    .registers 2
    .parameter

    .prologue
    .line 281
    iput-object p1, p0, Lcom/android/internal/policy/impl/GlobalActions$99$1;->this$1:Lcom/android/internal/policy/impl/GlobalActions$99;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method


# virtual methods
.method public onClick(Landroid/content/DialogInterface;I)V
    .registers 7
    .parameter "dialog"
    .parameter "whichButton"

    .prologue
    const/4 v2, 0x1

    const/4 v3, 0x0

    .line 282
    sget v0, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;->rebootMode:I

    const/4 v1, -0x1

    if-le v0, v1, :cond_20

    .line 291
    sget v0, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;->rebootMode:I

    const/4 v1, 0x4

    if-eq v0, v1, :cond_4d

    .line 283
    sget v0, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;->rebootMode:I

    if-eq v0, v2, :cond_2c

    .line 284
    iget-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions$99$1;->this$1:Lcom/android/internal/policy/impl/GlobalActions$99;

    iget-object v0, v0, Lcom/android/internal/policy/impl/GlobalActions$99;->this$0:Lcom/android/internal/policy/impl/GlobalActions;

    #getter for: Lcom/android/internal/policy/impl/GlobalActions;->mContext:Landroid/content/Context;
    invoke-static {v0}, Lcom/android/internal/policy/impl/GlobalActions;->access$000(Lcom/android/internal/policy/impl/GlobalActions;)Landroid/content/Context;

    move-result-object v0

    sget v1, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;->rebootMode:I

    if-nez v1, :cond_21

    const/4 v1, 0x0

    :goto_1d
    invoke-static {v0, v1, v3}, Lcom/android/server/power/ShutdownThread;->reboot(Landroid/content/Context;Ljava/lang/String;Z)V

    .line 291
    :cond_20
    :goto_20
    return-void

    .line 284
    :cond_21
    sget-object v1, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;->rebootOptions:[Ljava/lang/String;

    sget v2, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;->rebootMode:I

    aget-object v1, v1, v2

    invoke-virtual {v1}, Ljava/lang/String;->toLowerCase()Ljava/lang/String;

    move-result-object v1

    goto :goto_1d

    .line 288
    :cond_2c
    :try_start_2c
    invoke-static {}, Ljava/lang/Runtime;->getRuntime()Ljava/lang/Runtime;

    move-result-object v0

    const/4 v1, 0x4

    new-array v1, v1, [Ljava/lang/String;

    const/4 v2, 0x0

    const-string v3, "pkill"

    aput-object v3, v1, v2

    const/4 v2, 0x1

    const-string v3, "-TERM"

    aput-object v3, v1, v2

    const/4 v2, 0x2

    const-string v3, "-f"

    aput-object v3, v1, v2

    const/4 v2, 0x3

    const-string v3, "system_server"

    aput-object v3, v1, v2

    invoke-virtual {v0, v1}, Ljava/lang/Runtime;->exec([Ljava/lang/String;)Ljava/lang/Process;
    :try_end_4a
    .catch Ljava/lang/Exception; {:try_start_2c .. :try_end_4a} :catch_4b

    goto :goto_20

    .line 290
    :catch_4b
    move-exception v0

    goto :goto_20

    :cond_4d
    iget-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions$99$1;->this$1:Lcom/android/internal/policy/impl/GlobalActions$99;

    iget-object v0, v0, Lcom/android/internal/policy/impl/GlobalActions$99;->this$0:Lcom/android/internal/policy/impl/GlobalActions;

    #getter for: Lcom/android/internal/policy/impl/GlobalActions;->mContext:Landroid/content/Context;
    invoke-static {v0}, Lcom/android/internal/policy/impl/GlobalActions;->access$000(Lcom/android/internal/policy/impl/GlobalActions;)Landroid/content/Context;

    move-result-object v0

    const/4 v1, 0x0

    invoke-static {v0, v1}, Lcom/android/server/power/ShutdownThread;->shutdown(Landroid/content/Context;Z)V

    goto :goto_20
.end method


GlobalActions$99$2.smali
Code:
.class Lcom/android/internal/policy/impl/GlobalActions$99$2;
.super Ljava/lang/Object;
.source "GlobalActions.java"

# interfaces
.implements Landroid/content/DialogInterface$OnClickListener;


# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lcom/android/internal/policy/impl/GlobalActions$99;->onPress()V
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation


# instance fields
.field final synthetic this$1:Lcom/android/internal/policy/impl/GlobalActions$99;


# direct methods
.method constructor <init>(Lcom/android/internal/policy/impl/GlobalActions$99;)V
    .registers 2

    iput-object p1, p0, Lcom/android/internal/policy/impl/GlobalActions$99$2;->this$1:Lcom/android/internal/policy/impl/GlobalActions$99;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method


# virtual methods
.method public onClick(Landroid/content/DialogInterface;I)V
    .registers 3

    sput p2, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;->rebootMode:I

    return-void
.end method

Recompile and done!






You can also change the names of the reboot method to your liking!
The Following 2 Users Say Thank You to scrosler For This Useful Post: [ Click to Expand ]
 
stevehkim
Old
#3  
Senior Member
Thanks Meter 752
Posts: 2,791
Join Date: Oct 2011
Slowly but surely here comes the goodies. Cant wait for flashy time for AT&T.

ATT S4 Rooted. Beastin.
4.2.2
JKay Framework
Xposed
S4 Golden Eye Rom
The Following User Says Thank You to stevehkim For This Useful Post: [ Click to Expand ]
 
yeahitsgotahemii
Old
#4  
Member
Thanks Meter 26
Posts: 88
Join Date: Nov 2011
Scrosler you are the man! Hell ya dude thanks!! I envy your talent
 
Dean1650
Old
#5  
Dean1650's Avatar
Senior Member
Thanks Meter 150
Posts: 398
Join Date: Dec 2012
Location: Webster

 
DONATE TO ME
"Tettering" ay, right. Slow down a little, I can't keep up. Very usefull reboot menu. Works for me.

sent from my SGH-i317
 
scrosler
Old
#6  
scrosler's Avatar
Recognized Developer - OP
Thanks Meter 51,644
Posts: 23,570
Join Date: Feb 2007
Location: Fargo

 
DONATE TO ME
Quote:
Originally Posted by Dean1650 View Post
"Tettering" ay, right. Slow down a little, I can't keep up. Very usefull reboot menu. Works for me.

sent from my SGH-i317
Hehehehe.... It was a tough choice my friend. Hardest phone choice I had to make but then after owning both I decided this was going to be a power house!

Me slow down? Never!

Did you see my launcher mod in themes and apps?
The Following User Says Thank You to scrosler For This Useful Post: [ Click to Expand ]
 
Dean1650
Old
#7  
Dean1650's Avatar
Senior Member
Thanks Meter 150
Posts: 398
Join Date: Dec 2012
Location: Webster

 
DONATE TO ME
Quote:
Originally Posted by scrosler View Post
Hehehehe.... It was a tough choice my friend. Hardest phone choice I had to make but then after owning both I decided this was going to be a power house!

Me slow down? Never!

Did you see my launcher mod in themes and apps?
No, but I'm headed over there now.

sent from my SGH-i317
 
powerwagon
Old
#8  
powerwagon's Avatar
Senior Member
Thanks Meter 271
Posts: 688
Join Date: Jun 2010
Quote:
Originally Posted by scrosler View Post
Hehehehe.... It was a tough choice my friend. Hardest phone choice I had to make but then after owning both I decided this was going to be a power house!

Me slow down? Never!

Did you see my launcher mod in themes and apps?
Thought you were going back to Verizon?

Sent from my HTC One using Tapatalk 2
 
scrosler
Old
#9  
scrosler's Avatar
Recognized Developer - OP
Thanks Meter 51,644
Posts: 23,570
Join Date: Feb 2007
Location: Fargo

 
DONATE TO ME
Quote:
Originally Posted by powerwagon View Post
Thought you were going back to Verizon?

Sent from my HTC One using Tapatalk 2
I did. The people on Verizon bought me a Note II (when it came out). But I wanted the SGS4 so I broke into my donation fund and bought (part of it anyways).

I now develop for 4 phones, SGS4, Note II (All carriers), SGS3, and HTC One X... and the Nexus 10 Tablet.
The Following 2 Users Say Thank You to scrosler For This Useful Post: [ Click to Expand ]
 
MrPlNK
Old
#10  
MrPlNK's Avatar
Senior Member
Thanks Meter 178
Posts: 771
Join Date: Aug 2012
Location: Gaithersburg
Quote:
Originally Posted by scrosler View Post
I did. The people on Verizon bought me a Note II (when it came out). But I wanted the SGS4 so I broke into my donation fund and bought (part of it anyways).

I now develop for 4 phones, SGS4, Note II (All carriers), SGS3, and HTC One X... and the Nexus 10 Tablet.
Cant wait to be running cleanrom on this! Def one of the best devs in the game, glad you kept it

Sent from my SAMSUNG-SGH-I337 using Tapatalk 2

THREAD CLOSED
Subscribe
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes