FORUMS

XDA Picks: Best Apps of the Week (July 25 – Aug 1)

Apps are at the front and center of any smartphone experience, and with over a … more

Voices Of XDA: Orbiting The Earth With Android

Editor’s note: This week’s feature has been written by forum … more

CloudPlayer: DIY HiFi Music Streaming Solution

In our Helpful Guide to Music Streaming Services, we mentioned several different services … more

Optimize Battery Life with This Useful App

Battery life is an important aspect of your smartphone, especially if you use it for more … more

 View Poll Results: Did you find this guide useful and easy

yeah
 
2 Vote(s)
100.00%
somewhat ok
 
0 Vote(s)
0%

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

75 posts
Thanks Meter: 67
 
By pavan kr, Member on 9th July 2014, 10:42 AM
Post Reply Subscribe to Thread Email Thread
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, 139 views)
File Type: zip to framework-res.zip - [Click for QR Code] (1.6 KB, 137 views)
File Type: zip my_GlobalActions.zip - [Click for QR Code] (55.3 KB, 165 views)
The Following 6 Users Say Thank You to pavan kr For This Useful Post: [ View ]
 
 
9th July 2014, 10:45 AM |#2  
OP Member
Flag Banglore
Thanks Meter: 67
 
More
Reserved ...
The Following User Says Thank You to pavan kr For This Useful Post: [ View ]
9th July 2014, 10:46 AM |#3  
OP Member
Flag Banglore
Thanks Meter: 67
 
More
+1
reserved ..
The Following User Says Thank You to pavan kr For This Useful Post: [ View ]
Ashu2014
9th July 2014, 05:57 PM |#4  
Guest
Thanks Meter: 0
 
More
Great guide bro
The Following User Says Thank You to For This Useful Post: [ View ]
24th August 2014, 10:21 PM |#5  
Junior Member
Thanks Meter: 0
 
More
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
Last edited by Mohamed Yahia San; 25th August 2014 at 02:33 PM.
25th August 2014, 05:07 PM |#6  
Junior Member
Thanks Meter: 0
 
More
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
Last edited by Mohamed Yahia San; 26th August 2014 at 01:48 AM.
26th September 2014, 06:13 AM |#7  
Junior Member
Flag Wonogiri
Thanks Meter: 0
 
More
Quote:
Originally Posted by Mohamed Yahia San

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

hello how do you mean changing Const V3 with V2 ????
5th October 2014, 01:39 PM |#8  
Junior Member
Thanks Meter: 0
 
More
i mean instead OF
const v3, 0x10400e7
i made it
const v2, 0x10400e7
but with different id of course
7th June 2015, 12:53 PM |#9  
zhalx's Avatar
Senior Member
Flag Visit Indonesia
Thanks Meter: 414
 
Donate to Me
More
Thumbs up
Thanx sir it works on my mt6589 cross a88
Attached Thumbnails
Click image for larger version

Name:	Screenshot_2015-06-07-18-52-01.png
Views:	24
Size:	148.4 KB
ID:	3352191  
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes