Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Thread Closed

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

OP scrosler

11th May 2013, 04:47 PM   |  #1  
scrosler's Avatar
OP Recognized Developer
Flag Fargo
Thanks Meter: 56,364
 
25,027 posts
Join Date:Joined: Feb 2007
Donate to Me
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:	8944
Size:	20.8 KB
ID:	1953909  
Attached Files
File Type: zip Reboot Menu.zip - [Click for QR Code] (546.9 KB, 945 views)
File Type: zip Reboot Menu - Alt Install.zip - [Click for QR Code] (1,002.6 KB, 672 views)
Last edited by scrosler; 14th May 2013 at 12:19 AM.
The Following 23 Users Say Thank You to scrosler For This Useful Post: [ View ]
11th May 2013, 04:52 PM   |  #2  
scrosler's Avatar
OP Recognized Developer
Flag Fargo
Thanks Meter: 56,364
 
25,027 posts
Join Date:Joined: Feb 2007
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!
Last edited by scrosler; 13th May 2013 at 03:29 AM.
The Following 2 Users Say Thank You to scrosler For This Useful Post: [ View ]
11th May 2013, 04:59 PM   |  #3  
Senior Member
Thanks Meter: 752
 
2,791 posts
Join Date:Joined: Oct 2011
More
Slowly but surely here comes the goodies. Cant wait for flashy time for AT&T.

ATT S4 Rooted. Beastin.
4.2.2
The Following User Says Thank You to stevehkim For This Useful Post: [ View ]
11th May 2013, 05:39 PM   |  #4  
Member
Thanks Meter: 26
 
88 posts
Join Date:Joined: Nov 2011
Scrosler you are the man! Hell ya dude thanks!! I envy your talent
11th May 2013, 11:20 PM   |  #5  
Dean1650's Avatar
Senior Member
Flag Webster
Thanks Meter: 157
 
411 posts
Join Date:Joined: Dec 2012
Donate to Me
More
"Tettering" ay, right. Slow down a little, I can't keep up. Very usefull reboot menu. Works for me.

sent from my SGH-i317
11th May 2013, 11:23 PM   |  #6  
scrosler's Avatar
OP Recognized Developer
Flag Fargo
Thanks Meter: 56,364
 
25,027 posts
Join Date:Joined: Feb 2007
Donate to Me
Quote:
Originally Posted by Dean1650

"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: [ View ]
11th May 2013, 11:29 PM   |  #7  
Dean1650's Avatar
Senior Member
Flag Webster
Thanks Meter: 157
 
411 posts
Join Date:Joined: Dec 2012
Donate to Me
More
Quote:
Originally Posted by scrosler

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
12th May 2013, 02:36 AM   |  #8  
powerwagon's Avatar
Senior Member
Thanks Meter: 271
 
688 posts
Join Date:Joined: Jun 2010
Quote:
Originally Posted by scrosler

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
12th May 2013, 03:19 AM   |  #9  
scrosler's Avatar
OP Recognized Developer
Flag Fargo
Thanks Meter: 56,364
 
25,027 posts
Join Date:Joined: Feb 2007
Donate to Me
Quote:
Originally Posted by powerwagon

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: [ View ]
12th May 2013, 03:26 AM   |  #10  
MrPlNK's Avatar
Senior Member
Flag Gaithersburg
Thanks Meter: 181
 
784 posts
Join Date:Joined: Aug 2012
More
Quote:
Originally Posted by scrosler

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 to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes