Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,739,536 Members 53,052 Now Online
XDA Developers Android and Mobile Development Forum

[GUIDE]How to OG BatteryMod

Tip us?
 
sidharth.gtm
Old
(Last edited by sidharth.gtm; 2nd June 2014 at 05:51 PM.)
#1  
sidharth.gtm's Avatar
Senior Member - OP
Thanks Meter 303
Posts: 213
Join Date: May 2012
Location: Patna
Default [GUIDE]How to OG BatteryMod

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\ph one\PhoneStatusBar.smali)

3. Find the Line(around at 36)
Code:
Select Code
.field mBatteryController:Lcom/android/systemui/statusbar/policy/BatteryController;
Replace with
Code:
Select Code
.field mBatteryController:Lcom/ghareeb/BatteryMod/BatteryController;
Then find (around at 8511)
Code:
Select Code
new-instance v0, Lcom/android/systemui/statusbar/policy/BatteryController;
Replace with
Code:
Select Code
new-instance v0, Lcom/ghareeb/BatteryMod/BatteryController;
Then find
Code:
Select Code
invoke-direct {v0, v2}, Lcom/android/systemui/statusbar/policy/BatteryController;-><init>(Landroid/content/Context;)V
Replace with
Code:
Select Code
invoke-direct {v0, v2}, Lcom/ghareeb/BatteryMod/BatteryController;-><init>(Landroid/content/Context;)V
Then find
Code:
Select Code
iput-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBatteryController:Lcom/android/systemui/statusbar/policy/BatteryController;
Replace with
Code:
Select 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:
Select 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;

const v4, 0x7f07002d   #  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:
Select Code
iget-object v3, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBatteryController:Lcom/android/systemui/statusbar/policy/BatteryController;
replace with
Code:
Select Code
iget-object v3, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBatteryController:Lcom/ghareeb/BatteryMod/BatteryController;
and around line 9553

Code:
Select Code
iget-object v3, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBatteryController:Lcom/android/systemui/statusbar/policy/BatteryController;
replace with
Code:
Select 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:
Select Code
Lcom/android/systemui/statusbar/policy/BatteryController
with
Code:
Select 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:
Select 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:
Select 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:
Select 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:
Select 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" />
Attached Files
File Type: zip smali.zip - [Click for QR Code] (8.3 KB, 47 views)


 
सारे जहाँ से अच्छा हिन्दोस्तान हमारा

Proud to be an Indian

MY DEVICE
XPERIA MINI ST15i - UNLOCKED CM11
XPERIA U - ROOTED LOCKED
DELL XCD 35
MOTO G
The Following 7 Users Say Thank You to sidharth.gtm For This Useful Post: [ Click to Expand ]
 
S0bes
Old
(Last edited by S0bes; 2nd June 2014 at 09:18 AM.)
#2  
S0bes's Avatar
Senior Member
Thanks Meter 147
Posts: 194
Join Date: Jan 2012
Location: Tomsk

 
DONATE TO ME
@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://forum.xda-developers.com/show....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
 
XT-107
Old
#3  
XT-107's Avatar
Member
Thanks Meter 13
Posts: 52
Join Date: Sep 2012
its not working if xposed framework isn't installed . systemui crashes .
The Following User Says Thank You to XT-107 For This Useful Post: [ Click to Expand ]
 
sidharth.gtm
Old
#4  
sidharth.gtm's Avatar
Senior Member - OP
Thanks Meter 303
Posts: 213
Join Date: May 2012
Location: Patna
Quote:
Originally Posted by S0bes View Post
@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://forum.xda-developers.com/show....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
share your logcat ..
because without logcat i can't help.


 
सारे जहाँ से अच्छा हिन्दोस्तान हमारा

Proud to be an Indian

MY DEVICE
XPERIA MINI ST15i - UNLOCKED CM11
XPERIA U - ROOTED LOCKED
DELL XCD 35
MOTO G
 
sidharth.gtm
Old
#5  
sidharth.gtm's Avatar
Senior Member - OP
Thanks Meter 303
Posts: 213
Join Date: May 2012
Location: Patna
Quote:
Originally Posted by XT-107 View Post
its not working if xposed framework isn't installed . systemui crashes .
Yes Xposed is needed .. i think Og battery mod hooks with Xposed.. i will myself logcat and find out.. watch this space


 
सारे जहाँ से अच्छा हिन्दोस्तान हमारा

Proud to be an Indian

MY DEVICE
XPERIA MINI ST15i - UNLOCKED CM11
XPERIA U - ROOTED LOCKED
DELL XCD 35
MOTO G
The Following User Says Thank You to sidharth.gtm For This Useful Post: [ Click to Expand ]
 
S0bes
Old
(Last edited by S0bes; 2nd June 2014 at 01:46 PM.)
#6  
S0bes's Avatar
Senior Member
Thanks Meter 147
Posts: 194
Join Date: Jan 2012
Location: Tomsk

 
DONATE TO ME
Quote:
Originally Posted by XT-107 View Post
its not working if xposed framework isn't installed . systemui crashes .
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" androidaddingLeft="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
Attached Thumbnails
Click image for larger version

Name:	Screenshot_2014-06-02-19-40-27[1].png
Views:	374
Size:	72.4 KB
ID:	2776468   Click image for larger version

Name:	Screenshot_2014-06-02-19-40-09[1].png
Views:	293
Size:	64.4 KB
ID:	2776469  
 
sidharth.gtm
Old
(Last edited by sidharth.gtm; 2nd June 2014 at 05:37 PM.)
#7  
sidharth.gtm's Avatar
Senior Member - OP
Thanks Meter 303
Posts: 213
Join Date: May 2012
Location: Patna
Quote:
Originally Posted by S0bes View Post
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" androidaddingLeft="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


 
सारे जहाँ से अच्छा हिन्दोस्तान हमारा

Proud to be an Indian

MY DEVICE
XPERIA MINI ST15i - UNLOCKED CM11
XPERIA U - ROOTED LOCKED
DELL XCD 35
MOTO G
 
coldflid
Old
#8  
Senior Member
Thanks Meter 780
Posts: 1,557
Join Date: Dec 2010

 
DONATE TO ME
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
 
yeshwanthvshenoy
Old
#9  
yeshwanthvshenoy's Avatar
Senior Member
Thanks Meter 501
Posts: 425
Join Date: Aug 2012
Location: Chennai
Quote:
Originally Posted by sidharth.gtm View Post
....
awesome guide bro just what i wanted!! thanks a lot hope u keep modding more things for xt1033!! keep it going!

 
 
XT-107
Old
#10  
XT-107's Avatar
Member
Thanks Meter 13
Posts: 52
Join Date: Sep 2012
not working on stock 4.4.3 ( even with xposed framework and gb installed ).

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


XDA PORTAL POSTS

Return to Outer Space Outer Space with Ship Up Game

Since the release of Flappy Birds, we’ve had the “fortune” to see … more

Device Review: OnePlus One

Seemingly every day, there are a bunch of new devices being released. Some are budget devices and some are … more

Browse the Internet with the Innovative Atlas Web Browser

For the most part, Chrome, Firefox, and Dolphin Browser have no real rivals among … more

Choose from Over a Thousand Battery Styles with 3Minit Battery Mod

The battery style in stock Android looks pretty dull. It doesn’t … more