Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,781,506 Members 40,483 Now Online
XDA Developers Android and Mobile Development Forum

[TUTORIAL] how to add reboot , recovery and bootloader options in Power menu

Tip us?
 
sandy7
Old
#1  
sandy7's Avatar
Recognized Contributor / Recognized Developer - OP
Thanks Meter 6,858
Posts: 6,186
Join Date: May 2012
Location: bangalore

 
DONATE TO ME
Tutorial [TUTORIAL] how to add reboot , recovery and bootloader options in Power menu

So lets Start

Required
1-apktool
2-notepad++
3-some brains


Before u decompile anything see this Guide by @erorcun for how to compile a JB framework without bootloop..
http://forum.xda-developers.com/show....php?t=2321207



STEP-1

Decompile Framework-res.apk

goto to res/vlaues/arrays.xml

and add these lines at the end

Code:
    <string-array name="reboot_options">
        <item>@string/reboot_normal</item>
        <item>@string/reboot_recovery</item>
        <item>@string/reboot_bootloader</item>
    </string-array>
    <string-array name="reboot_actions">
        <item>now</item>
        <item>recovery</item>
        <item>bootloader</item>
    </string-array>

now goto res/values/strings
and add these lines at the end


Code:
    <string name="reboot">Reboot</string>
    <string name="reboot_normal">Reboot</string>
    <string name="reboot_recovery">Recovery</string>
    <string name="reboot_bootloader">Bootloader</string>

goto add the ic_lock_reboot.png which i have i provided in the resources attached below this post to drawablw-hdpi folder

so before compiling the framework-res.apk follow erorcun's guide to properly recompile framework-res.apk

once recompile is done ....decompile again to get the HEX ID's

STEP-2

decompile android.policy.jar

goto classout\com\android\internal\policy\impl

and add the 3 smali's files which i provided in the resources attached below

Now option classout\com\android\internal\policy\impl\GlobalAc tions.smali

and find these lines and add the red marked lines between them

Code:
    .line 235
    iget-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;

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

    const v2, 0x1080030

    const v3, 0x10400fa

    invoke-direct {v1, p0, v2, v3}, Lcom/android/internal/policy/impl/GlobalActions$2;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V

    invoke-virtual {v0, v1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 213
    move-object/from16 v0, p0

    iget-object v1, v0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;

    new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$11;

    const v3, 0x1080827

    const v4, 0x104060b

    move-object/from16 v0, p0

    invoke-direct {v2, v0, v3, v4}, Lcom/android/internal/policy/impl/GlobalActions$11;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V

    invoke-virtual {v1, v2}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 260
    iget-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;

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

    invoke-virtual {v0, v1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

now we need to assign the Hex id's as per ur Public.xml

NOTE: the hex id's might be different from mine and yours so be careful while comparing

new as per the above changes in GlobalActions.xml

assign the id's as below

<public type="drawable" name="ic_lock_reboot" id="0x01080827" />

Code:
 new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$11;

    const v3, 0x1080827

<public type="string" name="reboot" id="0x0104060b" />

Code:
new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$11;

    const v3, 0x1080827

    const v4, 0x104060b


Now option up classout\com\android\internal\policy\impl\GlobalAc tions$11.smali

find and replace the following

@line 70
<public type="string" name="reboot" id="0x0104060b" />


Code:
const v3, 0x104060b

@line 90
<public type="array" name="reboot_options" id="0x0107003b" />


Code:
const v3, 0x107003b

@line 105
<public type="string" name="ok" id="0x0104000a" />



Code:
  const v2, 0x104000a

@line 147
<public type="bool" name="config_sf_slowBlur" id="0x0111000b" />


Code:
const v3, 0x111000b

now open up classout\com\android\internal\policy\impl\GlobalAc tions$11$2.smali

@line 59
<public type="array" name="reboot_actions" id="0x0107003c" />


Code:
const v2, 0x107003c

save it and recompile android.policy.jar


now push all the files into ut phone...will have the new Advanced reboot options
Attached Files
File Type: rar reboot_option_resources.rar - [Click for QR Code] (4.5 KB, 1158 views)
The Following 29 Users Say Thank You to sandy7 For This Useful Post: [ Click to Expand ]
 
aminfauzi
Old
#2  
aminfauzi's Avatar
Senior Member
Thanks Meter 80
Posts: 126
Join Date: Feb 2013
Location: Kelantan
Haha...quick post...btw thanks
@mr.khan here you come

Sent from my LT26i using XDA Premium 4 mobile app
Device: Sony Xperia S
ROM: Ultimate BlackXS
Kernel: DoomKernel v6


The Following 3 Users Say Thank You to aminfauzi For This Useful Post: [ Click to Expand ]
 
slink722
Old
#3  
slink722's Avatar
Senior Member
Thanks Meter 1,264
Posts: 977
Join Date: May 2012
Location: San Fernando City
sir can you make a flashable zip for us who do not know how to use the required tools? please? thanks. hehe
 
sandy7
Old
#4  
sandy7's Avatar
Recognized Contributor / Recognized Developer - OP
Thanks Meter 6,858
Posts: 6,186
Join Date: May 2012
Location: bangalore

 
DONATE TO ME
Quote:
Originally Posted by slink722 View Post
sir can you make a flashable zip for us who do not know how to use the required tools? please? thanks. hehe
if u can upload the framework-res.apk and android.policy.jar i can mod it for u ...when i have free time
The Following User Says Thank You to sandy7 For This Useful Post: [ Click to Expand ]
 
rockernaxo
Old
#5  
rockernaxo's Avatar
Senior Member
Thanks Meter 1,427
Posts: 610
Join Date: Mar 2012
Location: Pamplona

 
DONATE TO ME
I'll try this afternoon, thanks for the guide!!!!

Enviado desde mi LT26i usando Tapatalk
DevSXSTeam brings you the most customizable ROM for Xperia S and Xperia ION




I will ignore a bug report if it's not reported with Aroma installation log. I'm not a seer, I need to know what you chose in Aroma.
 
veysosin
Old
#6  
veysosin's Avatar
Junior Member
Thanks Meter 1
Posts: 13
Join Date: Sep 2013
Location: Zhongshan
wow great
 
slink722
Old
(Last edited by slink722; 18th September 2013 at 03:39 PM.)
#7  
slink722's Avatar
Senior Member
Thanks Meter 1,264
Posts: 977
Join Date: May 2012
Location: San Fernando City
Quote:
Originally Posted by sandy7 View Post
if u can upload the framework-res.apk and android.policy.jar i can mod it for u ...when i have free time
here's my android.policy.jar. i dont know why i cant upload the framework-res . it says " Your submission could not be processed because a security token was missing. If this occurred unexpectedly, please inform the administrator and describe the action you performed before you received this error. "

how to bypass this?
thanks so much @sandy7
Attached Files
File Type: jar android.policy.jar - [Click for QR Code] (156.8 KB, 34 views)
 
Vardash
Old
(Last edited by Vardash; 18th September 2013 at 03:31 PM.)
#8  
Vardash's Avatar
Junior Member
Thanks Meter 13
Posts: 17
Join Date: Aug 2013
Location: Ontinyent
Waw! Fantastic work!
!
The Following User Says Thank You to Vardash For This Useful Post: [ Click to Expand ]
 
sandy7
Old
#9  
sandy7's Avatar
Recognized Contributor / Recognized Developer - OP
Thanks Meter 6,858
Posts: 6,186
Join Date: May 2012
Location: bangalore

 
DONATE TO ME
Quote:
Originally Posted by slink722 View Post
here's my android.policy.jar. i dont know why i cant upload the framework-res . it says " Your submission could not be processed because a security token was missing. If this occurred unexpectedly, please inform the administrator and describe the action you performed before you received this error. "

how to surpass this?
thanks so much @sandy7
put them in zip file and upload it other file server
The Following 2 Users Say Thank You to sandy7 For This Useful Post: [ Click to Expand ]
 
slink722
Old
#10  
slink722's Avatar
Senior Member
Thanks Meter 1,264
Posts: 977
Join Date: May 2012
Location: San Fernando City
Quote:
Originally Posted by sandy7 View Post
put them in zip file and upload it other file server
thanks. im doing it now

---------- Post added at 03:52 PM ---------- Previous post was at 03:40 PM ----------

here's the link mate!

http://www.4shared.com/rar/XmdgXQoY/...androidpo.html

thanks agian!! btw, how to install? haha.

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes