Prepare Your Build Machines: Ubuntu 14.10 Utopic Unicorn Now Official

Today is an important day for any and all Linux enthusiasts. One of the … more

Track the Time You Waste on Social Media with Socials Addict

When you use your phone, you often don’t even realize how much time you … more

Document the Story of Your Social Life with 8tory

The different forms of social media are growing every day. It’s hard to imagine a day … more

Make Calling Your Loved Ones Easier and Cheaper this Diwali

Diwali, or Deepawali as some Indians call it, is the pride and joy of Indian … more
Post Reply

[GUIDE]How to OG BatteryMod

OP sidharth.gtm

2nd June 2014, 04:46 AM   |  #1  
sidharth.gtm's Avatar
OP Senior Member
Flag Patna
Thanks Meter: 332
 
214 posts
Join Date:Joined: May 2012
More
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:
.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;

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:
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" />
Attached Files
File Type: zip smali.zip - [Click for QR Code] (8.3 KB, 67 views)
Last edited by sidharth.gtm; 2nd June 2014 at 05:51 PM.
The Following 7 Users Say Thank You to sidharth.gtm For This Useful Post: [ View ]
2nd June 2014, 08:50 AM   |  #2  
S0bes's Avatar
Senior Member
Flag Tomsk
Thanks Meter: 326
 
317 posts
Join Date:Joined: Jan 2012
Donate to Me
More
@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
Last edited by S0bes; 2nd June 2014 at 09:18 AM.
2nd June 2014, 11:14 AM   |  #3  
XT-107's Avatar
Member
Thanks Meter: 16
 
64 posts
Join Date:Joined: 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: [ View ]
2nd June 2014, 11:17 AM   |  #4  
sidharth.gtm's Avatar
OP Senior Member
Flag Patna
Thanks Meter: 332
 
214 posts
Join Date:Joined: May 2012
More
Quote:
Originally Posted by S0bes

@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.
2nd June 2014, 11:43 AM   |  #5  
sidharth.gtm's Avatar
OP Senior Member
Flag Patna
Thanks Meter: 332
 
214 posts
Join Date:Joined: May 2012
More
Quote:
Originally Posted by XT-107

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
The Following User Says Thank You to sidharth.gtm For This Useful Post: [ View ]
2nd June 2014, 01:42 PM   |  #6  
S0bes's Avatar
Senior Member
Flag Tomsk
Thanks Meter: 326
 
317 posts
Join Date:Joined: Jan 2012
Donate to Me
More
Quote:
Originally Posted by XT-107

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:	393
Size:	72.4 KB
ID:	2776468   Click image for larger version

Name:	Screenshot_2014-06-02-19-40-09[1].png
Views:	305
Size:	64.4 KB
ID:	2776469  
Last edited by S0bes; 2nd June 2014 at 01:46 PM.
2nd June 2014, 04:07 PM   |  #7  
sidharth.gtm's Avatar
OP Senior Member
Flag Patna
Thanks Meter: 332
 
214 posts
Join Date:Joined: May 2012
More
Quote:
Originally Posted by S0bes

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
Last edited by sidharth.gtm; 2nd June 2014 at 05:37 PM.
2nd June 2014, 08:37 PM   |  #8  
Senior Member
Thanks Meter: 785
 
1,566 posts
Join Date:Joined: 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
3rd June 2014, 05:40 AM   |  #9  
yeshwanthvshenoy's Avatar
Senior Member
Flag Chennai
Thanks Meter: 576
 
452 posts
Join Date:Joined: Aug 2012
More
Quote:
Originally Posted by sidharth.gtm

....

awesome guide bro just what i wanted!! thanks a lot hope u keep modding more things for xt1033!! keep it going!
9th June 2014, 08:55 PM   |  #10  
XT-107's Avatar
Member
Thanks Meter: 16
 
64 posts
Join Date:Joined: Sep 2012
not working on stock 4.4.3 ( even with xposed framework and gb installed ).

Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Top Threads in Moto G Themes and Apps by ThreadRank