Android OS Forum banner
1 - 20 of 22 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
 

·
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
 

·
Registered
Joined
·
132 Posts
Discussion Starter · #29 ·
Now will this work on 2-20 build? Also, noob question, is there a way to revert back without having to do a wipe?
you should be able to revert back by just flashing the ics zip w/o any wipes

i'll look into the 2/20 errors, i hadn't tried yet - I'll have to see what changed to determine how long a fix can take
 

·
Registered
Joined
·
132 Posts
Discussion Starter · #31 ·
Oh ok. Is there a way to backup whatever files I am overwriting (if that's what this mod does)? Reflashing the ICS zip is what I was trying to avoid, but no biggie if that's the only way.

Thanks for looking into 2/20.
you don't have to wipe anything other than cache/dalvik - just flash the ics zip which only takes a few seconds (ie no need to delete your data or sytem)
if you want to backup, in your /system/framework grab services.jar, and in /system/app grab SystemUI.apk

i do agree with the comments here on just integrated it into the base roms...that's a WIP :)
 

·
Registered
Joined
·
132 Posts
Discussion Starter · #36 ·
That message did pop up about all of the processes violated it's own policy
That is normal, you will likely get a one-time popup saying the process has violated its self-enforced strictmode policy and it will rebuild the dalvik-cache (~100 apps), don't worry about it. If you flash a different icon pack, you shouldn't get the message again
 

·
Registered
Joined
·
132 Posts
Discussion Starter · #39 ·
This works on the 2-20 build but I had to fix permissions and even then the booklet upgrading and then the message said process x had violated its own strict policy... eventually it worked. Also after that i went in to the settings menu and when i pressed home i got another error afterbtgat there have been no issues. seems like it will need a little work still perhaps we will see it cooked in by the time the next build drops ... that will leave less room for error.
why did you fix permissions? did you just copy over the files in the zip rather than flash from safestrap/bootstrap?
 

·
Registered
Joined
·
132 Posts
*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/
OLD
aokp isn't in the op guys :) it will bootloop

but i do plan on trying to figure out what's needed to get it working on aokp
*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/

EDIT - AOKP version added to op, make sure you download the right one
 

·
Registered
Joined
·
132 Posts
Discussion Starter · #46 ·
shindo, thanks for that info, since I wasn't aware of the extra xmls

but for aokp, since it has battery options in Rom Control, I didn't want to mess too much with the framework

I edited just the aokp services.jar to add the 1% code and it's working fine - for the bionic you can't just edit the xmls, adding to the op now
 

·
Registered
Joined
·
132 Posts
Discussion Starter · #55 ·
I tried to install this version and it softbricked me after boot up as well. Did you not include a SystemUI.apk update in this on purpose? If so, how can the PNG's be loaded if they're not there to begin with?

fyi, I'm running ICS4BIONIC 2/20
http://www.box.com/s...beb5x1u9604uios
Shindo
Your not on aokp... .ics4bionic is cm based, as shown by your screenshot too.. You need to download the other versions since the services.jar isnt compatible

No systemui for aokp on purpose, since aokp Rom Control already has 1% graphics and several choices

Frankie
I'll work on a stub mod for aokp for you

Sent from my XT875 using RootzWiki
 

·
Registered
Joined
·
132 Posts
Discussion Starter · #57 ·
yea there's been lots of confusion....we have lots of rom choices nowadays

pink unicorns (e.g. system/battery) = aokp...doesn't matter if you're on axi0m aokp or DH's aokp...use the aokp version
if system/about has a cyanogenmod version then = cm build...doesn't matter if axi0m or DH's...use the cm version
 

·
Registered
Joined
·
132 Posts
Discussion Starter · #59 ·
Ok perfect. Can't wait for the stub battery for AOKP. :)

Quick question. Assume I have already flashed the upcoming stub battery for AOKP. Do you think I would be able to switch to another battery in the rom settings (and then to get stub back I would just flash it again) or would switching the battery to an option within the rom cause problems?

Thanks!
i don't know yet...i'm guessing it will replace the stock one with the stub gfx, but still allow you to switch to others in rom control, but probably not get the stock one back
 
1 - 20 of 22 Posts
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top