Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,813,628 Members 38,420 Now Online
XDA Developers Android and Mobile Development Forum

[GUIDE][HOW] Add Battery Percentage On Lockscreen Permanently

Tip us?
 
kartik verma
Old
(Last edited by kartik verma; 2nd August 2014 at 01:57 PM.)
#1  
Senior Member - OP
Thanks Meter 60
Posts: 149
Join Date: Dec 2013
Location: hamirpur h.p
Angry [GUIDE][HOW] Add Battery Percentage On Lockscreen Permanently

Here's A New Guide To Add Battery Percentage On Lockscreen

By Me [Kartik Verma]


Requirements -:


1. android.policy.jar

2. framework-res.apk


PHP Code:
First,We Edit "framework-res.apk"  present here (system/framework/framework-res.apk)

Decompile framework-res.apk Through Apktool (if you dont know how to decompile,See on XDA How to Decompile,Recompile Or Ask Someone)

After Decompiling -> Go Here 
framework-res/res/values/string.xml

PHP Code:
Open String.xml in Notepad++

After Opening -> Hit These Two Keys (ctrl+f)

And 
Copy This____  Charging  ____  Then Hit Enter

Change The Charging Text To____  Charge Status _____ 
-> After Changing -> Save it

Now,Main Work Here in Smali

PHP Code:
Decompile "android.policy.jar" present here (system/framework/android.policy.jar)

After Decompiling -> Open This smali file Through Notepad++

android.policy/com/android/internal/policy/impl/KeyguardUpdateMonitor.smali

Open   KeyguardUpdateMonitor
.smali

Search 
For This Line Through Notepad++ By Hitting Ctrl+
PHP Code:
.method public shouldShowBatteryInfo()
The Whole Code Looks Like....


PHP Code:
.method public shouldShowBatteryInfo()Z
    
.registers 2

    
.prologue
    
.line 1000
    sget v0
Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;->mBatteryInfoState:I

    
if-eqz v0, :cond_6

    
const/4 v00x1

    
:goto_5
    
return v0

    
:cond_6
    
const/4 v00x0

    
goto :goto_5
.end method 

After Editing It Looks Like....

PHP Code:
.method public shouldShowBatteryInfo()Z
    
.registers 2

    
.prologue
    
.line 1000
    sget v0
Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;->mBatteryInfoState:I

    
if-eqz v0, :cond_6

    
const/4 v00x1

    
:goto_5
    
    
const/4 v00x1
    
    
return v0

    
:cond_6
    
const/4 v00x0

    
goto :goto_5
.end method 

ENJOY.......!!!!!!!!!!
The Following 3 Users Say Thank You to kartik verma For This Useful Post: [ Click to Expand ]
 
ZindaqI
Old
#2  
Member
Thanks Meter 13
Posts: 58
Join Date: Mar 2013
Thanks Dude , its working 100%
Attached Thumbnails
Click image for larger version

Name:	SC20140802-074131.png
Views:	211
Size:	116.5 KB
ID:	2881574  
 
kartik verma
Old
#3  
Senior Member - OP
Thanks Meter 60
Posts: 149
Join Date: Dec 2013
Location: hamirpur h.p
Quote:
Originally Posted by ZindaqI View Post
Thanks Dude , its working 100%
Adding more stuffs after some tym.
 
ZindaqI
Old
#4  
Member
Thanks Meter 13
Posts: 58
Join Date: Mar 2013
Quote:
Originally Posted by kartik verma View Post
Adding more stuffs after some tym.
you can change charge icon to battery icon .. also you can make lockscreen transparent
 
kartik verma
Old
#5  
Senior Member - OP
Thanks Meter 60
Posts: 149
Join Date: Dec 2013
Location: hamirpur h.p
Quote:
Originally Posted by ZindaqI View Post
you can change charge icon to battery icon .. also you can make lockscreen transparent
sorry sir , but i know all about these things.
 
tjbearX
Old
#6  
tjbearX's Avatar
Senior Member
Thanks Meter 401
Posts: 394
Join Date: Dec 2012
Location: Balanga, Bataan Philippines
nice guide bro. keep it up the good work


 
jasper~
Old
#7  
jasper~'s Avatar
Senior Member
Thanks Meter 6
Posts: 118
Join Date: May 2014
Location: Laguna
Quote:
Originally Posted by kartik verma View Post
[COLOR="Blue"][SIZE="5"]

PHP Code:
First,We Edit "framework-res.apk"  present here (system/framework/framework-res.apk)

Decompile framework-res.apk Through Apktool (if you dont know how to decompile,See on XDA How to Decompile,Recompile Or Ask Someone)

After Decompiling -> Go Here 
framework-res/res/values/string.xml

PHP Code:
Open String.xml in Notepad++

After Opening -> Hit These Two Keys (ctrl+f)

And 
Copy This____  Charging  ____  Then Hit Enter

Change The Charging Text To____  Charge Status _____ 
-> After Changing -> Save it
I didnt Get this mate. Can you explain?
 
kartik verma
Old
#8  
Senior Member - OP
Thanks Meter 60
Posts: 149
Join Date: Dec 2013
Location: hamirpur h.p
Quote:
Originally Posted by jasper~ View Post
I didnt Get this mate. Can you explain?
decompile framework-res.apk , open string.xml present in values folder (framework-res/res/values/string.xml)

open it with notepad++ after this Hit 2 button ctrl+f and than type the text "charging" only charging and than hit enter u see an xml line contain charging text change it to "Charge Status"

dont use inverted commas " " there i just use it for highlighting the things
The Following User Says Thank You to kartik verma For This Useful Post: [ Click to Expand ]
 
jasper~
Old
#9  
jasper~'s Avatar
Senior Member
Thanks Meter 6
Posts: 118
Join Date: May 2014
Location: Laguna
Quote:
Originally Posted by kartik verma View Post
decompile framework-res.apk , open string.xml present in values folder (framework-res/res/values/string.xml)

open it with notepad++ after this Hit 2 button ctrl+f and than type the text "charging" only charging and than hit enter u see an xml line contain charging text change it to "Charge Status"

dont use inverted commas " " there i just use it for highlighting the things
Oh thanks bro. I have 1 question, is the battery percent still there when I charge my phone?
 
kartik verma
Old
#10  
Senior Member - OP
Thanks Meter 60
Posts: 149
Join Date: Dec 2013
Location: hamirpur h.p
Quote:
Originally Posted by jasper~ View Post
Oh thanks bro. I have 1 question, is the battery percent still there when I charge my phone?
it always on your device lockscreen ,if u charge ur device or if not.

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Android M Mentions Spotted in Android Code Review

While we are still waiting for Android L to be officially released, the first mentions of … more

Create a Simple Custom Launcher from Scratch

When you are starting your journey intoany sort of development, it’s never easy at the … more

MediaTek Continues Steps Towards Being Developer-Friendly

Not too long ago MediaTek was very closed off towards the mobile developer … more