Compiling .xml's for system level mods

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

  1. crdnilfan
    Offline

    crdnilfan New Member

    Joined:
    Dec 22, 2009
    Messages:
    207
    Likes Received:
    0
    Trophy Points:
    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 New Member

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

    blake New Member

    Joined:
    Jan 8, 2010
    Messages:
    55
    Likes Received:
    0
    Trophy Points:
    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 New Member

    Joined:
    Dec 22, 2009
    Messages:
    207
    Likes Received:
    0
    Trophy Points:
    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 New Member

    Joined:
    Jan 8, 2010
    Messages:
    55
    Likes Received:
    0
    Trophy Points:
    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 New Member

    Joined:
    Dec 28, 2009
    Messages:
    677
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Rio Rancho, New Mexico
    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 New Member

    Joined:
    Jan 8, 2010
    Messages:
    55
    Likes Received:
    0
    Trophy Points:
    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 New Member

    Joined:
    Dec 22, 2009
    Messages:
    207
    Likes Received:
    0
    Trophy Points:
    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 New Member

    Joined:
    Dec 28, 2009
    Messages:
    677
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Rio Rancho, New Mexico
    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 New Member

    Joined:
    Dec 22, 2009
    Messages:
    207
    Likes Received:
    0
    Trophy Points:
    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 New Member

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

    kevdog New Member

    Joined:
    Nov 14, 2009
    Messages:
    722
    Likes Received:
    0
    Trophy Points:
    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:
    0
    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 New Member

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

    Topsy New Member

    Joined:
    Dec 28, 2009
    Messages:
    677
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Rio Rancho, New Mexico
    I think i'm onto something, although I keep getting an invalid start tag for level-list that has me stumped atm.
  16. zathus
    Offline

    zathus New Member

    Joined:
    Dec 13, 2009
    Messages:
    243
    Likes Received:
    8
    Trophy Points:
    0
    Location:
    El cajon Ca
    Ive tried a few differnt things but the result seems to be the same, I loss my battery icon all together. keep us updated on any progress! Im excited to get this one figered out
  17. RichStevenson
    Offline

    RichStevenson New Member

    Joined:
    Nov 11, 2009
    Messages:
    476
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Medina, OH
  18. blake
    Offline

    blake New Member

    Joined:
    Jan 8, 2010
    Messages:
    55
    Likes Received:
    0
    Trophy Points:
    0
    umm im not very smart, should this jar run as an application? should i be on windows?
  19. crdnilfan
    Offline

    crdnilfan New Member

    Joined:
    Dec 22, 2009
    Messages:
    207
    Likes Received:
    0
    Trophy Points:
    0
  20. Topsy
    Offline

    Topsy New Member

    Joined:
    Dec 28, 2009
    Messages:
    677
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Rio Rancho, New Mexico
    I managed to successfully rewrite and compile the xml through eclipse.

    Issue though is that it assigned new values to the resource_id, which is why everyone loses their battery images when they modify the xml it looks like.

    to pull this off successfully i think the entire framework-res.apk would have to be recreated so it referenced the correct resource_id.
    Otherwise we have to stick to the stock number of images, but could change the percentages and images only.
Search tags for this page
android xml without recompile
,
edit stat sys battery xml
,
how to compile xml file android
,
how to edit resource id in stat sys battery.xml in android
,
lucas hohmann date sites
,
modificar stats sys batery .xml
,
moding xml android
,
recompile edit xml
,
stat sys battery charge.xml razr d3
,
stat sys battery xml
,
stat sys battery xml file edit
,

stat sys battery.xml

,
stat system charge xml
,
stock stat sys battery.xml
,
tw stat sys battery.xml edit