1% Battery Icons on Liberty (possible?)

Discussion in 'Liberty ROM D2' started by mattXdezzi, Apr 12, 2011.

  1. mattXdezzi
    Offline

    mattXdezzi New Member

    Joined:
    Feb 8, 2011
    Messages:
    50
    Likes Received:
    0
    Trophy Points:
    0
    I'm fairly new to theming but i was looking through my pulled framework-res and found "stat_sys_battery.xml" and "stat_sys_battery_charge.xml"

    I opened them up and started trying to decipher the code:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <level-list
      xmlns:android="http://schemas.android.com/apk/res/android">
        <item android:drawable="@drawable/stat_sys_battery_0" android:maxLevel="0" />
        <item android:drawable="@drawable/stat_sys_battery_10" android:maxLevel="10" />
        <item android:drawable="@drawable/stat_sys_battery_20" android:maxLevel="20" />
        <item android:drawable="@drawable/stat_sys_battery_30" android:maxLevel="30" />
        <item android:drawable="@drawable/stat_sys_battery_40" android:maxLevel="40" />
        <item android:drawable="@drawable/stat_sys_battery_50" android:maxLevel="50" />
        <item android:drawable="@drawable/stat_sys_battery_60" android:maxLevel="60" />
        <item android:drawable="@drawable/stat_sys_battery_70" android:maxLevel="70" />
        <item android:drawable="@drawable/stat_sys_battery_80" android:maxLevel="80" />
        <item android:drawable="@drawable/stat_sys_battery_90" android:maxLevel="90" />
        <item android:drawable="@drawable/stat_sys_battery_100" android:maxLevel="100" />
    </level-list>
    
    I was wondering if you include lines for all 100 values and add the image files, will it show all 100%? So i edited the xml files and created 150 png files (i probably should have tested the concept first). I loaded everything on to my phone and now no battery icon shows up.

    My question is should I keep trying to figure out where I did something wrong, or is it a known issue that the battery resolution is based on a deeper (ROM/Kernel) level?

    thoughts?
  2. hond2
    Offline

    hond2 New Member

    Joined:
    Mar 13, 2011
    Messages:
    58
    Likes Received:
    0
    Trophy Points:
    0
    It must be possible, because an app called battmonx can show 1% on my droid2!
    Now if only I could find someone to write a zip update that would safely remove the original batt indicator from statusbar...

    Sent from my DROID2 using DroidForums
  3. mattXdezzi
    Offline

    mattXdezzi New Member

    Joined:
    Feb 8, 2011
    Messages:
    50
    Likes Received:
    0
    Trophy Points:
    0
    is battmonx an app/widget or does it actually replace the icons in the status bar?

    from what I've heard (i am totally unsure about this) the 1% battery widgets interpolate and estimate between 10% values rather than actually read 1% increments from the phone. again, i am totally unsure about this.
  4. sonicfreak360
    Offline

    sonicfreak360 New Member

    Joined:
    Aug 19, 2010
    Messages:
    534
    Likes Received:
    0
    Trophy Points:
    0


    Sent from my Droid using Tapatalk
  5. txter
    Offline

    txter New Member

    Joined:
    Aug 19, 2010
    Messages:
    223
    Likes Received:
    0
    Trophy Points:
    0
  6. mattXdezzi
    Offline

    mattXdezzi New Member

    Joined:
    Feb 8, 2011
    Messages:
    50
    Likes Received:
    0
    Trophy Points:
    0
  7. pedwards3x
    Offline

    pedwards3x Developer Developer

    Joined:
    Dec 7, 2010
    Messages:
    208
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Indiana
    Your original concept should work just fine, but here's my question: What did you use to decompile the .xmls and how did you edit them and then recompile them?
  8. thebird36
    Offline

    thebird36 New Member

    Joined:
    Oct 31, 2010
    Messages:
    410
    Likes Received:
    1
    Trophy Points:
    0
    Location:
    New York
    Try battery moniter that has 1% increments for the notifcation bar works fine for me

    Sent from my DROID2 using DroidForums
  9. mattXdezzi
    Offline

    mattXdezzi New Member

    Joined:
    Feb 8, 2011
    Messages:
    50
    Likes Received:
    0
    Trophy Points:
    0
    I used APKmanager to decompile and recompile. And I used Metamorph to inject everything into my existing framework-res. I have used the same process to edit my 10% battery icons, as well as my status bar xml files so I hesitate to peg those tools as the problem. flashing the theme went smoothly and im assuming if there was a problem there it would FC and/or not boot at all. Rather, i am beginning to think that there is more to the edit than just those 2 files and the different pngs.

    Has anyone seen a 1% battery tutorial that they could share? ive been searching for a while but havent actually come across a how-to.
  10. mattXdezzi
    Offline

    mattXdezzi New Member

    Joined:
    Feb 8, 2011
    Messages:
    50
    Likes Received:
    0
    Trophy Points:
    0
    link? i googled "battery monitor" (im assuming moniter is a typo) and all i can find is widgets.

    EDIT: I found it, but that just puts a percentage in the NOTIFICATION area, not the actual battery part.
    Last edited: Apr 12, 2011
  11. mattXdezzi
    Offline

    mattXdezzi New Member

    Joined:
    Feb 8, 2011
    Messages:
    50
    Likes Received:
    0
    Trophy Points:
    0
    i have come to the conclusion that i dont think it's possible to get down to 1% increments.

    1. there are a decent amount of D2/DX themers out there (most of whom more talented than myself) and no one has done it. coincidence? (i think not, i havent even seen 5%)
    2. I was able to modify my framework w/ the UOT Kitchen tool and add a 1% battery mod, but it only shows the increments of 10.

    This has lead me to believe that the issue of reading the battery level is a deeper (ROM/kernel/possibly hardware) issue and cannot be fixed through just xml editing.

    If anyone has seen 5%/1% increments on a D2/DX and knows how to do it, I will GLADLY retract the above statement, but i cannot see a way to get there.
  12. TheSwaggeR
    Offline

    TheSwaggeR New Member

    Joined:
    Jan 11, 2011
    Messages:
    744
    Likes Received:
    0
    Trophy Points:
    0
    You can't just change what is in the XML. You'll have to do smali work and add id's. What I mean by id's is that you'll have to go through the java code and redo the id's (R.id.****) and tell it to grab the image for each increment percentage. You will also have to look in the /sys/class/power_supply/battery/charge_counter and make changes to that.

    So that is 3 different areas you've got to make changes in it for it to work.
  13. mattXdezzi
    Offline

    mattXdezzi New Member

    Joined:
    Feb 8, 2011
    Messages:
    50
    Likes Received:
    0
    Trophy Points:
    0
    thanks. thats the answer i was looking for. it is definitely past my level of familiarity w/ android, so i will wait for a dev to put it in a rom, or until i have the time/patience to learn to do it myself.
  14. randizzard
    Offline

    randizzard New Member

    Joined:
    Jan 17, 2011
    Messages:
    138
    Likes Received:
    0
    Trophy Points:
    0
    I don't know if it helps any but I can get 1% increments just using the battery widget from the minimalistic text app from the market...also allows the showing of voltage and temp all in a 1x1 icon.

    View attachment 31383

    Was trying to show screen shot but not sure if it worked

    Sent from my DROID2 using DroidForums
  15. Xplorer4x4
    Offline

    Xplorer4x4 New Member

    Joined:
    Mar 9, 2010
    Messages:
    1,005
    Likes Received:
    4
    Trophy Points:
    0
    Location:
    Evansville,IN
    Per yer statement on page 1, I grabbed battmonx. It does indeed use 1% battery increments.

    Battmonx leads me to believe it is possible! As you all are aware when the battery state on our phones, or any android, hits 15%, a warning message appears on the screen. I noticed that while the stock battery indicator was actually displaying 20%, battmonx was dead on the money at 15%.

    Also, I have investigated the /sys/class/power_supply/battery/charge_counter as mentioned here. Anytime i go to view this file it reports exactly what battmonx reports, well it may be 1% off since battmonx only monitors the battery in certain intervals. I spoke with the dev of battmonx and asked him how he achieved 1% increments for devices like the D2G. Sure enough he says the app pulls the battery percentage from the monitorscharge_counter file.

    Why this has not been implemented in roms, or even an update.zip I have no idea but needless to say I believe this can be done!
  16. Xplorer4x4
    Offline

    Xplorer4x4 New Member

    Joined:
    Mar 9, 2010
    Messages:
    1,005
    Likes Received:
    4
    Trophy Points:
    0
    Location:
    Evansville,IN

    Could you comment what file needs to be run through smali?
  17. TheSwaggeR
    Offline

    TheSwaggeR New Member

    Joined:
    Jan 11, 2011
    Messages:
    744
    Likes Received:
    0
    Trophy Points:
    0
    I can't tell you because I personally have not done any smali and baksmali editing yet. I'm still in the early stages of themeing and application development but if you ask Jrummy, he would be able to shed some light on which files it is. He would know because he has mentioned it before that changing it to 1% increments requires serious smali work and of course he's done the coding for that section for Liberty ROM.
  18. Xplorer4x4
    Offline

    Xplorer4x4 New Member

    Joined:
    Mar 9, 2010
    Messages:
    1,005
    Likes Received:
    4
    Trophy Points:
    0
    Location:
    Evansville,IN
    Thanks for the fast response. Wish I remembered to subscribe. Anyways what do you mean by that statement? Bit confused. I know he is coding the Liberty GB alone from what I read, but are you saying he did the coding in liberty for 1%. I wouldnt think so or I would think it would be integrated. Supposedly it is very easy to do in gingerbread.
    [HOWTO]: 1% steps on gingerbread - xda-developers
  19. TheSwaggeR
    Offline

    TheSwaggeR New Member

    Joined:
    Jan 11, 2011
    Messages:
    744
    Likes Received:
    0
    Trophy Points:
    0
    He's never done 1% increments for any of the various stages of Liberty ROM but he does know which files and coding it is to do it. All his various stages of Liberty ROM has always had 10% increments. It used to be different back in the early days I think, but changes have been made to get a more accurate reading on the status of the battery. He has to implement those files and coding into his ROM in order for us to be able to have a battery status on our notification bar and elsewhere. So, that's why I mentioned him to you because he's done it, but only in 10%, and also knows what files and coding and how to change it to 1% increments. That's why he said "doing 1% increments require serious smali work."
Search tags for this page

can we make 1% battery increment in android with text file

,

stat sys battery.xml for circle battery icon