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
Post Reply

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

OP sandy7

18th September 2013, 09:01 AM   |  #1  
sandy7's Avatar
OP Recognized Contributor / Recognized Developer
Flag bangalore
Thanks Meter: 6,883
 
6,202 posts
Join Date:Joined: May 2012
Donate to Me
More
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, 1551 views)
The Following 31 Users Say Thank You to sandy7 For This Useful Post: [ View ]
18th September 2013, 09:38 AM   |  #2  
aminfauzi's Avatar
Senior Member
Flag Kelantan
Thanks Meter: 131
 
154 posts
Join Date:Joined: Feb 2013
More
Haha...quick post...btw thanks
@mr.khan here you come

Sent from my LT26i using XDA Premium 4 mobile app
The Following 3 Users Say Thank You to aminfauzi For This Useful Post: [ View ]
18th September 2013, 12:01 PM   |  #3  
slink722's Avatar
Senior Member
Flag San Fernando City
Thanks Meter: 1,311
 
996 posts
Join Date:Joined: May 2012
More
sir can you make a flashable zip for us who do not know how to use the required tools? please? thanks. hehe
18th September 2013, 12:05 PM   |  #4  
sandy7's Avatar
OP Recognized Contributor / Recognized Developer
Flag bangalore
Thanks Meter: 6,883
 
6,202 posts
Join Date:Joined: May 2012
Donate to Me
More
Quote:
Originally Posted by slink722

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: [ View ]
18th September 2013, 01:23 PM   |  #5  
rockernaxo's Avatar
Senior Member
Flag Pamplona
Thanks Meter: 1,444
 
613 posts
Join Date:Joined: Mar 2012
Donate to Me
More
I'll try this afternoon, thanks for the guide!!!!

Enviado desde mi LT26i usando Tapatalk
18th September 2013, 01:33 PM   |  #6  
veysosin's Avatar
Junior Member
Flag Zhongshan
Thanks Meter: 1
 
14 posts
Join Date:Joined: Sep 2013
Thumbs up
wow great
18th September 2013, 03:56 PM   |  #7  
slink722's Avatar
Senior Member
Flag San Fernando City
Thanks Meter: 1,311
 
996 posts
Join Date:Joined: May 2012
More
Thumbs up
Quote:
Originally Posted by sandy7

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, 47 views)
Last edited by slink722; 18th September 2013 at 04:39 PM.
18th September 2013, 04:18 PM   |  #8  
Vardash's Avatar
Junior Member
Flag Ontinyent
Thanks Meter: 13
 
17 posts
Join Date:Joined: Aug 2013
Waw! Fantastic work!
!
Last edited by Vardash; 18th September 2013 at 04:31 PM.
The Following User Says Thank You to Vardash For This Useful Post: [ View ]
18th September 2013, 04:35 PM   |  #9  
sandy7's Avatar
OP Recognized Contributor / Recognized Developer
Flag bangalore
Thanks Meter: 6,883
 
6,202 posts
Join Date:Joined: May 2012
Donate to Me
More
Quote:
Originally Posted by slink722

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: [ View ]
18th September 2013, 04:52 PM   |  #10  
slink722's Avatar
Senior Member
Flag San Fernando City
Thanks Meter: 1,311
 
996 posts
Join Date:Joined: May 2012
More
Quote:
Originally Posted by sandy7

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.

Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes