[MOD]4-Way Reboot Mod for All Devices


aiccucs

Members
6 Dec 2010
77
16
Credits
snq- for developing thr first 4 way reboot mod.
ihtfp69 for porting it to MIUI

What this mod does...

Allows you to reboot in the following ways by long pressing the power button:
1. Normally
2. Hot Reboot (Restarts Android Shell)
3. Reboot directly to the bootloader (Fastboot)
4. Reboot directly to recovery

Notes

This mod does not change how the reboot function works in the notification pulldown. It will only reboot normally.

Screenshots

20110113_180524.jpg


Download Here

4-Way Reboot for 1.2.19
4-Way Reboot for 1.2.4
MD5 Hash - 58708cf7964c74fc000df92054670e09
4-Way Reboot for 1.1.28
MD5 Hash - 3bc63b8d8258b06a9d46ce4b4e341b83
4-Way Reboot for 1.1.26
MD5 Hash - 9a67116d985cce9cf255dc69df58ed48
4-Way Reboot for 1.1.21
MD5 Hash - 50df6c384c2fba5f4aecd5ecd3f71c28
4-Way Reboot for 1.1.14
MD5 Hash - 50df6c384c2fba5f4aecd5ecd3f71c28
4-Way Reboot for 1.1.7
MD5 Hash - f927fb97ceab1760391ebef1b07d826f


-----------------------------------
If you appreciate this mod and would like to donate to ihtfp69 click the link below.

 
Download the zip which below which contains the necessary files to implement this port.
GlobalActions9.smali.zip

Next, get android.policy.jar from the latest MIUI and decompile using smali/baksmali.

Copy GlobalActions$9.smali, GlobalActions$9$1. and GlobalActions$9$2.smali into android.policy.jar/com/android/internal/policy/impl from the ones in GlobalActions9.smali.zip found above.

In your decompiled android.policy.jar, browse to com/android/internal/policy/impl and make the following edits.

NOTE: The lines numbers I provided are from the stock smali files in build 1.1.7. They will change as you make the edits. These will also change as MIUI makes changes. They are just there to help.

GlobalActions$SinglePressAction.smali
Code:
After the following code: (approx lines 14 - 17)
.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x40a
    name = "SinglePressAction"
.end annotation

Add the following code:
# static fields
.field protected static rebootMode:I

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

-----------------------------------------------------------------------

After the following code: (approx line 23)
.field private final mMessageResId:I

Add the following code:
# 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, "Normal"

    aput-object v2, v0, v1

    const/4 v1, 0x1

    const-string v2, "Hot Boot"

    aput-object v2, v0, v1

    const/4 v1, 0x2

    const-string v2, "Bootloader"

    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



GlobalActions.smali
Code:
After the following code: (appox lines 416 - 420)
.method private createDialog()Landroid/app/AlertDialog;
    .registers 12

    .prologue
    const/4 v10, 0x1
    
Remove the following code:
    const/4 v9, 0x4

-----------------------------------------------------------------------

After the following code: (approx lines 488 - 490)
    iget-object v2, p0, Lcom/android/internal/policy/impl/GlobalActions;->mPrivacyModeToggle:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;

    aput-object v2, v0, v1
    
Add the following code:
    const/4 v1, 0x1
---------
And change the following code:
    iget-object v1, p0, Lcom/android/internal/policy/impl/GlobalActions;->mSilentModeToggle:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;

    aput-object v1, v0, v10
    
To the following code:
    iget-object v2, p0, Lcom/android/internal/policy/impl/GlobalActions;->mSilentModeToggle:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;

    aput-object v2, v0, v1
---------
It should look like this when you are done:
    iget-object v2, p0, Lcom/android/internal/policy/impl/GlobalActions;->mPrivacyModeToggle:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;

    aput-object v2, v0, v1

    const/4 v1, 0x1

    iget-object v2, p0, Lcom/android/internal/policy/impl/GlobalActions;->mSilentModeToggle:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;

    aput-object v2, v0, v1
    
-----------------------------------------------------------------------

Change the following code from: (approx line 504)
    new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$4;

To the following code:
    new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$9;

-----------------------------------------------------------------------

Change the following code from: (approx line 510)
    invoke-direct {v2, p0, v3, v4}, Lcom/android/internal/policy/impl/GlobalActions$4;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V

To the following code:
    invoke-direct {v2, p0, v3, v4}, Lcom/android/internal/policy/impl/GlobalActions$9;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V

-----------------------------------------------------------------------

After the following code: (approx line 512)
    aput-object v2, v0, v1
    
Add the following code:
    const/4 v9, 0x4

-----------------------------------------------------------------------

Change the following code from: (approx line 590)
    if-nez v0, :cond_bb
    
To the following code:
    if-nez v0, :cond_bc
    
-----------------------------------------------------------------------

Change the following code from: (approx line 600)
    :cond_bb
    
To the following code:
    :cond_bc

Now all you have to do is compile android.policy.jar and place it in /system/framework.
 
Awesome work man, def one thing I was missing coning from the z port

Sent from my ADR6300 using the miui-dev.com Forums App
 
Sent a request to the developers to add this in the main ROM.

Cheers,

Mark
 
Thanks for the request! Although I noticed on 12.31 it says: "the page at '%s' says", instead of "restart". And then it says "are you sure you want to format the", instead of "OK". Prolly cuz it's supposed to work with 1.1.7 and future roms only.
But, it does get the job done though.

Swyped from the root of all EVO.
 
Thanks for the request! Although I noticed on 12.31 it says: "the page at '%s' says", instead of "restart". And then it says "are you sure you want to format the", instead of "OK". Prolly cuz it's supposed to work with 1.1.7 and future roms only.
But, it does get the job done though.

Swyped from the root of all EVO.

Yes, this is only for 1.1.7 and onward as I make the necessary changes. Some devs will might implement this themselves as its not too difficult.
 
A real treat, thanks aiccucs!

Sent from my ADR6300 using the miui-dev.com Forums App
 
cool cool... now what about a 30 second timeout :)

noob question: say you run fix permissions can you hot boot?

Sent from my Droid using the miui-dev.com Forums App
 
i'am just changed update-binary in the zip

to solve problem fix permission on Q'n'D-miui

the zip work only on Q'nD-miui without fix permission
 
I love this mod, but the one for 1.1.28 doesn't seem to be working. :/ Several people reported this in the Desire HD thread.
 
I love this mod, but the one for 1.1.28 doesn't seem to be working. :/ Several people reported this in the Desire HD thread.

Could be something with the script. Just extract the android.policy.jar and push it to /system/framework.

Sent from my ADR6300 using Tapatalk
 
I tried, but some lines have changed and i couldn't follow the guide. I'll try again tomorrow.

OK, and finally succeeded. There where some changes since he made the guide so i made some reverse engineering with last weeks release.
All the credit goes to aiccucs and the one he gives credit to, LOL.

4wayreboot_1.2.11_signed.zip

If you have any issue please report