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

Search This thread

kartik verma

Senior Member
Dec 14, 2013
376
153
Hamirpur H.P
Here's A New Guide To Add Battery Percentage On Lockscreen


Requirements -:


1. android.policy.jar

2. framework-res.apk


PHP:
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:
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:
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+f

PHP:
.method public shouldShowBatteryInfo()Z

The Whole Code Looks Like....


PHP:
.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 v0, 0x1

    :goto_5
    return v0

    :cond_6
    const/4 v0, 0x0

    goto :goto_5
.end method


After Editing It Looks Like....

PHP:
.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 v0, 0x1

    :goto_5
	
	const/4 v0, 0x1
	
    return v0

    :cond_6
    const/4 v0, 0x0

    goto :goto_5
.end method


ENJOY.......!!!!!!!!!!

Credits - To Me Kartik Verma@XDA
 
Last edited:

ZindaqI

Senior Member
Mar 24, 2013
65
14
Thanks Dude , its working 100% :)
 

Attachments

  • SC20140802-074131.png
    SC20140802-074131.png
    116.5 KB · Views: 1,120
  • Like
Reactions: qromwel

jasper~

Senior Member
May 4, 2014
126
7
Laguna


PHP:
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:
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

Senior Member
Dec 14, 2013
376
153
Hamirpur H.P
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
 
  • Like
Reactions: qromwel and jasper~

jasper~

Senior Member
May 4, 2014
126
7
Laguna
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?
 

Top Liked Posts

  • There are no posts matching your filters.
  • 4
    Here's A New Guide To Add Battery Percentage On Lockscreen


    Requirements -:


    1. android.policy.jar

    2. framework-res.apk


    PHP:
    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:
    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:
    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+f

    PHP:
    .method public shouldShowBatteryInfo()Z

    The Whole Code Looks Like....


    PHP:
    .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 v0, 0x1
    
        :goto_5
        return v0
    
        :cond_6
        const/4 v0, 0x0
    
        goto :goto_5
    .end method


    After Editing It Looks Like....

    PHP:
    .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 v0, 0x1
    
        :goto_5
    	
    	const/4 v0, 0x1
    	
        return v0
    
        :cond_6
        const/4 v0, 0x0
    
        goto :goto_5
    .end method


    ENJOY.......!!!!!!!!!!

    Credits - To Me Kartik Verma@XDA
    2
    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
    1
    Thanks Dude , its working 100% :)