[GUIDE]How to OG BatteryMod

Search This thread

sidharth.gtm

Senior Member
May 11, 2012
222
395
Patna
Things you will need

1. Apktool 2.0
2. NotePad ++
3. Xposed Installed on Your Mobile

STEPS :
1. Decompile your SystemUI.apk

2. Open the file (\SystemUI\smali\com\android\systemui\statusbar\phone\PhoneStatusBar.smali)

3. Find the Line(around at 36)
Code:
.field mBatteryController:Lcom/android/systemui/statusbar/policy/BatteryController;
Replace with
Code:
.field mBatteryController:Lcom/ghareeb/BatteryMod/BatteryController;

Then find (around at 8511)
Code:
new-instance v0, Lcom/android/systemui/statusbar/policy/BatteryController;
Replace with
Code:
new-instance v0, Lcom/ghareeb/BatteryMod/BatteryController;

Then find
Code:
invoke-direct {v0, v2}, Lcom/android/systemui/statusbar/policy/BatteryController;-><init>(Landroid/content/Context;)V
Replace with
Code:
invoke-direct {v0, v2}, Lcom/ghareeb/BatteryMod/BatteryController;-><init>(Landroid/content/Context;)V

Then find
Code:
iput-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBatteryController:Lcom/android/systemui/statusbar/policy/BatteryController;
Replace with
Code:
iput-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBatteryController:Lcom/ghareeb/BatteryMod/BatteryController;

4. Now add these lines below above line
Code:
iget-object v3, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBatteryController:Lcom/ghareeb/BatteryMod/BatteryController;

iget-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStatusBarView:Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;

[color=red]const v4, 0x7f07002d[/color]   #  public id of battery

invoke-virtual {v0, v4}, Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;->findViewById(I)Landroid/view/View;

move-result-object v0

check-cast v0, Landroid/widget/ImageView;

invoke-virtual {v3, v0}, Lcom/ghareeb/BatteryMod/BatteryController;->addIconView(Landroid/widget/ImageView;)V

5.Find around line 9033
Code:
iget-object v3, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBatteryController:Lcom/android/systemui/statusbar/policy/BatteryController;
replace with
Code:
iget-object v3, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBatteryController:Lcom/ghareeb/BatteryMod/BatteryController;

and around line 9553

Code:
iget-object v3, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBatteryController:Lcom/android/systemui/statusbar/policy/BatteryController;
replace with
Code:
iget-object v3, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBatteryController:Lcom/ghareeb/BatteryMod/BatteryController;

Note : the concept here is to replace all
Code:
Lcom/android/systemui/statusbar/policy/BatteryController
with
Code:
Lcom/ghareeb/BatteryMod/BatteryController

6. extract and copy the attached smali.zip to /smali/com/

7.Open res/layout/msim_status_bar.xml or status_bar.xml
find
Code:
<com.android.systemui.BatteryMeterView android:id="@id/battery" android:layout_width="10.5dip" android:layout_height="16.0dip" android:layout_marginBottom="0.33000004dip" android:layout_marginStart="4.0dip" />
replace with
Code:
<ImageView android:id="@id/battery" android:paddingLeft="2.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" />

NOTE: android:layout_height="wrap_content" renders big battery icon you can instead use android:layout_height="18.dip"

8. compile the SystemUI

9. Now download OG BatteryMod and put it in (system\app) folder.

ORIGINAL GUIDE ADAPTED FOR MOTO G

BUGS :
0% text always in Quick Setting Battery Icon

Temporary Fix :
Disable the Text by : editing quick_settings_title_battery.xml
Code:
<TextView android:gravity="top|center" android:layout_gravity="top|center" android:id="@id/text" android:layout_width="fill_parent" android:layout_height="wrap_content" style="@style/TextAppearance.QuickSettings.TileView" />

to

Code:
<TextView android:gravity="top|center" android:layout_gravity="top|center" android:id="@id/text" android:layout_width="0.0dip" android:layout_height="0.0dip" style="@style/TextAppearance.QuickSettings.TileView" />
 

Attachments

  • smali.zip
    8.3 KB · Views: 120
Last edited:

S0bes

Senior Member
Jan 1, 2012
870
969
@sidharth.gtm
xt1032
com.android.systemui has stopped
That's what I see after applying modded SystemUI

I compared mine PhoneStatusBar.smali and your http://xdaforums.com/showthread.php?t=2769177
They're the same.
I also changed msim_status_bar.xml and status_bar.xml (ImageView android:id="@id/battery") but it didn't help
___
Replaced BatteryController.smali still error :I
 
Last edited:

sidharth.gtm

Senior Member
May 11, 2012
222
395
Patna

S0bes

Senior Member
Jan 1, 2012
870
969
its not working if xposed framework isn't installed . systemui crashes .:silly:
when I tested it I had turned off all xposed modules.
Now I turned on gravitibox and it's working!
But I still have something strange. Battery icon is smaller than usual (twice size smaller) and battery tile shows 0 %.
____
I changed status_bar.xml and icon seems to be fine now. But still 0% battery tile.
<ImageView android:id="@id/battery" android:paddingLeft="4.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" />

@sidharth.gtm I think you should mention about status_bar.xml (msim_status_bar.xml) editing as well as gravitibox module is required
Anyway thank you for this guide
 
Last edited:

sidharth.gtm

Senior Member
May 11, 2012
222
395
Patna
when I tested it I had turned off all xposed modules.
Now I turned on gravitibox and it's working!
But I still have something strange. Battery icon is smaller than usual (twice size smaller) and battery tile shows 0 %.
____
I changed status_bar.xml and icon seems to be fine now. But still 0% battery tile.
<ImageView android:id="@id/battery" android:paddingLeft="4.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" />

@sidharth.gtm I think you should mention about status_bar.xml (msim_status_bar.xml) editing as well as gravitibox module is required
Anyway thank you for this guide

Thanks for pointing out .. added in OP
for that 0% bug .. i don't have any fix right now :(
U can disable that by editing quick_settings_title_battery.xml
 
Last edited:

coldflid

Senior Member
Dec 27, 2010
1,586
782
Nice info, i tried to get it to work a few weeks back and wasn't able to, now i realised it was because of the xposed requirement
 

HeisehKiiN

Senior Member
Jan 3, 2014
124
30
Will this one work with custom roms?
Or can you make a guide on how to get imaged battery icons, for custom roms? plz, there is nobody else that can do it for us ://
 

pico hackr

Senior Member
Jul 12, 2012
1,307
1,950
CiTy oF HeAvEn
Hey bro is it possible to make this mod on 4.4.3 if so i can share the systemUI apk and systemUI odex here

Sent from my XT1033 using XDA Premium 4 mobile app
 

Top Liked Posts

  • There are no posts matching your filters.
  • 6
    Things you will need

    1. Apktool 2.0
    2. NotePad ++
    3. Xposed Installed on Your Mobile

    STEPS :
    1. Decompile your SystemUI.apk

    2. Open the file (\SystemUI\smali\com\android\systemui\statusbar\phone\PhoneStatusBar.smali)

    3. Find the Line(around at 36)
    Code:
    .field mBatteryController:Lcom/android/systemui/statusbar/policy/BatteryController;
    Replace with
    Code:
    .field mBatteryController:Lcom/ghareeb/BatteryMod/BatteryController;

    Then find (around at 8511)
    Code:
    new-instance v0, Lcom/android/systemui/statusbar/policy/BatteryController;
    Replace with
    Code:
    new-instance v0, Lcom/ghareeb/BatteryMod/BatteryController;

    Then find
    Code:
    invoke-direct {v0, v2}, Lcom/android/systemui/statusbar/policy/BatteryController;-><init>(Landroid/content/Context;)V
    Replace with
    Code:
    invoke-direct {v0, v2}, Lcom/ghareeb/BatteryMod/BatteryController;-><init>(Landroid/content/Context;)V

    Then find
    Code:
    iput-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBatteryController:Lcom/android/systemui/statusbar/policy/BatteryController;
    Replace with
    Code:
    iput-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBatteryController:Lcom/ghareeb/BatteryMod/BatteryController;

    4. Now add these lines below above line
    Code:
    iget-object v3, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBatteryController:Lcom/ghareeb/BatteryMod/BatteryController;
    
    iget-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStatusBarView:Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;
    
    [color=red]const v4, 0x7f07002d[/color]   #  public id of battery
    
    invoke-virtual {v0, v4}, Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;->findViewById(I)Landroid/view/View;
    
    move-result-object v0
    
    check-cast v0, Landroid/widget/ImageView;
    
    invoke-virtual {v3, v0}, Lcom/ghareeb/BatteryMod/BatteryController;->addIconView(Landroid/widget/ImageView;)V

    5.Find around line 9033
    Code:
    iget-object v3, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBatteryController:Lcom/android/systemui/statusbar/policy/BatteryController;
    replace with
    Code:
    iget-object v3, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBatteryController:Lcom/ghareeb/BatteryMod/BatteryController;

    and around line 9553

    Code:
    iget-object v3, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBatteryController:Lcom/android/systemui/statusbar/policy/BatteryController;
    replace with
    Code:
    iget-object v3, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBatteryController:Lcom/ghareeb/BatteryMod/BatteryController;

    Note : the concept here is to replace all
    Code:
    Lcom/android/systemui/statusbar/policy/BatteryController
    with
    Code:
    Lcom/ghareeb/BatteryMod/BatteryController

    6. extract and copy the attached smali.zip to /smali/com/

    7.Open res/layout/msim_status_bar.xml or status_bar.xml
    find
    Code:
    <com.android.systemui.BatteryMeterView android:id="@id/battery" android:layout_width="10.5dip" android:layout_height="16.0dip" android:layout_marginBottom="0.33000004dip" android:layout_marginStart="4.0dip" />
    replace with
    Code:
    <ImageView android:id="@id/battery" android:paddingLeft="2.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" />

    NOTE: android:layout_height="wrap_content" renders big battery icon you can instead use android:layout_height="18.dip"

    8. compile the SystemUI

    9. Now download OG BatteryMod and put it in (system\app) folder.

    ORIGINAL GUIDE ADAPTED FOR MOTO G

    BUGS :
    0% text always in Quick Setting Battery Icon

    Temporary Fix :
    Disable the Text by : editing quick_settings_title_battery.xml
    Code:
    <TextView android:gravity="top|center" android:layout_gravity="top|center" android:id="@id/text" android:layout_width="fill_parent" android:layout_height="wrap_content" style="@style/TextAppearance.QuickSettings.TileView" />

    to

    Code:
    <TextView android:gravity="top|center" android:layout_gravity="top|center" android:id="@id/text" android:layout_width="0.0dip" android:layout_height="0.0dip" style="@style/TextAppearance.QuickSettings.TileView" />
    1
    its not working if xposed framework isn't installed . systemui crashes .:silly:
    1
    its not working if xposed framework isn't installed . systemui crashes .:silly:

    Yes Xposed is needed .. i think Og battery mod hooks with Xposed.. i will myself logcat and find out.. watch this space