Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,783,072 Members 45,493 Now Online
XDA Developers Android and Mobile Development Forum
View Poll Results: Did you find this guide useful and easy
yeah 2 100.00%
somewhat ok 0 0%
Voters: 2. You may not vote on this poll

[guide][jb][3-way] easily enable extended power menu for mtk devices

Tip us?
 
pavan kr
Old
#1  
Member - OP
Thanks Meter 51
Posts: 70
Join Date: Aug 2013
Location: Banglore
Default [guide][jb][3-way] easily enable extended power menu for mtk devices

Hello Everyone ,


In this guide i'll show u how to add Reboot and Recovery option to power menu

There is lots of Guides on how to add recovery option to power menu but none worked perfectly on my device(MTK)

so i found a new way , in which we need not to find proper globalaction files



Requirements :

Quote:
apktool
Notepad++
android.policy.jar
framework-res.apk
Time and Patience
Part-1

Decompile Your framework-res.apk and navigate to - res/value/strings.xml

add these lines at the end.

Code:
<string name="reboot_text">Reboot</string>
<string name="recovery_text">Recovery</string>
Like this


and add the attached pngs to - res/drawable-hdpi/ and compile the apk

again decompile the modded apk and open res/values/public.xml

Part-2

Now Decompile your "android.policy.jar" and add the attached files to - "android.policy.jar.out\smali\com\android\internal \policy\impl"

Now open GlobalActions.smali and find this method

Code:
.method private createDialog()Lcom/android/internal/policy/impl/GlobalActions$GlobalActionsDialog;
Below that you will see

Code:
.locals 11
change it to

Code:
.locals 12
Now find

Code:
.prologue
Below that paste this

Code:
const v11, 0x1080030        <------------ Replace the id with ic_lock_power_off (power off drawable) in the opened public.xml
Now Find this

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

const v2, 0x10400e7
change the id 0x10400e7 with the new id in public.xml

Code:
<public type="string" name="global_action_power_off"
now below that you will see

Code:
const v3, 0x10400e7
now delate the above line and paste this below

Code:
invoke-direct {v1, p0, v11, v2}, 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 317
    iget-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;

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

    const v2, 0x108061a  <----------id of <public type="drawable" name="ic_lock_reboot" 

    const v3, 0x104054f  <----------id of <public type="string" name="reboot_text" 

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

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

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

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

    const v2, 0x1080619  <---------- id of  <public type="drawable" name="ic_lock_recovery" 

    const v3, 0x1040550  <-----------id of  <public type="string" name="recovery_text"

    invoke-direct {v1, p0, v2, v3}, Lcom/android/internal/policy/impl/GlobalActions$99;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
Replace the above ids with the id in your public.xml

Before :
 
Code:
.line 281
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

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

    .line 284
    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, 0x10400e7

    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 309
    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

    .line 312

After :

 
Code:
.line 281
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

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

    .line 284
    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, 0x10400e7

    invoke-direct {v1, p0, v11, v2}, 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 317
    iget-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;

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

    const v2, 0x108061a

    const v3, 0x104054f

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

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

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

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

    const v2, 0x1080619

    const v3, 0x1040550

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

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

    .line 309
    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 compile and flash both the files

I have attached my GlobalActions.smali for comparision just change the extension from .zip to .smali

Result :

 


Hints :

1 . While Replacing the id from public.xml replace only last 7 digits

like this

 


2. keep track of registers (like v1 v2 v11 etc) and .Line numbers should be unique

3. Register values (like 0x108061a) will be Different for Different roms

I've Tested this guide on 3 different roms and it is working fine without any errors

If u Have any Problems Post here i'll try my best to help you

Credits/ Thanks
Quote:
SuperDroidBond

Adi Aisiteru Reborn

Learnt many things from their guides ...
If you like my work Hit Thanks ..dont forget
Attached Files
File Type: zip to android.policy.jar.zip - [Click for QR Code] (1.7 KB, 11 views)
File Type: zip to framework-res.zip - [Click for QR Code] (1.6 KB, 10 views)
File Type: zip my_GlobalActions.zip - [Click for QR Code] (55.3 KB, 7 views)
The Following 4 Users Say Thank You to pavan kr For This Useful Post: [ Click to Expand ]
 
pavan kr
Old
#2  
Member - OP
Thanks Meter 51
Posts: 70
Join Date: Aug 2013
Location: Banglore
Reserved ...
The Following User Says Thank You to pavan kr For This Useful Post: [ Click to Expand ]
 
pavan kr
Old
#3  
Member - OP
Thanks Meter 51
Posts: 70
Join Date: Aug 2013
Location: Banglore
Default +1

reserved ..
The Following User Says Thank You to pavan kr For This Useful Post: [ Click to Expand ]
 
Ashu2014
Old
#4  
Ashu2014's Avatar
Junior Member
Thanks Meter 2
Posts: 4
Join Date: Jul 2014
Location: Lucknow
Great guide bro
The Following User Says Thank You to Ashu2014 For This Useful Post: [ Click to Expand ]
 
Mohamed Yahia San
Old
(Last edited by Mohamed Yahia San; 25th August 2014 at 02:33 PM.)
#5  
Junior Member
Thanks Meter 0
Posts: 15
Join Date: Mar 2014
hello aweasome guide sir thanks alot
put can you give me a smali tool you used
the guide is aweasome realy want to do it thanks
i have done the tutorial and when i press and hold power volume it softreboots
so where is the problem
hope any one here helps me
 
Mohamed Yahia San
Old
(Last edited by Mohamed Yahia San; 26th August 2014 at 01:48 AM.)
#6  
Junior Member
Thanks Meter 0
Posts: 15
Join Date: Mar 2014
working for my device Xperia C
after changing Const V3 with V2 that u said in the section of putting the line 317 and 327
u have to fix it more as things are going wrong cause thereis gona be amiss in the last line
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes