• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!
  • Fill out your device list and let everyone know which phones you have!    Edit Your Device Inventory

Very simple "1%" One Percent Battery Hack!

Search This thread

J_C_D

Member
Jan 30, 2012
18
13
Mannheim / Germany
Hi Folks,
I'm not sure whether this is the right place, but I just wanted to share this information:

There is a very simple way of forcing all Apks of a rooted Defy with init.d support to read battery stats with 1% accuracy. Just add this script in /system/etc/init.d/ and name it something like '12onepercentbattery':
Code:
#!/system/bin/sh
# fake access to 10% battery status to 1% 
busybox mount -o bind /sys/class/power_supply/battery/charge_counter /sys/class/power_supply/battery/capacity

I basically tested this on a 4.5.1-134_DFP-74 modded by Greenbreadmod_1.1 on a green lensed Defy.

Explanation: in sysfs /sys/class/power_supply/battery directory the kernel provides a 1% charge counter by the file 'charge_counter', but the Android framework only reads 'capacity' which only has 10% accuracy.
The script establishes a file system redirection from 'capacity' to 'charge_counter', so all Android apks will read the more accurate charge counter instead :)

Hope this helps someone out there...
 
  • Like
Reactions: thekguy

pradeeppk

Senior Member
Feb 8, 2012
568
150
KERALA

J_C_D

Member
Jan 30, 2012
18
13
Mannheim / Germany
It is great If It works. Because many people facing battery drop issues. i am trying it today and report later. Its more good if u include details of how to make an int.d file, what are the required permissions for the file etc in your first post
Thanks

The hack I present here e.g. fixes bad accuracy of the battery level display in " menu > settings > about phone > status " and also increases resolution of the stock battery usage graph. In general, it forces ALL Apps to use the 1% accuracy reading by very simple means.
Please note that this does not change the way the battery charge level is displayed in the notification bar on the home screen. SystemUI.apk is responsible for the way this information is presented there!

I also believe that battery drops are not related to this. See here http://forum.xda-developers.com/showthread.php?t=1778492 instead!

Note: Support for running scripts at boot in etc/init.d can be achieved in various ways. For example by using 2ndInit (like I do): http://forum.xda-developers.com/showthread.php?t=1032212. Alternatively see here (I did not test this): http://forum.xda-developers.com/showthread.php?t=1431134

Set permissions of the '12onepercentbattery' script to 755 and chown to 0:0.
 

zipike

Member
Feb 20, 2011
18
1
Budapest
I have battery drop issues but I don't think this helps to solve the issue. I see the battery bar 1% accurate and I still have the drops from 45->20 and from 19->4. This means almost half of my battery is dead... :(
 

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    Hi Folks,
    I'm not sure whether this is the right place, but I just wanted to share this information:

    There is a very simple way of forcing all Apks of a rooted Defy with init.d support to read battery stats with 1% accuracy. Just add this script in /system/etc/init.d/ and name it something like '12onepercentbattery':
    Code:
    #!/system/bin/sh
    # fake access to 10% battery status to 1% 
    busybox mount -o bind /sys/class/power_supply/battery/charge_counter /sys/class/power_supply/battery/capacity

    I basically tested this on a 4.5.1-134_DFP-74 modded by Greenbreadmod_1.1 on a green lensed Defy.

    Explanation: in sysfs /sys/class/power_supply/battery directory the kernel provides a 1% charge counter by the file 'charge_counter', but the Android framework only reads 'capacity' which only has 10% accuracy.
    The script establishes a file system redirection from 'capacity' to 'charge_counter', so all Android apks will read the more accurate charge counter instead :)

    Hope this helps someone out there...