Android OS Forum banner
1 - 20 of 67 Posts

·
Registered
Joined
·
132 Posts
Sooooooo here it is....a 1% battery mod for Bionic ICS ROMs along with different battery graphics

2-25 - Version for AOKP Added
2-22 - New stub battery graphics (like axi0m stock)
2/17 - New stock-like battery graphics, along with a battery-only zip released
2/15 - Original circle mod release

Thanks to:
dhacker29 for ICS4BIONIC - droidth3ory for axi0m - hashcode0f for Safestrap - he_stheone64 for graphics - gunnermike53 for graphics - nitroglycerine33 for the original mod

Please consider donating to the folks above

Special thanks to all beta testers and supporters

What this does: Allows Bionic to report battery in 1% increments in system/battery, and, if chosen below, will change the battery graphics on the notification bar as well.

For: ICS4BIONIC .902 release. Must be on 2/14 or later.
Axi0m 2/18 release (see Axi0m section)
AOKP and Axi0m AOKP (see AOKP Section)
NOTE: Axi0m has two versions, one based on ICS4BIONIC/CM9 and another based on AOKP. Make sure you get the right one.

Flash in: Safestrap. CWR should work, but is currently untested

Note: During the first flash, you may get a popup saying "the process has violated its self-enforced strictmode policy" and the system will rebuild dalvik cache. This is normal, and should only happen once, even if you try different image packs.

Feedback: Feedback is always appreciated, to know it works and be able to address any issues
----------------------------------------------------------------------------------------------------------------------------
ICS4BIONIC AND Axi0m Versions - NOT AOKP Compatible
----------------------------------------------------------------------------------------------------------------------------
Version 1: Circle Mod Graphics
Download:
via Mediafire - via Dropbox



Version 2: Stock Mod Graphics (thanks gunnermike53)
Download: via Mediafire - via Dropbox


Version 3: Stub Mod Graphics (thanks droidth3ory)
Download: via Mediafire - via Dropbox


1% Mod Only (No Notification Bar Changes)
Download: via Mediafire - via Dropbox

----------------------------------------------------------------------------------------------------------------------------
AOKP Versions

----------------------------------------------------------------------------------------------------------------------------
Since AOKP already has battery options in ROM Control, I just did a 1% edit
You can then select your preference from the Rom Control/Battery section

1% Mod Only - AOKP

Download: via Mediafire - via Dropbox

 

·
Registered
Joined
·
132 Posts
Discussion Starter · #7 ·
Looks great. One suggestion/request would be to use Roboto font. Does the ICS Rom report in 1% increments before this mod?
10% only.. I will update this will details of what the mod consists of and release a 1% only for themers to make/use other icon sets

If there's an icon set someone likes but doesnt know how to package, pm me and i may be able to build...

Sent from my XT875 using RootzWiki
 

·
Android Apprentice
Joined
·
84 Posts
Glad to see we finally have 1%. I was wondering if there was anyway to keep the battery icon the same but allow for 1% increments across the system for widgets and all that. Thanks again
 

·
Registered
Joined
·
2 Posts
What am I doing wrong? Installed it just fine but it has caused by notification bar to disappear. I know its doing what its supposed to because when I go to battery statistics it is showing the battery life in 1% increments.
 

·
Android Beginner
Joined
·
63 Posts
What am I doing wrong? Installed it just fine but it has caused by notification bar to disappear. I know its doing what its supposed to because when I go to battery statistics it is showing the battery life in 1% increments.
Are you using NOVA Launcher? Same thing happened to me and i'm using nova. I'm going to uninstall launcher and see if that fixes it.
 

·
Registered
Joined
·
132 Posts
Discussion Starter · #12 ·
hmm, i just installed nova b14 this morning (as apk) and didn't have any issues with the notification bar...
levi - you shouldn't need a restore, flashing the ics zip on top would clear the mod changes
 

·
Registered
Joined
·
132 Posts
Discussion Starter · #16 ·
i've been getting a few pms about just having accurate battery, so ii'll post a 1% only mod into the op, along with the services.jar for themers to add to their update zips

as for how this was done: the original mod was a zip file containing changes to services.jar, which sourced from some work a developer did for the milestone 2 (droid 2) and adapted for the Bionic. The key was editing the BatteryService.smali by decompiling services.jar/classes.dex

Using diffuse, I compared the 902 services.jar to the modded one and there were 3 lines inserted to get the system to report 1%:

Part 1
Under #instance fields add this line under .field private mBatteryLevel:I
Code:
<br />
.field private mBatteryLevel1Step:I<br />
Part 2
After .method static synthetic access$000(Lcom/android/server/BatteryService;)V, add the following method:
Code:
<br />
.method private getBatteryLevel1Step()V<br />
    .locals 8<br />
    .prologue<br />
    .line 30<br />
    const/4 v4, 0x0<br />
    .line 32<br />
    .local v4, [URL=reader:Ljava/io/FileReader]reader:Ljava/io/FileReader[/URL];<br />
    :try_start_0<br />
    new-instance v5, Ljava/io/FileReader;<br />
    const-string v6, "/sys/class/power_supply/battery/charge_counter"<br />
    invoke-direct {v5, v6}, Ljava/io/FileReader;-><init>(Ljava/lang/String;)V<br />
    :try_end_0<br />
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_1<br />
    .end local v4		   #reader:Ljava/io/FileReader;<br />
    .local v5, [URL=reader:Ljava/io/FileReader]reader:Ljava/io/FileReader[/URL];<br />
    move-object v4, v5<br />
    .line 35<br />
    .end local v5		   #reader:Ljava/io/FileReader;<br />
    .restart local v4	   #reader:Ljava/io/FileReader;<br />
    :goto_0<br />
    const/16 v6, 0x14<br />
    :try_start_1<br />
    new-array v1, v6, [C<br />
    .line 36<br />
    .local v1, buf:[C<br />
    invoke-virtual {v4, v1}, Ljava/io/FileReader;->read([C)I<br />
    move-result v3<br />
    .line 37<br />
    .local v3, read:I<br />
    invoke-virtual {v4}, Ljava/io/FileReader;->close()V<br />
    .line 38<br />
    new-instance v0, Ljava/lang/String;<br />
    const/4 v6, 0x0<br />
    invoke-direct {v0, v1, v6, v3}, Ljava/lang/String;-><init>([CII)V<br />
    .line 39<br />
    .local v0, [URL=batteryLevelsysfs:Ljava/lang/String]batteryLevelsysfs:Ljava/lang/String[/URL];<br />
    const-string v6, "\n"<br />
    const-string v7, ""<br />
    invoke-virtual {v0, v6, v7}, Ljava/lang/String;->replace(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/lang/String;<br />
    move-result-object v0<br />
    .line 40<br />
    invoke-static {v0}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I<br />
    move-result v2<br />
    .line 41<br />
    .local v2, mBatteryLevel1Step:I<br />
    const/16 v6, 0x64<br />
    if-lt v2, v6, :cond_0<br />
    .line 42<br />
    const/16 v2, 0x64<br />
    .line 45<br />
    :cond_0<br />
    sget-object v6, Ljava/lang/System;->out:Ljava/io/PrintStream;<br />
    iput v2, p0, Lcom/android/server/BatteryService;->mBatteryLevel1Step:I<br />
    :try_end_1<br />
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0<br />
    .line 52<br />
    .end local v0		   #batteryLevelsysfs:Ljava/lang/String;<br />
    .end local v1		   #buf:[C<br />
    .end local v2		   #mBatteryLevel1Step:I<br />
    .end local v3		   #read:I<br />
    :goto_1<br />
    return-void<br />
    .line 48<br />
    :catch_0<br />
    move-exception v6<br />
    goto :goto_1<br />
    .line 33<br />
    :catch_1<br />
    move-exception v6<br />
    goto :goto_0<br />
.end method<br />
Part 3
And finally, under const-string v3, "level", after iget v4, p0, Lcom/android/server/BatteryService;->mBatteryLevel:I, add
Code:
<br />
    invoke-direct {p0}, Lcom/android/server/BatteryService;->getBatteryLevel1Step()V<br />
<br />
    iget v4, p0, Lcom/android/server/BatteryService;->mBatteryLevel1Step:I<br />
OK - well that wroked for gingerbread, but BatteryService was different in the ICS build...
Fortunately, although the ICS file moved some code around, it was the same for pieces 1 & 2, and required minor changes to part three, where const-string was moved to v2 (const-string v2, "level"), and now read:
Code:
<br />
    iget v3, p0, Lcom/android/server/BatteryService;->mBatteryLevel:I<br />
<br />
<br />
    invoke-virtual {v1, v2, v3}, Landroid/content/Intent;->putExtra(Ljava/lang/String;I)Landroid/content/Intent;<br />
so the code simply had to be adjusted to:
Code:
<br />
    iget v3, p0, Lcom/android/server/BatteryService;->mBatteryLevel:I<br />
<br />
<br />
    invoke-direct {p0}, Lcom/android/server/BatteryService;->getBatteryLevel1Step()V<br />
<br />
    iget v3, p0, Lcom/android/server/BatteryService;->mBatteryLevel1Step:I<br />
<br />
<br />
    invoke-virtual {v1, v2, v3}, Landroid/content/Intent;->putExtra(Ljava/lang/String;I)Landroid/content/Intent;<br />
ie change from v4 to v3
 
1 - 20 of 67 Posts
Top