yashsingh1/xdaforums huggingface dataset:
[Galaxy S III Themes and Apps] InfX:
Well, not as tidy in real life, lol. Not nearly so. But thanks anyway :) Admit it, coding something like that in a .bat would be a hell of a task, and wouldn't be nearly as tidy, so i hope the decision to use jscript (that is often considered an internet worms language for dummies) is the right decision after all.

About removing an entire method - i am not even sure it would smali back, cause there ARE places calling those. About removing methods CONTENT, be cateful. Obviously, it will compile. But only want to disable SOME of the flow on some of them. For example, i only want to disable a battery overheat warning, but not other warnings in the same "switch case". Anyway, its so much easier to just abort the method without removing its code.

What exactly are you gaining by removing the code entirely? A few bytes of pcode less? Not seems important enough for me.
[Galaxy S III Themes and Apps] Lost.soul:
Well it isn't just the less code, I was thinking if I remove the checks entirely this would then require less processing time, IE optimizing the apk to do less checks and actually saving the precious battery life you have left. (For example in old Nokia phone, when you were running low on battery life the frigging phone would light up, vibrate and notify you that the battery is almost dying which in turns consumes battery and that ticks me off :P )

Now, I don't understand smali to be quite honest, I can see that it is calling for methods, so dunno how the effect would be.

Anyways thanks for your input !
[Galaxy S III Themes and Apps] InfX:
Removing the code (leaving a blank method) versus bypassing only requires a few VM instructions more. This is so neglectably little, compared to what the entire OS does, you are never going to notice any battery life time improvements. Think something like 0.000000001% ;)

Same goes for removing the method and all calls to it (that is much harder to do, btw), unless, of course, the caller does some nasty stuff such as acquiring and not releasing a wake lock or something, but this would be a NASTY general bug, unrelated to this patch in any way, XDA users would notice and fix this a long time ago.
[Galaxy S III Themes and Apps] ilfavi:
It works.

Great job!

:good:
[Galaxy S III Themes and Apps] piele20:
Hello,

I've tried to follow the easy instructions. When I use the patch it says: ==> Error, ".method notifyFullBatteryNotification()" not found'' at the end. Anyone knowing what to do now?

:confused:
[Galaxy S III Themes and Apps] InfX:
Post your systemui.apk to let me look at it. Are you on SGS3? What ROM?
[Galaxy S III Themes and Apps] clausg:
InfX, you should make your thread far more popular. I think every developer should implement this in their custom roms by default.

It was so annoying, having a low battery and even get it drained more by screen on and warnings... now it is as it should be, thanks a lot!
[Galaxy S III Themes and Apps] naeg1977:
I also tried this patch in my i 9305 but it doesnt work .

In i 9300 it works perfectly.

I transfer the new patch in my device (i 9305) as I did in my 9300 but it doesnt do nothing :(

.
[Galaxy S III Themes and Apps] piele20:
I'm on Sxl with RunElite_Sense4.1_V1.5_Beta ROM.
[Galaxy S III Themes and Apps] piele20:
I don't have the statusbar anymore. Don't now why because I have copied the original systemUI.apk back. I think that I have install the Rom again to get it back. Or has someone a suggestion?
[Galaxy S III Themes and Apps] naeg1977:
if you have put the original back ,then just reboot and your status bar will apear again.
[Galaxy S III Themes and Apps] piele20:
Didn't worked. I have tried many times. Even copied the original systemUi.apk from the Rom zip and rebooted and still didn't worked.

---------- Post added at 01:19 PM ---------- Previous post was at 01:15 PM ----------

I can't install the .apk right? I just have to put it back in the right folder?
[Galaxy S III Themes and Apps] naeg1977:
Have you full deleted the old SystemUI.apk ?
[Galaxy S III Themes and Apps] piele20:
Is that nessacery? Or is that the reason? I think I did.
[Galaxy S III Themes and Apps] InfX:
Guys, if the script errors out in a way piele20 describes (unable to find something that is needed for the patch) the apk is UNTOUCHED. So you've been practically pushing the same apk back. So, any permissions issues? Compare the permissions on the apk you've pushed with the other ones and make sure they are set the same way.

EDIT: I have yet to look at the attached system.apk, was the full battery notification ever there? As far as i know, that annoyance originates from Samsung's stock ROMs, not CM or ASOP. Same probably goes for the overheat prompt. That's my best guess on why the patch can't find those.
[Galaxy S III Themes and Apps] InfX:
TBH, i have no slightest idea why/how can it possibly be. Did the patching succeed? The apk is only modified when the patch manages to find out HOW to modify it, in case of errors it remains untouched.
[Galaxy S III Themes and Apps] Lost.soul:
This is definitely a permission issue, just go to recovery and fix permissions
[Galaxy S III Themes and Apps] naeg1977:
hi :)

Yes the patch succeeded without any errors ..Everything worked ok

I transfered the new SystemUI back ,but it has the same behaviour .:(

I did the same thing with my i9300 and it works perfectly :)

I cant find a solution for my i9305
[Galaxy S III Themes and Apps] piele20:
Tried, but didn't worked eighter. To bad. I shall install the Rom again I guess.
[Galaxy S III Themes and Apps] InfX:
Reinstall a ROM because of some minor issue with a single file... oh well :(

BTW, i am not sure what the CWM permissions reset does, what i've meant is to set the permissions to this specific file manually.

About i9305, i really have no idea. The patch finding everything it needs to work, yet replacing the apk makes no difference? This doesn't make any sense! I am starting to think... maybe you've deodexed the apk yourself and actually forgot to delete the odex file? Again, i really don't know.
[Galaxy S III Themes and Apps] naeg1977:
unforunatelly i cant find a solution either :(

i attached my systemui from my i9305 ,if you can and have time please give it a try too .

Thanks :)
[Galaxy S III Themes and Apps] InfX:
Just wondering... whats your i9305 ROM ?
[Galaxy S III Themes and Apps] naeg1977:
Its pandoriam :)
[Galaxy S III Themes and Apps] InfX:
Took a look at it's showLowBatteryWarning() method, it's flow looks exactly like the one i've seen before, and it seems to be patched correctly by the auto patcher script, so i really don't know what's the deal here. Try again and make sure you don't do something wrong, something trivial, such as pushing the file to a wrong location, pushing the wrong file, stuff like that.
[Galaxy S III Themes and Apps] InfX:
Your one is a little bit different compared to the ones i am used to see. I can modify the patch to just bypass the entire "showLowBatteryWarning" method to try & make it work on more ROM variations. I can't see the "battery full, please disconnect the charger" in your apk, though, nor i can see the temperature warnings, too. Wanna try, just for the low battery notifications?

EDIT: I can't see this harming anyone in any case, so, the first post has been updated now. Try it if you want.
[Galaxy S III Themes and Apps] androidfreak007:
Finally, the annoying pop ups are gone. The popups are now finally gone as well as the alerts

My sgs3 is running with WanamLite v5.2 and Yanks Kernel v2.8eT

After pushing the patched SystemUI.apk I had to go into RecoveryMode to fix permission. Reboot. Done.

Thank you for this fantastic mod.
[Galaxy S III Themes and Apps] MMWolverine:
Hey guys! I have a strange request. :silly: While most people want to get rid of battery notifications, I would like to have fully charged sound back. If I'm not mistaken, it should be "TW_Battery_caution.ogg", but on 100% there's a dead silence. Omega v35 XXLL5 JB 4.1.2 is my current rom, so if you could share me the code or point be in the right direction, I would be extremely thankful.
[Galaxy S III Themes and Apps] InfX:
I am AFK now, but if you look at the jscript (that is well commented) you will easily see what method i am patching there. Ill likely be back in a few days.
[Galaxy S III Themes and Apps] MMWolverine:
Omega rom has pop-us and full battery sound disabled by default. So I would only need this charged "beep-beep" back, low battery works ok. Samsung 4.1.1 stock rom had this feature, could the code from there be copied to 4.1.2?
[Galaxy S III Themes and Apps] DSA:
This is a simple mod

Read the supplied files...you will see there's about 3 differences in total...All you do is type or remove 'return void' in certain places and recompile
[Galaxy S III Themes and Apps] naeg1977:
It works perfectly on my note 2 also .

Thanks :)
[Galaxy S III Themes and Apps] Mek7:
It works on my SGS II with Zero Bug ROM v4, thanks for pointing me to this guide!
[Galaxy S III Themes and Apps] :
HI,

I have applied the patch but returned an error message stating that the file wasn't found when it was clearly there.

Attached is the file, Would you kindly, pretty please, apply the patch for moi?

thank you.
[Galaxy S III Themes and Apps] InfX:
The file it is unable to find is a smali file, after decompilation, and it is, indeed, not there. Your SystemUI.apk isn't nearly similar to what i am used to see. Even it's size is about 10 times smaller than usual. Sorry, but i cannot apply this on it.
[Galaxy S III Themes and Apps] :
I noticed the difference in size before uploading it.

FYI my android version is 2.3.4

kernel is 2.6.32.9

build number is 4.0.2.A.0.58

running on Sony Ericsson Xperia mini Pro.

Hope there is some other way. thank u
[Galaxy S III Themes and Apps] InfX:
Well, the patch is intented for Android 4.x, this kinda explains the systemui.apk being so different. I am sure it is doable on 2.x as well, but i no longer run it and have nothing to try & patch the same thing on it.
[Galaxy S III Themes and Apps] :
I've failed doing this.. could you patch my SystemUI.apk, please? :silly:
[Galaxy S III Themes and Apps] InfX:
Do i really have to say more? Let me rephrase the error message...

So? ODEXed ROM? I bet it is. To do the same thing on an ODEXed ROM it would require (partial) deodexing, that, in turn, requires you to bring most of the odex files in, because of their dependencies chain. Wanna automate this? Ok, go on, i'll gladly update the first post with your updated script version ;)
[Galaxy S III Themes and Apps] diulalasing:
Does this disable crtically low warning?

Also does this only work for S3? or does it work for older androids like ace plus or ace 2 (2.3.6 gingerbread)

Thanks a lot
[Galaxy S III Themes and Apps] InfX:
Yes, it does.

No, it should work on most Android 4.* ROMs.

No, sorry, it doesn't.
[Galaxy S III Themes and Apps] Asaru215:
Will this work for the Galaxy tab 7 plus 6210. I have the stock rom for ICS. I keep reeving the error not letting me charge. What is the best rom for me to fix this because I purchased another battery and I have the same result. Could it be the sensor?
[Galaxy S III Themes and Apps] bit2:
Nice mod, thanks.

If somebody is interested what exactly is going on in PowerUI, here's the source for Android 4.2.2:

https://android.googlesource.com/pl...I/src/com/android/systemui/power/PowerUI.java

There's another approach though: modding the file containing the limits.

Somebody already mentioned it in the forum:

http://xdaforums.com/showpost.php?p=12871372

The confg file (res/values/integers.xml) is in /system/framework/framework-res.apk, more precisely in the compiled resource bundle "resources.arsc".

The source of the original config (for Android 4.2.2) can be found here:

https://android.googlesource.com/pl...droid-4.2.2_r1/core/res/res/values/config.xml

The difference between this hack and the one in this topic is that one requires the unpacking of framework-res.apk (and decompilation of the resource bundle), modding and repacking, while the other requires unpacking of SystemUI.apk, decompilation of the DEX classes, patching the code, recompile into DEX and repack into an APK.

But since apktool used to have (a few) problems with properly decompiling (or decoding? ... whichever phrase you prefer) resources ... which of course results in messed up APKs once you put it all together again ... and since smali+baksmali are pretty much stable and dependable, it's a nobrainer which method is better (meaning more trustworthy / stable).
[Galaxy S III Themes and Apps] fsi09:
Can anybody help me ?
[Galaxy S III Themes and Apps] InfX:
Help you how? Did you try applying the automatic jscript patcher? I've tried it on your apk, it couldn't find the overheat and full battery code, but did manage to patch the low battery notification. Resulting apk attached.
[Galaxy S III Themes and Apps] InfX:
I am not sure there a modifiable limit for overheat exist there. Didn't take the time to actually look there, though.

In any case, even if it does, it would strongly suggest NOT modifying that limit, since it would be more than likely it would also configure the charging circuitry to keep charging above the normal thermal cut-off threshold, not just disable the pop-up. With a likely dire consequences for the battery.
[Galaxy S III Themes and Apps] RogueCoyote:
Thanks for this. Used the PowerUi.smali.Diffs.zip to see what you did and applied the MOD on my SGSII. Works great.
[Galaxy S III Themes and Apps] ac17:
Hi - I have patched the SystemUI file, but am wondering how to get it back onto my phone into the system/app path so it overwrties the original (circa 2008) file?

And do I need to install/ run it?

Im on a GNEX using CM10.1 RC4.

I want to patch bc my ph is on an endless low battery popup loop everytime it gets down to 15%, effectively shortening my battery by 15% (the phone is unusable once this starts up)
[Galaxy S III Themes and Apps] InfX:
Dont "search" for it, you should fetch it over adb from your /system/app folder. It isn't on the internal sd, its on the system partition.
[Galaxy S III Themes and Apps] ac17:
I found it - and patched successfully.

Now what do I do?

How do I get it back onto my phone into the system/app path so it overwrties the original (circa 2008) file?

And do I need to install/ run it?
[Galaxy S III Themes and Apps] InfX:
No, you do not install it, you just put the new apk at the same place you found the old one, and with the same permissions set. Don't forget to backup the old one, just in case. The system ui/status bar will likely crash after replacement, until reboot, too.
[Galaxy S III Themes and Apps] ac17:
Thanks. The UI / Status bar crashed, but the crash survived reboots. Not knowing what to do next I dirty flashed the same rom, hoping to restore things to normal. No change.

I just did a factory reset.

Lesson learned - don't be impatient - backup the SystemUI file as you suggested....
[Galaxy S III Themes and Apps] InfX:
Seriously?! "Dirty flashing" it should have restored that apk! I seriously doubt i could damage its data this way even if i wanted to, on purpose, so i bet its not the data. Permission issue, with the rom flashing script not resetting it? Did you set the proper permissions after replacing?
[Galaxy S III Themes and Apps] ac17:
Hey its ok, I'm blaming myself, not you!
[Galaxy S III Themes and Apps] WACOMalt:
So... How can I run this JS patch on windows? I have tried running it from command prompt using cscript and wscript, which google returned as options in windows. Also tried installing node.js which is supposed to be a good JS runner in windows.

node Patch.js > Returns:

C:\Users\Ben Sumner\Downloads\BatteryPatch\Patch.js:145 eval(WScript.CreateObject("Scripting.FileSystemObject").OpenTextFile(Framework

^

ReferenceError: WScript is not defined

at Object.<anonymous> (C:\Users\Ben Sumner\Downloads\BatteryPatch\Patch.js:1

45:6)

at Module._compile (module.js:456:26)

at Object.Module._extensions..js (module.js:474:10)

at Module.load (module.js:356:32)

at Function.Module._load (module.js:312:12)

at Function.Module.runMain (module.js:497:10)

at startup (node.js:119:16)

at node.js:901:3

cscript and wscript Patch.js returns

Checking for java presence...

==> Error, The system cannot find the file specified.

So... how the heck can I run this patcher on windows? Thank you for the effort on this patch though, I'm aware windows is the issue here, But my linux drive is currently effed up, so is there a way in windows? I am on Windows 7 x64 if it matters.

For reference, attached is my SystemUI.apk. It is from AOKP 4.2.2 JB MR1 Toro - Nightly 2013-06-09. Id appreciate you patching this for me, but better yet would be to lead me to a way to do this myself in windows so I can keep with it on updates to the rom.
[Galaxy S III Themes and Apps] InfX:
Either with cscript or by doubleclicking it (that actually runs it via wscript, but it knows how to rerun itself). As simple as that. Mind it, the error you see is outputted by the patch.js, its not a system error. The script expects you to have java, checks for its presence, and doesn't seems to find it. Since it uses java utilities, it cannot continue.

EDIT: Attaching your apk after patching. Do note, though, the patch only managed to find the low battery warning, but not the overheat nor the battery full warning.
[Galaxy S III Themes and Apps] WACOMalt:
Thanks, and sorry for wasting your time. After more searching I came to the same conclusion of mising Java. Which came as a suprise... turned out my Java path was just wrong in my environment variables. Fixed that via a reinstall and it all worked. Thanks!

Seems to work perfect. This is a big help since my battery is somewhat broken and has been going crazy with low battery warnings because it keeps thinking I'm pluggin in and removing the charge cord 100% of the time. so I used to get a lo wbattery warning once every 2 seconds when I dropped below 20% or so. Now I have at least fixed the annoyance until I can get a new battery.
[Galaxy S III Themes and Apps] gunslingerfry:
You sir (OP), are awesome and totally made my day! I had a lot of problems - I'm running on a stock S3 and I had to learn how to deodex and reintegrate the newly created classes.dex file into the apk but after all of that (and realizing I needed to get rid of the old odex file in the system/app folder) I have no battery warnings!

It kind of amazes me how often I think to myself, "This is annoying. I wonder if I can get rid of it?" And I check xda, and someone has kindly done it before I knew I wanted it.

I now have a copy of the deodexed systemui.apk for the SGH-T999 (4.1.2 UVDMD5) if anyone would like it.
[Galaxy S III Themes and Apps] InfX:
Thanks for the compliment. And, isn't it exactly what XDA about, sharing this kind of stuff? ;)
[Galaxy S III Themes and Apps] s2dh:
will this work on the Galaxy S4 ?
[Galaxy S III Themes and Apps] InfX:
You tell me. I don't have an S4 to test it on. And, if you have to adapt it in one way or another to make it work - do share with the rest of the S4 users.
[Galaxy S III Themes and Apps] orangerot.:
[MENTION=961092]InfX[/MENTION] I Just wanna say thanks for figuring that out ;) It's really cool!

Just had a look at the files from my UFME7 (4.2) ROM and the showLowBatteryWarning method is still there and looking similar. But the methods for the heat warning is gone! I just made the changes and now I have to empty my akku in order to see if it's working :D (But I doubt it doesn't work)

As the files of the S3s 4.2 leak and the offical S4 firmwares are similar in wide parts I'm pretty sure it'll work on the S4 aswell.. If you proivde your SystemUI I can have a look at it.. It's a fast done mod ;)
[Galaxy S III Themes and Apps] vtrickzv:
Just wanted to say thanks for your work InfX, you are truly my savior. I've been searching for so long on how to resolve this issue and you come to my rescue. :laugh:
[Galaxy S III Themes and Apps] zekepliskin:
Running S3 with CM 10.1 beta, tried to patch but still getting annoying toast messages when battery hits 5% etc. The patch.js threw up a few errors about not being able to turn off overheating messages but seemed to be alright other than that.
[Galaxy S III Themes and Apps] InfX:
I am only patching the (standard) popup messages, not toast messages. In fact, i never even seen those. Feel free to weed those out, update the patch, and i'll gladly put it in the first post.
[Galaxy S III Themes and Apps] zekepliskin:
Sorry maybe toast was the wrong word to use, those are standard Android "connect your charger" with a button to dismiss at the bottom which I think your mod can block.

Am I supposed to clear the cache or something to make it work? I rebooted a few times from the power menu.
[Galaxy S III Themes and Apps] InfX:
Nope, just replace the apk in your system directory with the patched one. And, make sure there is no odex file next to it, thats in case you've deodexed your ROM, but forgot to remove the actual odex files.
[Galaxy S III Themes and Apps] metalfan78:
Thanks for this! I'm adding it to my rom tomorrow morning if that's ok with you?
[Galaxy S III Themes and Apps] InfX:
Of course its ok, why not.
[Galaxy S III Themes and Apps] metalfan78:
Thanks, I always ask first, seems only right.

---------- Post added at 05:40 AM ---------- Previous post was at 05:24 AM ----------

I got an error

Microsoft jscript runtime error: permission denied

Cscript error: execution of windows script host failed.

---------- Post added at 05:59 AM ---------- Previous post was at 05:40 AM ----------

Ok after reading through this thread I had to set up my java environment, I think I got it now. No errors
[Galaxy S III Themes and Apps] :
Awesome!

Works flawlessly on U.S. Verizon Samsung Note II (SCH-i605), running Cyanogenmod 10.1 Nightly. Changed the wallpaper as others have mentioned, no worries there. Actually i like seeing that, letting me know the apk has changed. GREAT job InfX!!! Thanks so much!
[Galaxy S III Themes and Apps] metalfan78:
Works perfect on sprint
[Galaxy S III Themes and Apps] Obscenic:
I've been trying all night to get java to apply this patch and I'm getting errors such as:

js: "/home/user1/bat patch/Patch.js", line 145: uncaught JavaScript exception: ReferenceError: "WScript" is not defined. (/home/user1/bat patch/Patch.js; line 145)

and

js: uncaught JavaScript runtime exception: ReferenceError: "WScript" is not defined.

I've tried rhino, java and with and without sudo and no luck... I've attached my systemUI here - can you help me out?
[Galaxy S III Themes and Apps] InfX:
Sorry, i am currently AFK for over 2 weeks. Other thread readers - feel free to help. Thanks for understanding.
[Galaxy S III Themes and Apps] metalfan78:
I can take a look at it tonight for you, probably won't be until about 8:00 mountain time. PM me if you want.

Just a thought, do you have your java set up correctly in environment variables?
[Galaxy S III Themes and Apps] metalfan78:
Here is the stock SystemUI.apk with this mod applied, Sprint MD4 version

http://www.androidfilehost.com/?fid=23134718111252647

T-Mobile, Mobilicity, Wind MD5 version

http://www.androidfilehost.com/?fid=23134718111252931
[Galaxy S III Themes and Apps] :
Sadly stopped working with

cm-10.2-20130918-NIGHTLY-i605.zip. Actually I can't say it does not work, I am simply unable to copy the SystemUI.apk back to system/app. I am also unable to copy a custom bootanimation.zip to system/media. Obviously an issue with the ROM itself, but I could copy & paste these files fine with the nightlys before, been doing it since August. At any rate a big THANK YOU for the battery patch, all the fine people at XDA & Cyanogenmod for all their wonderful, hard work. I've learned an awful lot here and am quite pleased with the seemingly endless way to customize Android.

BTW the battery patch also works on my Nexus 7 Wi-Fi (2012) running a CyanogenMod 10.2 nightly (grouper) from August.

I would have posted this in the developer thread but I am unable as this is only my second post.
[Galaxy S III Themes and Apps] metalfan78:
Has anyone tried this on 4.3 yet?