This guide is meant for DEVs who want to incorporate this MOD into their ROM. I will post up a flashable zip later but just know it will only be for Stock Deodexed Roms. Most people are running custom ROMs now so flashing this over one of them will break themes and things.
Always Nandroid before making or attempting to MOD your phone
What will this MOD do?
-This MOD will allow you to select up to 20 different icons to use for your battery.
So what, I can do this now with any one of my battery flashable zips, why do I need this?
-Because this MOD will let you make these changes immediately, on the fly, and with no flashing or rebooting needed.
This is a pretty involved MOD with lot of changes and file additions. I will do my best to remember everything but I make no promises. If you catch something I missed or are having issues with something just post it up in this thread and I will try to help you.
Big Thanks to DSA for letting me look through some of his stuff for implementation.!
With that said, lets begin........
First thing to mention is there is an attached zip file to this thread. In this ZIP you will find the files needed to get this MOD going. The files you need are located in folders within the zip. Each folder name describes where those files should be placed. If you encounter a message that says the file you are adding already exists, write over it with the new file. This includes new icons as well.
We will be working with two system files:
We will begin with SecSettings.apk
Once you have decompiled SecSettings, navigate to res/values/arrays
Thats it for SecSettings, recompile and push to /system/app. Make sure everything boots and you see your new selections in SystemSettings->display->Battery Icon selection. It will not be functional yet, but you should see it there.
Decompile SystemUI.apk and add all the new files if have not already done so.
Now recompile SystemUI.apk, delete the old SystemUI folder and decompile again creating a new SystemUI folder.
We do this step so the system can take all the new files we just added and generate new IDs for them. If you get errors compiling its probably because you forgot to add a file or a line of code......or i missed a step in this tutorial . To verify tht the new IDs are there, simply navigate to res/values/public and search for one of the new files we just added like "stat_sys_battery_castaway". If you find it, you are good to proceed.
Navigate to res/values/ids and add the following files
Now for the really fun part Take a look at the six files in the zip in the folder named SystemUI_smali_com_android_systemui_statusbar_poli cy
There are two files in this folder we will concentrate on -BatteryController.smali
Here is what we are going to do. We need to go through both files and find all the System ID's. These can be identified by looking for the
We need to find all these IDs and verify or change them to the correct IDs found in your res/values/public. Why? Because you just added over 3000 new files to your SystemUI.apk and there is no telling exactly what IDs were assigned to them without verifying it first. If you used the IDs in my files and one was different, the MOD would fail.
So here is how to do this. First you will notice I have done half the legwork for you by naming what each ID is in my files. So when you are searching for IDs you will see somethin like this
The "0x7f0a001c" is the ID and the "#status_bar_settings_battery_meter_format"is the name associated with the ID.
What you will do is open one of the two files at a time as well as open your public.xml file so you have both files available in your editor. Find each ID, copy the description beside it (without the hashtag) and search for this description in your public.xml file. Verify the ID is the same and if its not change it to the correct one. You have to do this for all IDs in both of those files. Take your time and go slow, if you miss one or copy one wrong the MOD will fail.
Thats it! You can recompile files and push to /system/app. enjoy the MOD!!
Please dont forget to buy me a coke or hit the thanks button!
For all those who believe that Cinderella stories don’t actually … more
XDA Developers was founded by developers, for developers. It is now a valuable resource for people who want to make the most of their mobile devices, from customizing the look and feel to adding new functionality. Are you a developer?