1. MIUI is one of the best android ROMs, based on Android 4.1 Jelly Bean MIUI provides a fresh user experience with Cloud services, backup and security tools. MIUI is released every Friday round 12pm UK time. MIUI is now 3 years old and is growing stronger every day with over 10 million users world-wide.

[MOD]4-Way Reboot Mod for All Devices

Discussion in 'MIUI Mods' started by aiccucs, Jan 14, 2011.

  1. aiccucs Members

    Message Count:
    77
    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

    [IMG]

    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.

    [IMG]
  2. Google Adsense

  3. aiccucs Members

    Message Count:
    77
    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.
  4. fitness12 Members

    Message Count:
    34
    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
  5. MarkHUK Server Admin

    Message Count:
    3,817
    Sent a request to the developers to add this in the main ROM.

    Cheers,

    Mark
  6. edaison Members

    Message Count:
    26
    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.
  7. aiccucs Members

    Message Count:
    77
    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.
  8. upstreammiami Members

    Message Count:
    169
    Thanks man works perfectly

    Sent from my ADR6300 using the miui-dev.com Forums App
  9. k_chupe Members

    Message Count:
    301
    A real treat, thanks aiccucs!

    Sent from my ADR6300 using the miui-dev.com Forums App
  10. jackattack Members

    Message Count:
    121
    Thank you for this!
  11. jcbbiggs Members

    Message Count:
    104
    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
  12. svapunk Members

    Message Count:
    23
  13. aiccucs Members

    Message Count:
    77
    What is this for? The one I posted should work on all MIUI ports unless the devs are messing with android.policy.jar when porting or changing ids in framework-res.apk...
  14. svapunk Members

    Message Count:
    23
    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
  15. Garak Members

    Message Count:
    76
    Just wanted to add my thanks, it's a great mod.
  16. vatvedt Members

    Message Count:
    163
    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.
  17. aiccucs Members

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

    Sent from my ADR6300 using Tapatalk
  18. vatvedt Members

    Message Count:
    163
    Thanks! Pushing it worked great!
  19. roenano Members

    Message Count:
    707
    Just made a ZIP with the edify updater-script for those with newer recoveries.
    aiccuss, feel free to use it for future releases (i made it for you).
    4wayreboot_1.2.4_signed.zip
    Please report if it's working for you.
  20. sandimann Members

    Message Count:
    11
    does someone have a working mod for 1.2.11? :)
  21. roenano Members

    Message Count:
    707
    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

Share Our Site