[MOD][How to] Extended power menu I9505G MFD - Google Edition

Status
Not open for further replies.
Search This thread

Jamison904

Senior Member
Jun 9, 2009
5,449
15,168
Jacksonville, Florida
This is just a quick how to. Spend a few hours writing this yesterday (see - post and post.) The GlobalActions$SinglePressAction.smali part is from Cristiano Matos Thanks bro! The rest I put together from trail and error. Feel free to use it, a thanks and some credit would be cool. Enjoy. Also huge shout out to my team mate @Mr Impossible for fixing my error. Thanks Bro!!

Flashable zip - http://d-h.st/Hnt

For developers, if you would like to see the diff you can see them on my github:






First you need to decompile the framework-res.apk and navigate and open res/values/layouts.xml and add this to the bottom.
Code:
<item type="layout" name="keyguard_transport_control">false</item>
This will fix the compile error that you get from the stock framework-res.


Now you need to add the strings and the icon for reboot since stock there are none. Navigate to res/values/strings.xml and add
Code:
<string name="reboot">Reboot menu</string>
Now you need to add the icon to res/drawable-xhdpi/ic_lock_reboot.png (I will attach it later). Now compile the framework-res.apk then decompile it again. We do this so the apktool will add these to the public.xml and assign ID's to them that we will need later. You can put the new compiled framework aside to add to your ROM later.



Now we will move to the android.policy.jar. You will need decompile the classout. Now go to classout/com/android/internal/policy/impl/GlobalActions.smali and find

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

     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


Code:
     invoke-virtual {v0, v1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
[COLOR="Blue"]+
+    new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$99;
+
+    const v2, 0x1080c11 (This is the ID for the Ic_lock_reboot we added to framework-res. add yours)
+
+    const v3, 0x10408eb (this is the String ID for reboot)
+
+    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
+[/COLOR]
     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

Also pro tip: ID's for apps will be in this format 0x01080c11 and in the android.policy.jar is 0x1080c11. Notice that in the android.policy.jar the 0 after the x is removed. 0x01080c11. So when you are comparing remove the 0 if pulling from the public.xml or if you if you are taking from the android.policy.jar you will need to add it to match up.





This part is from Cristiano Matos Thanks bro!
classout/com/android/internal/policy/impl/GlobalActions$SinglePressAction.smali

Find this
Code:
.end annotation


# instance fields
.field private final mIconResId:I

.field private final mMessage:Ljava/lang/CharSequence;

.field private final mMessageResId:I



And between .end annotation and # instance fields, add this
Code:
[COLOR="Blue"]# static fields
.field protected static rebootMode:I

.field protected static final rebootOptions:[Ljava/lang/String;[/COLOR]


Find this
Code:
# direct methods
.method protected constructor <init>(II)V
    .registers 4
    .parameter "iconResId"
    .parameter "messageResId"

And between # direct methods and .method protected constructor <init>(II)V, add this
Code:
[COLOR="Blue"].method static constructor <clinit>()V
    .registers 3

    const/4 v0, 0x3

    new-array v0, v0, [Ljava/lang/String;

    const/4 v1, 0x0

    const-string v2, "Reboot"

    aput-object v2, v0, v1

    const/4 v1, 0x1

    const-string v2, "Download"

    aput-object v2, v0, v1

    const/4 v1, 0x2

    const-string v2, "Recovery"

    aput-object v2, v0, v1

    sput-object v0, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;->rebootOptions:[Ljava/lang/String;

    return-void
.end method[/COLOR]

Last you need to add the files GlobalActions$99.smali, GlobalActions$99$1.smali, and GlobalActions$99$2.smali to Classout/com/android/internal/policy/impl then recomplie the Classout.
 

Attachments

  • Extrafiles.zip
    7.2 KB · Views: 188
Last edited:

Jamison904

Senior Member
Jun 9, 2009
5,449
15,168
Jacksonville, Florida
Screenshots

Sent from my dark hole called an office.
 

Attachments

  • uploadfromtaptalk1372620442954.jpg
    uploadfromtaptalk1372620442954.jpg
    23.4 KB · Views: 1,528
  • uploadfromtaptalk1372620451201.jpg
    uploadfromtaptalk1372620451201.jpg
    23.2 KB · Views: 1,457

Stevemeister

Senior Member
Dec 25, 2011
643
224
Since you've already figured this one out.... do you also know where/how to change hardware key configuration to stock TW?
 

fOmey

Recognized Developer
Mar 7, 2009
4,128
5,562
Sydney, AUS
Thanks for the guide & the flashable zip.

Would love to see a write up for center clock, %batterymod.. would be great to have guides in a centralized location.
 
Last edited:

elroy944

Senior Member
Oct 8, 2007
1,311
156
Thanks, i think modifying the toggles in notification should be closer now. Or is someone already started on that.
 

Jamison904

Senior Member
Jun 9, 2009
5,449
15,168
Jacksonville, Florida
I think someone is already working on that. One of the threads in the app section has a lot of mods running already. Would be nice to have the function toggle like the TW ROMs. That gives me an idea.
Thanks

Sent from my dark hole called an office.
 
Status
Not open for further replies.

Top Liked Posts

  • There are no posts matching your filters.
  • 19
    This is just a quick how to. Spend a few hours writing this yesterday (see - post and post.) The GlobalActions$SinglePressAction.smali part is from Cristiano Matos Thanks bro! The rest I put together from trail and error. Feel free to use it, a thanks and some credit would be cool. Enjoy. Also huge shout out to my team mate @Mr Impossible for fixing my error. Thanks Bro!!

    Flashable zip - http://d-h.st/Hnt

    For developers, if you would like to see the diff you can see them on my github:






    First you need to decompile the framework-res.apk and navigate and open res/values/layouts.xml and add this to the bottom.
    Code:
    <item type="layout" name="keyguard_transport_control">false</item>
    This will fix the compile error that you get from the stock framework-res.


    Now you need to add the strings and the icon for reboot since stock there are none. Navigate to res/values/strings.xml and add
    Code:
    <string name="reboot">Reboot menu</string>
    Now you need to add the icon to res/drawable-xhdpi/ic_lock_reboot.png (I will attach it later). Now compile the framework-res.apk then decompile it again. We do this so the apktool will add these to the public.xml and assign ID's to them that we will need later. You can put the new compiled framework aside to add to your ROM later.



    Now we will move to the android.policy.jar. You will need decompile the classout. Now go to classout/com/android/internal/policy/impl/GlobalActions.smali and find

    Code:
         invoke-virtual {v0, v1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
    
         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


    Code:
         invoke-virtual {v0, v1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
    [COLOR="Blue"]+
    +    new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$99;
    +
    +    const v2, 0x1080c11 (This is the ID for the Ic_lock_reboot we added to framework-res. add yours)
    +
    +    const v3, 0x10408eb (this is the String ID for reboot)
    +
    +    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
    +[/COLOR]
         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

    Also pro tip: ID's for apps will be in this format 0x01080c11 and in the android.policy.jar is 0x1080c11. Notice that in the android.policy.jar the 0 after the x is removed. 0x01080c11. So when you are comparing remove the 0 if pulling from the public.xml or if you if you are taking from the android.policy.jar you will need to add it to match up.





    This part is from Cristiano Matos Thanks bro!
    classout/com/android/internal/policy/impl/GlobalActions$SinglePressAction.smali

    Find this
    Code:
    .end annotation
    
    
    # instance fields
    .field private final mIconResId:I
    
    .field private final mMessage:Ljava/lang/CharSequence;
    
    .field private final mMessageResId:I



    And between .end annotation and # instance fields, add this
    Code:
    [COLOR="Blue"]# static fields
    .field protected static rebootMode:I
    
    .field protected static final rebootOptions:[Ljava/lang/String;[/COLOR]


    Find this
    Code:
    # direct methods
    .method protected constructor <init>(II)V
        .registers 4
        .parameter "iconResId"
        .parameter "messageResId"

    And between # direct methods and .method protected constructor <init>(II)V, add this
    Code:
    [COLOR="Blue"].method static constructor <clinit>()V
        .registers 3
    
        const/4 v0, 0x3
    
        new-array v0, v0, [Ljava/lang/String;
    
        const/4 v1, 0x0
    
        const-string v2, "Reboot"
    
        aput-object v2, v0, v1
    
        const/4 v1, 0x1
    
        const-string v2, "Download"
    
        aput-object v2, v0, v1
    
        const/4 v1, 0x2
    
        const-string v2, "Recovery"
    
        aput-object v2, v0, v1
    
        sput-object v0, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;->rebootOptions:[Ljava/lang/String;
    
        return-void
    .end method[/COLOR]

    Last you need to add the files GlobalActions$99.smali, GlobalActions$99$1.smali, and GlobalActions$99$2.smali to Classout/com/android/internal/policy/impl then recomplie the Classout.
    10
    Here is a flashable zip :cool:

    http://d-h.st/Hnt

    Sent from my dark hole called an office.
    2
    It works by the way if anyone is wondering :p
    1
    Nice

    Sent from my SGH-M919 using xda premium
    1
    Here is a flashable zip :cool:

    http://d-h.st/Hnt

    Sent from my dark hole called an office.

    Sweet thx man. ..


    Sent from my SGH-M919 using Tapatalk 4 Beta