Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,785,741 Members 47,075 Now Online
XDA Developers Android and Mobile Development Forum

[GUIDE]OGBattery Mod for KK

Tip us?
 
meawww
Old
(Last edited by meawww; 25th April 2014 at 03:06 PM.)
#1  
meawww's Avatar
Senior Member - OP
Thanks Meter 449
Posts: 370
Join Date: Dec 2013
Location: Rome

 
DONATE TO ME
Smile [GUIDE]OGBattery Mod for KK

This is a guide how to add OG Battery Mod for kitkat 4.4 based on ND3 files,
Working with Galaxy S5 too tested by @SandeepEmekar

1: Decompile SystemUI.apk
2: Open the file (\SystemUI\smali\com\android\systemui\statusbar\ph one\PhoneStatusBar.smali)

3: Search the line (Around line 102 stock ND3)
Code:
.field mBatteryController:Lcom/android/systemui/statusbar/policy/BatteryController;
Replace with
Code:
.field mBatteryController:Lcom/ghareeb/BatteryMod/BatteryController;
4: Search the line (Around line 10689 stock ND3)
Code:
invoke-direct/range {v25 .. v26}, Lcom/android/systemui/statusbar/policy/BatteryController;-><init>(Landroid/content/Context;)V
Replace with
Code:
invoke-direct/range {v25 .. v26}, Lcom/ghareeb/BatteryMod/BatteryController;-><init>(Landroid/content/Context;)V
5: Search the line (Around line 10681 stock ND3)
Code:
.line 723
    new-instance v25, Lcom/android/systemui/statusbar/policy/BatteryController;

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mContext:Landroid/content/Context;

    move-object/from16 v26, v0

    invoke-direct/range {v25 .. v26}, Lcom/android/systemui/statusbar/policy/BatteryController;-><init>(Landroid/content/Context;)V

    move-object/from16 v0, v25

    move-object/from16 v1, p0

    iput-object v0, v1, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBatteryController:Lcom/android/systemui/statusbar/policy/BatteryController;
Replace with
Code:
    .line 723
    new-instance v25, Lcom/ghareeb/BatteryMod/BatteryController;

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mContext:Landroid/content/Context;

    move-object/from16 v26, v0

    invoke-direct/range {v25 .. v26}, Lcom/ghareeb/BatteryMod/BatteryController;-><init>(Landroid/content/Context;)V

    move-object/from16 v0, v25

    move-object/from16 v1, p0

    iput-object v0, v1, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBatteryController:Lcom/ghareeb/BatteryMod/BatteryController;
FOR S5 USERS!!! Follow this red line to the end of other red line
______________________________________

Find the line
Code:
.line 827
    new-instance v29, Lcom/android/systemui/statusbar/policy/BatteryController;

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mContext:Landroid/content/Context;

    move-object/from16 v30, v0

    invoke-direct/range {v29 .. v30}, Lcom/ghareeb/BatteryMod/BatteryController;-><init>(Landroid/content/Context;)V

    move-object/from16 v0, v29

    move-object/from16 v1, p0

    iput-object v0, v1, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBatteryController:Lcom/ghareeb/BatteryMod/BatteryController;
Replace with
Code:
.line 827
    new-instance v29, Lcom/ghareeb/BatteryMod/BatteryController;

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mContext:Landroid/content/Context;

    move-object/from16 v30, v0

    invoke-direct/range {v29 .. v30}, Lcom/ghareeb/BatteryMod/BatteryController;-><init>(Landroid/content/Context;)V

    move-object/from16 v0, v29

    move-object/from16 v1, p0

    iput-object v0, v1, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBatteryController:Lcom/ghareeb/BatteryMod/BatteryController;
______________________________________

6: Now right under the last line you just changed paste this whole code.
Code:
.line 724
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBatteryController:Lcom/ghareeb/BatteryMod/BatteryController;

    move-object/from16 v27, v0

    move-object/from16 v0, p0

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

    move-object/from16 v26, v0

    const v28, 0x7f070078

    move-object/from16 v0, v26

    move/from16 v1, v28

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

    move-result-object v26

    check-cast v26, Landroid/widget/ImageView;

    move-object/from16 v0, v27

    move-object/from16 v1, v26

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

    .line 725
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBatteryController:Lcom/ghareeb/BatteryMod/BatteryController;

    move-object/from16 v26, v0

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBatteryText:Landroid/widget/TextView;

    move-object/from16 v27, v0

    invoke-virtual/range {v26 .. v27}, Lcom/ghareeb/BatteryMod/BatteryController;->addLabelView(Landroid/widget/TextView;)V
FOR S5 USERS!!! Follow this red line to the end of other red line
______________________________________

From the codes above Change the .line 724 to .line 828 and .line 725 to .line 829

______________________________________

7: In the code we just added above you will see the line const v28, 0x7f070078 now check the public.xml under the folder (\SystemUI\res\values\public.xml) and look for the line <public type="id" name="battery" id=" check if you have same number, In my case i have <public type="id" name="battery" id="0x7f070078" />. If you have different number then copy it from public.xml to the number in the smali.

8:Save the smali then go to the folder (\SystemUI\smali\com) download this file Attachment and extract to that folder.

9:Now open the file (\SystemUI\res\layout\status_bar.xml) look for the line
Code:
<com.android.systemui.BatteryMeterView android:id="@id/battery" android:layout_width="12.0dip" android:layout_height="18.0dip" android:layout_marginBottom="0.33000004dip" android:layout_marginStart="5.0dip" />
Replace with
Code:
<ImageView android:gravity="center" android:id="@id/battery" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingStart="3.0dip" />
10: Compile the SystemUI.apk using apk tool and sign it.

11: Now download this file OG BatteryMod and put it inside your phone (system\app) folder.

12:Now push the SystemUI.apk you just compiled inside (system\priv-app).

(Optional)
Add the BatteryMod in phone settings.
1: Decompile SecSettings.apk
2: Open the file (\SecSettings\res\xml\display_headers.xml)
Under the line
Code:
<header android:icon="@drawable/ic_settings_led" android:id="@id/led_indicator_settings" android:title="@string/led_indicator_settings" android:fragment="com.android.settings.LedIndicatorSettings" />
Add this codes
Code:
<header android:icon="@drawable/ic_settings_battery" android:title="@string/battery_mod" android:summary="@string/battery_mod_desc">
        <intent android:targetPackage="com.ghareeb.battery" android:action="android.intent.action.MAIN" android:targetClass="com.ghareeb.battery.Settings" />
</header>
3: Now go open the file (\SecSettings\res\values\string.xml) and add the line
Code:
<string name="battery_mod">OGBattery Mod</string>
<string name="battery_mod_desc">Change battery icon and charging animation.</string>
4: Compile , Sign and push to your (system\priv-app).

5: Enjoy!!!


Credit to the owner of the OGBatteryMod @OsamaGhareeb Thank him here http://forum.xda-developers.com/show...php?p=38905053


Edit: Step 5 was wrong so i fixed it sorry

PS: Working on S5
Attached Files
File Type: rar ghareeb.rar - [Click for QR Code] (7.6 KB, 485 views)
The Following 22 Users Say Thank You to meawww For This Useful Post: [ Click to Expand ]
 
SandeepEmekar
Old
(Last edited by SandeepEmekar; 26th April 2014 at 10:01 AM.) Reason: G900H
#2  
SandeepEmekar's Avatar
Senior Member
Thanks Meter 129
Posts: 564
Join Date: Oct 2011
It works now!

Thank you very much!
 
ksr007
Old
#3  
ksr007's Avatar
Senior Member
Thanks Meter 4,382
Posts: 1,440
Join Date: Apr 2011
Location: Hanoi

 
DONATE TO ME
Quote:
Originally Posted by SandeepEmekar View Post
I can confirm that it doesn't work with Samsung Galaxy S5.

I have attached the original SystemUI.apk in case someone wants to look into it.
This guide is useful than for S5 : http://forum.xda-developers.com/show....php?t=2628560
The Following User Says Thank You to ksr007 For This Useful Post: [ Click to Expand ]
 
SandeepEmekar
Old
#4  
SandeepEmekar's Avatar
Senior Member
Thanks Meter 129
Posts: 564
Join Date: Oct 2011
Quote:
Originally Posted by ksr007 View Post
I tried that too but I messed up somewhere in the process as it don't have 0-100% battery.
 
ksr007
Old
#5  
ksr007's Avatar
Senior Member
Thanks Meter 4,382
Posts: 1,440
Join Date: Apr 2011
Location: Hanoi

 
DONATE TO ME
Quote:
Originally Posted by SandeepEmekar View Post
I tried that too but I messed up somewhere in the process as it don't have 0-100% battery.
Some dev will coming to S5, so just wait and i think that they will do some mods for S5
 
SandeepEmekar
Old
#6  
SandeepEmekar's Avatar
Senior Member
Thanks Meter 129
Posts: 564
Join Date: Oct 2011
Quote:
Originally Posted by ksr007 View Post
Some dev will coming to S5, so just wait and i think that they will do some mods for S5
Yep,
I am trying to be patient
 
saywhatt
Old
#7  
saywhatt's Avatar
Recognized Contributor
Thanks Meter 1,511
Posts: 2,853
Join Date: Apr 2012
Location: Land of Ooo

 
DONATE TO ME
Thank you for this guide kababayan @meawww

Sent from my SM-N9005 using XDA Premium 4 mobile app
The Following User Says Thank You to saywhatt For This Useful Post: [ Click to Expand ]
 
meawww
Old
#8  
meawww's Avatar
Senior Member - OP
Thanks Meter 449
Posts: 370
Join Date: Dec 2013
Location: Rome

 
DONATE TO ME
Quote:
Originally Posted by saywhatt View Post
Thank you for this guide kababayan @meawww

Sent from my SM-N9005 using XDA Premium 4 mobile app
Yw eehehehe OP Edited working with S5 now too
 
AldrichDSaints
Old
#9  
AldrichDSaints's Avatar
Senior Member
Thanks Meter 25
Posts: 151
Join Date: Oct 2013
Location: Binan City
Quote:
Originally Posted by saywhatt View Post
Thank you for this guide kababayan @meawww

Sent from my SM-N9005 using XDA Premium 4 mobile app
You're a Filipino too?
Samsung Galaxy Note 3 SM-N9005

Previous Devices:
Samsung Galaxy S II
Samsung Galaxy S I9000
Samsung Galaxy Ace S5830
 
meawww
Old
#10  
meawww's Avatar
Senior Member - OP
Thanks Meter 449
Posts: 370
Join Date: Dec 2013
Location: Rome

 
DONATE TO ME
Quote:
Originally Posted by AldrichDSaints View Post
You're a Filipino too?
Half

Tags
battery icon, batterymod, ogbattery
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes