[DEVS][Safestrap][How-To] Reboot To Safestrap Recovery Via Power Menu

TheDriller

Senior Member
Jan 31, 2012
4,299
6,681
0
Augusta, GA
So First; we must thank @Hashcode for hos wonderful Safestrap Recovery That allows us to flash custom ROMs even though we have a locked Bootloader


In this Guide I will show you how to edit your power menu to change the reboot recovery from going to the recovery partition to going to Safestrap
This is independent of the safestrap app, IF AND ONLY IF the safestrap image is on the phone already

This is only for devs who want to incorporate this into their rom and I will not be answering questions on how to do this as even a beginner dev can manage this

I only ask that credit be given to @Hashcode, @Goldie @RErick and AllianceROM and that the supplied script not be changed or modified in anyway,
This is being shared freeley and a little thanks goes a long way

First thing is first
You will need to Decompile android,policy,jar
Look for globalactions$99$1.smali
Inside this smali file you will need to find
.method public onClick(Landroid/content/DialogInterface;I)V

and then look for this set of lines its at the very top
Code:
    const/4 v2, 0x1

    const/4 v3, 0x0

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

    const/4 v1, -0x1

    if-le v0, v1, :cond_0

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

Directly underneath that last line above add these lines

Code:
    const/4 v1, 0x3

    if-eq v0, v1, :cond_4
Now, at the very bottom of the same method, directly above the line that says
Code:
    goto :goto_1
You will add these lines

Code:
    goto :goto_1

    :cond_4
    const-string v1, "su -c /system/bin/recrbt.sh"

    invoke-static {}, Ljava/lang/Runtime;->getRuntime()Ljava/lang/Runtime;

    move-result-object v2

    invoke-virtual {v2, v1}, Ljava/lang/Runtime;->exec(Ljava/lang/String;)Ljava/lang/Process;

Thats it for the jar file. Save and recompile and then I have attached a zip with the needed script inside that needs to be placed in
/system/bin and permissions set to 0755
Or if on a clean flash, dont worry about permissions.
:good:
 

Attachments

Last edited:

HaMMeR-MaN

Senior Member
Jun 7, 2009
581
906
0
West Virginia
So First; we must thank @Hashcode for hos wonderful Safestrap Recovery That allows us to flash custom ROMs even though we have a locked Bootloader


In this Guide I will show you how to edit your power menu to change the reboot recovery from going to the recovery partition to going to Safestrap
This is independent of the safestrap app, IF AND ONLY IF the safestrap image is on the phone already

This is only for devs who want to incorporate this into their rom and I will not be answering questions on how to do this as even a beginner dev can manage this

I only ask that credit be given to @Hashcode @RErick and AllianceROM and that the supplied script not be changed or modified in anyway,
This is being shared freeley and a little thanks goes a long way

First thing is first
You will need to Decompile android,policy,jar
Look for globalactions$99$1.smali
Inside this smali file you will need to find
.method public onClick(Landroid/content/DialogInterface;I)V

and then look for this set of lines its at the very top
Code:
    const/4 v2, 0x1

    const/4 v3, 0x0

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

    const/4 v1, -0x1

    if-le v0, v1, :cond_0

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

Directly underneath that last line above add these lines

Code:
    const/4 v1, 0x3

    if-eq v0, v1, :cond_4
Now, at the very bottom of the same method, directly above the line that says
Code:
    goto :goto_1
You will add these lines

Code:
    goto :goto_1

    :cond_4
    const-string v1, "su -c /system/bin/recrbt.sh"

    invoke-static {}, Ljava/lang/Runtime;->getRuntime()Ljava/lang/Runtime;

    move-result-object v2

    invoke-virtual {v2, v1}, Ljava/lang/Runtime;->exec(Ljava/lang/String;)Ljava/lang/Process;

Thats it for the jar file. Save and recompile and then I have attached a zip with the needed script inside that needs to be placed in
/system/bin and permissions set to 0755
Or if on a clean flash, dont worry about permissions.
:good:
Thank you for sharing:)
 
  • Like
Reactions: bri315317