Post Reply

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

OP pavan kr

9th July 2014, 09:46 AM   |  #1  
OP Member
Flag Banglore
Thanks Meter: 60
 
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)



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 :
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Top Threads in Android Themes by ThreadRank