[Samsung Galaxy Nexus] APatte111:
Guide – Change Navbar D.P.I. in Android Jelly Bean (4.1.1)

•Thanks to Vomer for helping me learn this and answering my questions when I had them… Also for persuading me to write this guide for others users to hopefully use to learn a small bit of Android modding, which will hopefully create more publically used mods for the benefit and growth of the community. Let’s get it…

First thing is first… This guide is created with the Galaxy Nexus in mind. Even though other phone brands (Samsung, H.T.C., LG, Sony, etc.) are now upgrading their handsets to Android Jelly Bean, this guide is created with my experience with the pure Google experience in mind and pure Google O.S. *If you are using a rom with Samsung Touch Wiz, H.T.C. Sense or anything else produced/provided by another company, this isn’t for you, although it may answer some questions and get you started in the right direction…

THE TOOLS:

I’m using an ApkTool package, which were obtained from a thread created by monstaX < Credit to him!

First off, go to this webpage http://www.mediafire.com/?acrgcd0w850q0gj and download the file. File name should be “apktoolsJB.zip”. Once you have the tools downloaded, unzip them to your desktop.

Inside the unzipped file, you will locate the following files; aapt.exe; apktool.bat; apktool149.jar; apktool142.jar; apktool144.jar and baksmali.jar.

After confirming that the above listed files are present, rename “apktool149.jar” to “apktool.jar”.

That’s it for the tools, leave the file on your desktop, as this will ultimately be your workspace along with a command prompt.

I would also download 7-Zip and Notepad++ from the internet. You can Google those two programs and download them if you don’t already have them….

GETTING WINDOWS READY

:

The next thing we need to do is remove the “Environmental Values”. If you have attempted to edit/mod any apks in the past, you probably set up “Environmental Values” in “Path” under “System Variables”. If you have done this, simply navigate back to “System Variables>Path” and delete the added non-sense that you added before. An example would be something like “Android\SDK\platform-tools\;” Make sure that after you’re done deleting, you leave a “;” at the end of the “Path Variable” line of text.

Now for the fun part:

DECOMPILE/COMPILE

Once you have done the above steps, you’re now ready to have some fun.

First off, you need to download a copy of the .zip file of the ROM you’re using onto your computer OR transfer a copy of the framework-res.apk and SystemUI.apk to your computer from your G-Nex. Once you have located these files, you need to place both files into the JBapktool folder that we unzipped onto the desktop earlier.

Once you have placed both files into the JBapktool folder, open the folder and shift+right-click somewhere inside the folder (NOT ON A FILE). Once you have done that and a menu has popped up, select “Open Command Window Here”.

Once the command window has opened; you need to install the framework-res.apk… Now there is a bunch of technical jargon for this but simply and easily type the following command;

java –jar apktool.jar if framework-res.apk

You will see a line that reads “ Framework installed to: C:\Users\yournamehere\apktool\framework\1.apk”

After the above line appears, you will now decompile the framework-res.apk file. To do this, type the following command;

java –jar apktool.jar d framework-res.apk

You will now see something like:

I: Loading resource table…

I: Loaded

I: Decoding file-resources…

I: Decoding values*/* XMLs…

I: Done

I: Copying assets and libs…

*DON’T CLOSE THE COMMAND PROMPT*

After you see that, you should notice that a new file has been added to the JBapktool folder, which should be named “framework-res”. Inside that folder, you will observe the following folders/files; assets; build; dist; res; AndroidManifest.xml; apktool.yml. The file that we are worried about is the “res” file. Open the “res” folder and then navigate to the “values” folder and look for a file named “dimens.xml”. The “dimens.xml” is where the magic happens. Right click on this file and open as “Edit with Notepad++”.

Once Notepad++ is open with the “dimens.xml” file open, you want to focus on three strings in the file. The strings are: 36.0dip

36.0dip

32.0dip

*For a 32 DPI nav bar, I personally use 32 for the height and 28 for the width.*

Now here, the parts of the string that we want to change are highlighted in yellow and represent the “DPI” of the nav bar. The above lines are from a “dimens.xml” file that I changed to make a “36 DPI” nav bar. Once you have made the changes to the above dimensions, just click file and save in Notepad++ and close the program.

Now to compile the “framework-res” folder back into an .apk.

Simply go back to the command prompt that we opened earlier (you shouldn’t have closed it, but if you did follow steps above to open a new one, reinstall the framework-res.apk (STEPS ABOVE) and then continue).

Type the following command;

Java –jar apktool.jar b framework-res

You will see the following (hopefully);

W:Could not find sources

I:Checking wheter resources has changed…

I:Building resources…

I:Building apk file…

After this, you should revert back to the “JBapktool” folder and navigate to “framework-res” folder>”build”>”apk”… Look for the “resources.arsc” file. THAT’S THE MONEY SHOT…

Using 7-zip, you want to open the “framework-res.apk” file that we originally began with (I would make a copy of it and put it on my desktop). Right-click on the “framework-res.apk” file, click 7-Zip and then open archive. A new window will open, showing the visible files inside the framework-res.apk. Look for the file “resources.arsc”. Delete it, locate the “resources.arsc” from the framework-res folder (framework-res>build>apk) in the JBapktool folder. Click and drag it to the unzipped original framework-res.apk file and drop it. WE’RE DONE WITH THE FRAMEWORK-RES.APK FILE.

Now simply place that file in a CWM flashable .zip file and hold tight.

Now we need to decompile the SystemUI.apk that we placed in the JBapktool folder earlier. Follow the above listed instructions to complete this, same as we did with the framework-res.apk.

Once you have the SystemUI.apk file decompiled, look for a folder in JBapktools named “SystemUI”. Inside the “SystemUI” folder, navigate to res>layout>navigation_bar.xml. We now want to open the navigation_bar.xml file with Notepadd++, so that we can delete two lines in it that would cause a larger back button on the nav bar if left intact.

Inside the navigation_bar.xml file look for the following two lines:

"@drawable/ic_sysbar_back" android:scaleType="center"

"@drawable/ic_sysbar_back_land" android:scaleType="center"

Now, we want to delete the following from both lines:

android:scaleType="center"

After deleting that line from both lines, save the file by clicking file>save and close Notepad++. Now back go back to JBapktools and to the already opened command prompt window (it should still be open).

We are now going to compile the SystemUI. To do this type the following command;

java –jar apktool.jar b SystemUI

You will see some text in the command prompt and will ultimately see I:Building APK file…

Once this is complete, navigate back to the JBapktool folder and to the SystemUI file. Once you have the SystemUI folder open, we need to navigate to build>apk and look for the following file; AndroidManifest.xml. Now this is important, we need to replace this file with the AndroidManifest.xml file from the original unzipped SystemUI.apk. So open the original SystemUI.apk with 7-zip, and copy “META-INF” and “AndroidManifest.xml”. Once you have those copied from the original unzipped SystemUI.apk, relocate back to the JBapktool folder>SystemUI>build>apk and paste both of them. If asked to replace, CLICK YES OR REPLACE ON ALL WARNINGS THAT POP UP!!!!

Now we need to back out to the SystemUI folder in JBapktool and click on the folder that is named “dist” (the “dist” folder is where the freshly compiled SystemUI.apk is located once we type in the compile command in the command prompt). Once inside the “dist” folder, you will see a SystemUI.apk file. DELETE IT… We never use the first SystemUI.apk that we compile, because we needed to added the META-INF and AndroidManifest.xml files for signing purposes. Once you have the 1st compiled SystemUI.apk deleted, return to the command prompt and enter the compile command again and compile a 2nd SystemUI.apk.

The 2nd SystemUI.apk will appear in the “dist” folder and is the usable SystemUI.apk.

Now that you have your new SystemUI.apk compiled, place it in the same CWM flashable .zip file, boot into recovery, wipe cache and dalvik cache and VOILA, you have just pimped your nav bar’s DPI.

•Remember when placing the SystemUI.apk file into your CWM .zip file to place it under /system/App. And when placing your framework-res.apk into your CWM .zip file it goes under /system/framework…

The mods and this guide take time for us to put together for your enjoyment/the improvement of the community. If I or anyone else has helped you, please hit the “Thank You” button. Thanks.