Compiling .xml's for system level mods

Discussion in 'Android Hacks and Help' started by crdnilfan, Jan 2, 2010.

DroidForums.net is the premier Android Forum - Registered Users do not see these ads. Please Register - It's Free!
  1. crdnilfan
    Offline

    crdnilfan Member

    Joined:
    Dec 22, 2009
    Messages:
    207
    Likes Received:
    0
    Trophy Points:
    16
    Ratings:
    +0
    Not sure how many people know this, but a lot of the .xml files have been compiled to an unusable format. For certain modifications to be done...we need to decompile, edit, and recompile these files, from my searching I've found no way to do this.

    My final goal is very simple, but the procedure needed to do it will unlock a lot of other modifications, I want to modify the stat_sys_battery.xml file from /system/framework/framework-res.apk/res/drawable/ to show pictures at 10% increments instead of 20.

    attached is a .zip with 11 levels of battery images (0,10,20,30,40,50,60,70,80,90,100) and a supporting stat_sys_battery.xml (not yet compiled)

    If anybody knows how to correctly compile system .xml's, that'd be awesome! I would love to have a more accurate stock battery percentage.

    Attached Files:

  2. ldimick
    Offline

    ldimick Member

    Joined:
    Nov 28, 2009
    Messages:
    632
    Likes Received:
    0
    Trophy Points:
    16
    Ratings:
    +0
    Watching this one!
  3. blake
    Offline

    blake Member

    Joined:
    Jan 8, 2010
    Messages:
    55
    Likes Received:
    0
    Trophy Points:
    6
    Ratings:
    +0
    ive found that you can open this xml and edit it using root explorer on your droid, i do not understand how to link the image to the resource_id number though, hope this helps, if u figure it out please let me know asap
  4. crdnilfan
    Offline

    crdnilfan Member

    Joined:
    Dec 22, 2009
    Messages:
    207
    Likes Received:
    0
    Trophy Points:
    16
    Ratings:
    +0
    good find! how were you able to edit them through root explorer?

    i can view them but can't edit, i have the newest version of root explorer.

    EDIT: i see you can only edit files that aren't inside an .apk...sadly mine is inside an apk. i'll extract it to the sdcard, edit with root explorer, and then try it.

    looking into resource_id also.
  5. blake
    Offline

    blake Member

    Joined:
    Jan 8, 2010
    Messages:
    55
    Likes Received:
    0
    Trophy Points:
    6
    Ratings:
    +0
    hold ur finger on the file till ur options appear then scroll down to editor or sumthing like that, im attempting to make this work now
  6. Topsy
    Offline

    Topsy Member

    Joined:
    Dec 28, 2009
    Messages:
    677
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Rio Rancho, New Mexico
    Ratings:
    +0
    Well i'll be damned...don't know why it never occurred to me to try that.
    You sir, have just made my day!
    :icon_ banana::icon_ banana::icon_ banana::icon_ banana::icon_ banana:
  7. blake
    Offline

    blake Member

    Joined:
    Jan 8, 2010
    Messages:
    55
    Likes Received:
    0
    Trophy Points:
    6
    Ratings:
    +0
    if u make this work please send it to me, i wanna use my own battery pictures with it. Ill let you know if i have any luck myself
  8. crdnilfan
    Offline

    crdnilfan Member

    Joined:
    Dec 22, 2009
    Messages:
    207
    Likes Received:
    0
    Trophy Points:
    16
    Ratings:
    +0
    i know right!!! although bad news...if the .xml is inside an apk it can't be editted directly

    you must extract the .xml from the apk and place it somewhere else, then from there edit it with root explorer.

    when root explorer saves the changes, it doesn't compile it like android does, and thus your editted .xml is considered invalid.

    more must be done, but good first step
  9. Topsy
    Offline

    Topsy Member

    Joined:
    Dec 28, 2009
    Messages:
    677
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Rio Rancho, New Mexico
    Ratings:
    +0
    Just guessing but i'm think you need to recreate the xml in exclipse with your changes, then export out to an unsigned apk, then extract, rename and put it into the framework-res.apk to replace the original.

    Modifying the .9.pngs are processed the same way.
  10. crdnilfan
    Offline

    crdnilfan Member

    Joined:
    Dec 22, 2009
    Messages:
    207
    Likes Received:
    0
    Trophy Points:
    16
    Ratings:
    +0
    i've already hit the road block of after editing the files, them not going back into the "encrypted" format.

    if you get a full edit from a .apk to work, please explain how.
  11. blake
    Offline

    blake Member

    Joined:
    Jan 8, 2010
    Messages:
    55
    Likes Received:
    0
    Trophy Points:
    6
    Ratings:
    +0
    by battery symbols disappeared entireley after my attempt at this, i must have made it invalid like you said
  12. kevdog
    Offline

    kevdog Member

    Joined:
    Nov 14, 2009
    Messages:
    722
    Likes Received:
    0
    Trophy Points:
    16
    Ratings:
    +0
    You cant just hex edit the file? I know you would have to look at the source code and then start counting bytes and such, however I saw a video Stericson made once that explained how to do this -- and it seemed to work. I saw a comment on xda if you want to recompile the xml, you need to do so from source (the whole kit and kaboodle -- dont know if this is true however). If not Id be looking into smali, backsmali.
  13. ChevyNo1
    Offline

    ChevyNo1 Premium Member Premium Member Developer

    Joined:
    Dec 28, 2009
    Messages:
    5,354
    Likes Received:
    5
    Trophy Points:
    153
    Ratings:
    +5
    I thought the system could only read in 20 increments ...

    And I agree with kevdog, pretty sure you need to grab the entire AOSP and build (typically in ubuntu for example).

    OR hex edit
  14. blake
    Offline

    blake Member

    Joined:
    Jan 8, 2010
    Messages:
    55
    Likes Received:
    0
    Trophy Points:
    6
    Ratings:
    +0
    if you go into settings/about phone/status it will tell you in increments of 10%
  15. Topsy
    Offline

    Topsy Member

    Joined:
    Dec 28, 2009
    Messages:
    677
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Rio Rancho, New Mexico
    Ratings:
    +0
    I think i'm onto something, although I keep getting an invalid start tag for level-list that has me stumped atm.
Search tags for this page
android xml without recompile
,
compile android xml
,
edit stat sys battery xml
,
how to compile xml file android
,
how to edit stat sys battery.xml
,
how to properly recompile xml
,
moding xml android
,
stat sys battery xml
,

stat sys battery.xml

,
xml compiler for android