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

Post Reply

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

OP pavan kr

9th July 2014, 11:42 AM   |  #1  
OP Member
Flag Banglore
Thanks Meter: 61
 
75 posts
Join Date:Joined: Aug 2013
More
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, 61 views)
File Type: zip to framework-res.zip - [Click for QR Code] (1.6 KB, 63 views)
File Type: zip my_GlobalActions.zip - [Click for QR Code] (55.3 KB, 75 views)
The Following 4 Users Say Thank You to pavan kr For This Useful Post: [ View ]
9th July 2014, 11:45 AM   |  #2  
OP Member
Flag Banglore
Thanks Meter: 61
 
75 posts
Join Date:Joined: Aug 2013
More
Reserved ...
The Following User Says Thank You to pavan kr For This Useful Post: [ View ]
9th July 2014, 11:46 AM   |  #3  
OP Member
Flag Banglore
Thanks Meter: 61
 
75 posts
Join Date:Joined: Aug 2013
More
+1
reserved ..
The Following User Says Thank You to pavan kr For This Useful Post: [ View ]
Ashu2014
9th July 2014, 06:57 PM   |  #4  
Guest
Thanks Meter: 0
 
n/a posts
Great guide bro
The Following User Says Thank You to For This Useful Post: [ View ]
24th August 2014, 11:21 PM   |  #5  
Junior Member
Thanks Meter: 0
 
16 posts
Join Date:Joined: Mar 2014
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 03:33 PM.
25th August 2014, 06:07 PM   |  #6  
Junior Member
Thanks Meter: 0
 
16 posts
Join Date:Joined: Mar 2014
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 02:48 AM.
26th September 2014, 07:13 AM   |  #7  
Junior Member
Flag Wonogiri
Thanks Meter: 0
 
1 posts
Join Date:Joined: Aug 2014
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, 02:39 PM   |  #8  
Junior Member
Thanks Meter: 0
 
16 posts
Join Date:Joined: Mar 2014
More
i mean instead OF
const v3, 0x10400e7
i made it
const v2, 0x10400e7
but with different id of course

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

Advanced Search
Display Modes