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\phone\PhoneStatusBar.smali)
3: Search the line (Around line 102 stock ND3)
Replace with
4: Search the line (Around line 10689 stock ND3)
Replace with
5: Search the line (Around line 10681 stock ND3)
Replace with
FOR S5 USERS!!! Follow this red line to the end of other red line
______________________________________
Find the line
Replace with
______________________________________
6: Now right under the last line you just changed paste this whole code.
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
Replace with
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
Add this codes
3: Now go open the file (\SecSettings\res\values\string.xml) and add the line
4: Compile , Sign and push to your (system\priv-app).
5: :victory: Enjoy!!!
Credit to the owner of the OGBatteryMod @OsamaGhareeb Thank him here http://xdaforums.com/showthread.php?p=38905053
Edit: Step 5 was wrong so i fixed it sorry :laugh:
PS: Working on S5
Working with Galaxy S5 too tested by @SandeepEmekar
1: Decompile SystemUI.apk
2: Open the file (\SystemUI\smali\com\android\systemui\statusbar\phone\PhoneStatusBar.smali)
3: Search the line (Around line 102 stock ND3)
Code:
.field mBatteryController:Lcom/android/systemui/statusbar/policy/BatteryController;
Code:
.field mBatteryController:Lcom/ghareeb/BatteryMod/BatteryController;
Code:
invoke-direct/range {v25 .. v26}, Lcom/android/systemui/statusbar/policy/BatteryController;-><init>(Landroid/content/Context;)V
Code:
invoke-direct/range {v25 .. v26}, Lcom/ghareeb/BatteryMod/BatteryController;-><init>(Landroid/content/Context;)V
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;
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" />
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: :victory: Enjoy!!!
Credit to the owner of the OGBatteryMod @OsamaGhareeb Thank him here http://xdaforums.com/showthread.php?p=38905053
Edit: Step 5 was wrong so i fixed it sorry :laugh:
PS: Working on S5
Attachments
Last edited: