[GUIDE](INTERACTIVE) HOW-TO Get Started Themeing/Modding [rev. 8/26/12] - Motorola Atrix 2

*THIS HOPES TO SERVE AS A SLIPPERY STEPPING STONE FOR THOSE VENTURING INTO THE MODDING SCENE - AND FOR ANYONE TO POST THEIR QUESTIONS, ANSWERS, REQUESTS, AND COMMENTS ABOUT THEMES/MODS*
NOTE: This is still a WIP... I will clean it up, add/remove/replace as I, and others, see fit. Trying to make this a good resource for those wanting to journey into the rabbit hole..
I will try to make this as general as possible, but it is still mostly based off of Windows 7 OS. I will attempt to incorporate Linux (Ubuntu) as I can. Also, I urge other devs and users to please offer your advice or comments on how to make this thread as useful as possible, "I accept opinions, phone numbers, and the fact that not everyone wants smiles and eye contact" (sorry, homage to doseone - couldn't resist) - but PM's or posts are fine...
Finally, I have said it before about Android, and will say it again.. “there is more than one way to skin a cat...” meaning, that there are many, many ways to achieve the same outcome with different methods (but, I’m not sure who would want to skin a cat, and what for… but I guess I don’t even want to know where that phrase came from) - so, PLEASE SEARCH for more information, methods, tricks, and techniques - I can't fit everything under the sun into two posts - plus, I still got a lot to learn myself ...
Tools
Java JDK
Android SDK
7-zip (or similar file manager)
Notepad++ (or similar text editor – do not use windows notepad!)
GIMP (or similar image editor)
Sign+ (or similar zip-signing program)
Getting files from your phone
-Root browser: copy from original file location to sdcard
-adb pull (I will not go into an adb tutorial, but here’s an example):
Code:
adb pull /system/app/SystemUI.apk C:\Pulled
(I have two folders (“Pulled” and “Push”) in the root of my C:\ drive, where I do all my pulling and pushing)
-Take from a cwm backup (nandroid)
-Make a System Dump through adb (this is just something kind of fun, but not so necessary):
Code:
adb shell
su
busybox tar czvf /sdcard/systemdump.tgz /system
exit
exit
adb pull /sdcard/systemdump.tgz
You can delete it from your sdcard once it’s on your computer.
(for a Data Dump, just change the location to /data, and rename the tar file output..)
Edit png/jpeg images
-use 7-zip, winzip, (or stock File Roller on Ubuntu)
-GIMP or Photoshop (work best – but there are many other “tools” out there)
-open the apk (archive) with one of the above mentioned file managers and navigate to the appropriate /res/drawable folder (usually drawable-hdpi, but not only..). And, either copy the files you want to edit directly from there to your desktop or working folder, and make edits and/or drop your replacement files in the appropriate drawable folder in the apk with your file manager. Then move to your system to try it out.
GIMP Notes (it’s what I’m most familiar with, so, Photoshop users use your similar methods):
-Many times the images are in “Indexed” color mode. Go to Image>Mode and change it to RGB mode to avoid editing troubles.
-In GIMP 2.8.0, use the “Export..” feature to save your edited images (in older versions, use “Save as..”), and given quality options, I usually tend to the highest, and all boxes checked.
Decompiling/editing apks
Decompiling apks is necessary to edit .xml files and .9.png files.
See here for more information on the original apktool by brut.all: http://code.google.com/p/android-apktool/ <-- for ICS framework-res.apk, you need to decompile with v1.4.2, and compile with v1.4.3
See here for new version (v1.4.9) of apktool taken over by iBotPeaches: http://forum.xda-developers.com/showthread.php?t=1755243 <-- USE THIS ONE (it works for decompiling AND recompiling framework-res.apk on ICS)
More resources for decompiling/recompiling:
http://forum.xda-developers.com/showthread.php?t=1752201
http://forum.xda-developers.com/showthread.php?t=1466100
Some Tools:
APK Manager/APK Multi-Tool: http://apkmultitool.com/?q=node/5
APK Changer: http://forum.xda-developers.com/showthread.php?t=1189971
Studio Android: http://forum.xda-developers.com/showthread.php?t=1491689
Tickle My Android: http://forum.xda-developers.com/showthread.php?t=1633333
-use apktool alone (see above links for details)
-use an APK editing program (I still mostly use APK Manager v5.0.2 and switch out the apktool files)
-set the proper framework for apktool by placing framework-res.apk, moto-res.apk, blur-res.apk, and SystemUI.apk in the same folder as apktool.jar. Then, open the command prompt or terminal on that folder (need to hold shift and right-click maybe), and type the following, one at a time for each of the four apks listed above, hitting Enter after each entry (note that not all 4 apks are needed for all files, but it doesn’t hurt):
Code:
apktool if framework-res.apk
You should get a “Framework installed to:” message after each, showing you the location to which they were saved. Note on that: In all actuality, you could simply drop a copy of each in the \apktool\framework folder (my path is C:\Users\Owner\apktool\framework\), but rename them as following:
framework-res.apk --> 1.apk
moto-res.apk --> 2.apk
blur-res.apk --> 3.apk
SystemUI.apk --> 127.apk
Re-compiling apks
When compiling system apks, the trick is to save the original signatures (META-INF) folder, the AndroidManifest.xml (unless you are editing that but, that’s a whole different story depending on the apk), and not to compress the resources.arsc file (where all of the /values folders get hidden). Some apk tools do some of the work for you, but here’s few methods (they can be dependent on what was edited):
-after re-compiling your apk, copy your edited and compiled files back over to the original apk to preserve signatures and everything else you did not edit (do this with two 7-zip windows open). For edits to any xml in the /values folders, you need to copy over the resources.arsc also (see next note).
-after editing anything in the values folder, you need to re-insert the resources.arsc without compression. For example, rename your SystemUI.apk to SystemUI.zip, take out the newly compiled resources.arsc with your file manager and then “Add to archive..” that resources.arsc to the SystemUI.zip in “Store” mode (or “No compression”). Then rename the .zip back to .apk, and you should be good to go (you can check the compression directly in the 7-zip window – if the “Size” and “Packed size” values are different, then it’s compressed).
-you can also do it vice-versa, and copy the original META-INF, AndroidManifest.xml, etc., to your edited apk with 7-zip
-if you want to edit the AndroidManifest.xml, depending on the specific apk, be prepared to re-sign nearly all system and framework apps
Edit 9patch (.9.png) images
Do some research on what 9patch images are and how they work, but the most important point is to not disturb the 1-pixel black border around the image, unless you want to redraw it. You must decompile in order to edit 9patch images.
-use GIMP or Photoshop
-use draw9patch included in the android-sdk (fool-proof)
-with GIMP you can select the inner area, leaving the 1-pixel border unselected, and edit colors and such that way
-draw9patch is included in the /tools folder in the Android SDK, it only allows you to edit the 1-pixel border and only draws in #000000 (black) color. It will add one pixel to all sides if you are not careful, so you may need to resize it (down 2 pixels) with GIMP first
Baksmali/smali classes.dex (jar/apk files)
You need to have deodexed files to edit the classes.dex and the smali files within. See here for more info, downloads, and the definition of smali, baksmali, and dalvik: http://code.google.com/p/smali/
-decompiling the apk or jar with apktool will also disassemble (for editing) the smali files
-I used to use this baksmali/smali set with tutor (a good resource): http://forum.xda-developers.com/showthread.php?t=1136625
-or, as I typically do now, just remove the classes.dex from the apk/jar and just baksmali, edit, then smali that into a new-classes.dex. For example, I have a folder called smali_bak on my desktop containing baksmali.jar, smali.jar, and a .txt file with the commands shown below (I’m lazy to type it each time, so I copy and paste) – I put the classes.dex that I wish to edit in that same folder, then open the command prompt on that folder and type the following:
To disassemble (baksmali):
Code:
java -jar baksmali.jar -o classout/ classes.dex
To assemble (smali):
Code:
java -Xmx512M -jar smali.jar classout/ -o new-classes.dex
Then, rename it to classes.dex and drop it in the original apk or jar file with a file manager (no need to worry about compression with the classes.dex, as far as I know)
Deodex and create new odex files
Deodexing is basically the process of converting your .odex files into classes.dex files, and inserting those into the apk/jar - basically. And, re-odexing is the opposite - basically.
See cogeary's excellent guide on deodexing for an excellent guide on deodexing.
-xUltimate v2.4+ works well for deodexing
-see also dsixda's Android Kitchen, and there are many other tools for deodexing..
-See here for manual deodex methods: http://forum.xda-developers.com/showthread.php?t=1208320
-See here for a tool/guide to create a new odex file: http://forum.xda-developers.com/showthread.php?t=1853523
This is the new bootclass path for us (and a bunch of other Motos) to use with ICS (taken from /init.rc, minus the jars that didn't exist in /system/framework):
Code:
/system/framework/core.jar:/system/framework/core-junit.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/framework-ext.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/apache-xml.jar:/system/framework/filterfw.jar:/system/framework/com.motorola.android.frameworks.jar:/system/framework/com.motorola.android.widget.jar:/system/framework/com.motorola.frameworks.core.addon.jar
Methods to move your modded files to your phone
-Create cwm recovery flash zips: Create a zip package (normal compression is fine) containing the proper folder structure (for example: /system/app/ and put your apk in the /app folder if that’s where it belongs). I have two folders on my desktop: /system and /META-INF, which I re-use basically for any flashable zip that I make (except ROM’s, of course). The /system folder has an /app folder or /framework folder usually, depending on what I was last working on (but it can obviously have different paths and many folders if need be), and in the /META-INF/com/google/android folder is an updater-script, and an update-binary file (just grab those from another update.zip mod package around here for now). The updater-script has the installation (or removal) info – meaning the location, permissions, and so on… After you create a zip package with those items and your modded files, then use a program like Sign+ to sign the package (or don’t but then you will need to toggle signature checks in recovery mode before installing). This will create three new files in the /META-INF folder (two CERT files and a MANIFEST).
-Use adb to push the files (don’t forget to set proper permissions!):
-Use Root Explorer (or similar) to move it (don’t forget to set proper permissions!):
NOTE: When experimenting with system files, please have a backup accessible just in case. Or, as I often do, make two zip packages - one with the modded files, and one with the original files to restore if necessary. And, as always, you are responsible for what you do to your device.
FURTHER READING:
Since I am obviously not the first to put something like this together, here are a few other general themeing guides:
Guide by theimpaler747: http://forum.xda-developers.com/showthread.php?t=916814
Guide by Nottach: http://forum.xda-developers.com/showthread.php?t=1186819
Interactive help thread by jeffsanace: http://forum.xda-developers.com/showthread.php?t=1605509
More (possibly out-dated) tips from Stericson: http://forum.xda-developers.com/showthread.php?p=3175518
See also this theming guide - did not read fully through it, but looks promising.

[HOW-TO] ADB/Change Moto Lockscreen to AOSP
BRIEF GUIDE TO USING ADB:
I will run through some example commands using adb - like pulling files from phone, pushing files to phone, deleting, setting permisisons, etc..
If you have adb set up in your environmental variables or .bashrc, then you can simply open a command prompt on the folder you would like to use adb from (right-click, or hold shift and right-click on the folder). Just always keep in mind your paths and folder structures.. Also, see HERE for more on adb.
Make sure you have adb and your device drivers installed and set up properly, then connect your usb..
Code:
#Terminates the adb server process (can help clear up adb issues):
adb kill-server
#Starts adb (or just use any adb command to start):
adb start-server
#List attached devices
adb devices
#Start logcat (Ctrl+C will terminate the current process)
adb logcat
#To pull files to the folder in your command prompt/terminal path
adb pull /system/framework/framework-res.apk
adb pull /system/etc/paranoid/preferences.conf
adb pull /cache/recovery/last_log
#To push files to our phone we need to first push them to the sdcard (also making a new directory on the sdcard called "newfolder")
adb push framework-res.apk /sdcard/
adb push SystemUI.apk /sdcard/
adb shell mkdir /sdcard/newfolder
adb push dexopt-wrapper /sdcard/newfolder
#To start a remote shell in the attached device and get superuser access
adb shell
su
#The following commands need to be run from shell..
#Mount /system re-writable
mount -o rw,remount -t ext3 /dev/block/system /system
#Copy files from sdcard to system
cp /sdcard/framework-res.apk /system/framework
cp /sdcard/SystemUI.apk /system/app
cp /sdcard/newfolder/dexopt-wrapper /system/bin
#Set proper permissions
chmod 0644 /system/framework/framework-res.apk
chmod 0644 /system/app/SystemUI.apk
chmod 0755 /system/bin/dexopt-wrapper
#Remove dalvik-cache and/or other files (note: on some ROMs, dalvik-cache is in /cache/dalvik-cache)
rm /data/dalvik-cache/[email protected]@[email protected]
rmdir /sdcard/newfolder
#Mount /system read-only (not necessary if rebooting right away)
mount -o ro,remount -t ext3 /dev/block/system /system
#Exit shell
exit
exit
#Reboot the device
adb reboot
Change Moto Lockscreen to stock AOSP (MultiwaveView)
(FYI - In GB it was a simple bools.xml edit to switch the Moto lock off.. and there's probably another way to do this - like by bypassing the zz_moto stuff entirely, but..)
If you have a custom locksceen already, then this probably doesn't apply or has already been done...
-decompile framework-res.apk
-open /res/layout/zz_moto_keyguard_unlock_widget.xml with Notepad++, Geany, or similar text editor
-delete all text there, and replace with this:
Code:
<?xml version="1.0" encoding="utf-8"?>
<com.android.internal.widget.multiwaveview.MultiWaveView android:orientation="horizontal" android:id="@id/unlock_widget" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentBottom="true" android:targetDescriptions="@array/lockscreen_target_descriptions_with_camera" android:directionDescriptions="@array/lockscreen_direction_descriptions" android:targetDrawables="@array/lockscreen_targets_with_camera" android:handleDrawable="@drawable/ic_lockscreen_handle" android:rightChevronDrawable="@drawable/ic_lockscreen_chevron_right" android:waveDrawable="@drawable/ic_lockscreen_outerring" android:outerRadius="@dimen/multiwaveview_target_placement_radius" android:hitRadius="@dimen/multiwaveview_hit_radius" android:vibrationDuration="20" android:snapMargin="@dimen/multiwaveview_snap_margin" android:feedbackCount="3" android:verticalOffset="0.0dip" android:horizontalOffset="0.0dip"
xmlns:android="http://schemas.android.com/apk/res/android" />
Stopping here and recompiling would give you something like this:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
The above just changes the "widget" to the aosp multiwaveview and uses resources/drawables that we already have, which Moto decided to overlay with theirs (adding more bulk to the apks/jars)...
To edit the layout (remove/rearrange things in general), you need to edit keyguard_screentab_unlock.xml in the same folder - it's all there - the clock, date, sound toggle, horz. divider, charge (@id/status1) and alarm icons, unlock widget, music controls, etc... just play around with things..
To add the phone and text msg icons to the unlock widget, we need to edit the android.policy.jar and other xmls in framework-res.
More to come on that...
For Honeycomb style ripple lockscren mod, see here: http://forum.xda-developers.com/showpost.php?p=33854556&postcount=70
Change Clock Color in Status Bar (OUTDATED: FOR GB)
(This is a method I came up with myself)
-First, find a color that you want for your status bar clock.
-Now, find the hex code (combination of 6 letters and numbers) for that color --> see HERE, and/or HERE, and the Android Design guide for colors HERE. You may also use programs like GIMP and Photoshop to preview colors by hex code.
*For reference, 000000 is the absence of color (completely black), on the other end is ffffff (full on, all blinding color - completely white). Also, 33b5e5 is for ICS blue, 99cc00 is for android green (used below in the example).
-Decompile SystemUI.apk
-Open /res/layout/status_bar.xml (with a proper text editor like Notepad++)
-Look for the line that I highlighted in blue (from stock 2.3.6):
Code:
<?xml version="1.0" encoding="utf-8"?>
<com.android.systemui.statusbar.StatusBarView android:orientation="vertical" android:background="@drawable/statusbar_background" android:focusable="true" android:descendantFocusability="afterDescendants"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout android:orientation="horizontal" android:id="@id/icons" android:layout_width="fill_parent" android:layout_height="fill_parent">
<TextView android:textAppearance="@android:style/TextAppearance.StatusBar.Icon" android:textSize="16.0sp" android:textStyle="bold" android:gravity="left|center" android:id="@id/onsText" android:paddingLeft="6.0px" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:maxLength="18" />
<com.android.systemui.statusbar.IconMerger android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/notificationIcons" android:paddingLeft="6.0dip" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0" android:layout_alignParentLeft="true" />
<LinearLayout android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/statusIcons" android:paddingRight="6.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_alignParentRight="true" />
[COLOR="Blue"]<com.android.systemui.statusbar.Clock android:textAppearance="@android:style/TextAppearance.StatusBar.Icon" android:gravity="left|center" android:paddingRight="6.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />[/COLOR]
</LinearLayout>
<LinearLayout android:orientation="horizontal" android:id="@id/ticker" android:paddingLeft="6.0dip" android:animationCache="false" android:layout_width="fill_parent" android:layout_height="fill_parent">
-Add the code android:textColor="#ff33b5e5" to the line that starts with <com.android.systemui.statusbar.Clock as shown highlighted red below (NOTE: Insert your choice of hex code here - the 33b5e5 is just used as an example):
Code:
<com.android.systemui.statusbar.Clock android:textAppearance="@android:style/TextAppearance.StatusBar.Icon" [COLOR="Red"]android:textColor="#ff99cc00"[/COLOR] android:gravity="left|center" android:paddingRight="6.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />
Again, insert your choice of color in the blanks> android:textColor="#ff------"
-Make sure your spaces are uniform and then save the xml.
-Compile the apk, and use your own method for copying signatures (I use APK Manager, it does it for you)
-Move to your phone by your own means... Enjoy! Please don't blame me if you mess something up!
Related:
There are a lot more mods with partial direction in individual posts throughout this thread.. read on, if interested. I will hopefully compose a location list or something for some of these other mods in the near future.. until then, good luck, and godspeed...
HOW-TO Remove Carrier Name from Status Bar
Bools.xml mods list

Very nice! A while ago I figured out a different way to do it, having to do with editing framework-res/res/values/styles.xml and changing a color code in there. But your way is a bit simpler .
Thanks for the guide! It would be awesome if this thread turned into something like this (see the 2nd and 3rd posts).

cogeary said:
Very nice! A while ago I figured out a different way to do it, having to do with editing framework-res/res/values/styles.xml and changing a color code in there. But your way is a bit simpler .
Click to expand...
Click to collapse
I've learned that there are definitely multiple ways to skin a cat, in terms of themeing android - I went the long way with inverting some apks in Romulus (I did not touch the AndroidManifest), and that forced me to learn how to read and understand this "extensible markup language" a bit better - and to correct my text color issues, I learned that you can just add the text colors if you find the right xml...
cogeary said:
Thanks for the guide! It would be awesome if this thread turned into something like this (see the 2nd and 3rd posts).
Click to expand...
Click to collapse
Oh boy, I should've reserved more posts for something like that! I would love to put something comprehensive together like Nottach did, but with ICS coming, I know a few things will change - so, I figure I'm better off waiting and learning that system first..

Not sure why but I couldnt find those exact lines you have in the exampme box. And whats with the crazy symbols? Sorry man...still a lil new as you know at messing with this type of stuff.
sorry the pics are so ****ty. Lo-light, laptops and cameras/phones dont mix well lol. Thanks in advance man.
Sent From MY DROID That DOES! Not YOUR APPLE That DIDN'T!

^
I think you just unzipped, did not decompile SystemUI.apk

DX2Trip said:
Not sure why but I couldnt find those exact lines you have in the exampme box. And whats with the crazy symbols? Sorry man...still a lil new as you know at messing with this type of stuff.
sorry the pics are so ****ty. Lo-light, laptops and cameras/phones dont mix well lol. Thanks in advance man.
Sent From MY DROID That DOES! Not YOUR APPLE That DIDN'T!
Click to expand...
Click to collapse
Did u decompile the apk ?? That's y u probably got the wired symbols
Sent from my MB865 using xda premium

You are going to need to decompile the apk to be able to read those xmls...
I use APK Manager 5.0.2 for Windows - see updated OP.
Then read up on some other threads about the process, also check the carrier name removal post I linked in OP#2... but yea, there is good literature on de/recompiling out there..
P.S. - for me, all of my codes in the op's are botched and have smiley faces on the xda app - I did use code tags..!? Reference them on a computer for easier reading...
Sent from my phone's mind
EDIT: edited.

I updated the heck out of this thread to give some guidance on using APK Manager for decompiling and compiling (at least they way I do it)... hope it helps a few people.

Man...seem to always run into an error. Any thoughts? Don't know why it shows up as status bar right before installing. It does say SystemUI.apk in the folder though...
Sent From My DROID That DOES Not My APPLE That DIDN'T.

Are you getting errors compiling the apk? How are you trying to install the apk on your phone? It looks like some sort of SystemUI is installed from your pic (since you still have a status bar showing)... But, the Status Bar process is the SystemUI.apk. So, I'm a little confused..
I need a bit more info on how you're doing things to try and help you better..

Are you getting errors compiling the apk? How are you trying to install the apk on your phone? It looks like some sort of SystemUI is installed from your pic (since you still have a status bar showing)... But, the Status Bar process is the SystemUI.apk. So, I'm a little confused..
I need a bit more info on how you're doing things to try and help you better..
Click to expand...
Click to collapse
My bad lol, should have explained better. No errors decompiling, editing, compiling or signing. Just trying to install right from the root folder I placed it on in my SD. Don't know if its because it wont install over the OG SystemUI.akp or what. Yeah the OG was still intact while I tried installing the edited one. In fact I tried just moving the edited one into my system apps n it kept forceclosing to the point where I had to reboot and when it started back up I had no status bar at all! lol no worries though, had a nandroid and have still been trying to figure it out...maybe signatures have somthing to do with it. Idk...
heres what it looks like on the SD card. But right when I press it, it turns into status bar...odd.
Sent From My DROID That DOES Not My APPLE That DIDN'T.

I followed the instructions to the letter worked great ur awesome. Got my status bar clock red yea buddy lol
Sent from my MB865 using xda premium

DX2Trip said:
My bad lol, should have explained better. No errors decompiling, editing, compiling or signing. Just trying to install right from the root folder I placed it on in my SD. Don't know if its because it wont install over the OG SystemUI.akp or what. Yeah the OG was still intact while I tried installing the edited one. In fact I tried just moving the edited one into my system apps n it kept forceclosing to the point where I had to reboot and when it started back up I had no status bar at all! lol no worries though, had a nandroid and have still been trying to figure it out...maybe signatures have somthing to do with it. Idk...
Sent From My DROID That DOES Not My APPLE That DIDN'T.
Click to expand...
Click to collapse
I used root explore to move my SystemUI.apk into system/app folder with permission set at rw-r-r override and replace old 1 reboot and should be fine
Sent from my MB865 using xda premium

DX2Trip said:
My bad lol, should have explained better. No errors decompiling, editing, compiling or signing. Just trying to install right from the root folder I placed it on in my SD. Don't know if its because it wont install over the OG SystemUI.akp or what. Yeah the OG was still intact while I tried installing the edited one. In fact I tried just moving the edited one into my system apps n it kept forceclosing to the point where I had to reboot and when it started back up I had no status bar at all! lol no worries though, had a nandroid and have still been trying to figure it out...maybe signatures have somthing to do with it. Idk...
Sent From My DROID That DOES Not My APPLE That DIDN'T.
Click to expand...
Click to collapse
Thank goodness for cwm on boot and fresh backups ..
Well, I can tell you right off the bat that your method of installation is giving you problems. Also, don't sign the SystemUI.apk, you want to retain the original signature.
It is possible to move it on your phone with root explorer, but I know some people are against this method.. but, here it goes anyway..
-First go and check the permissions of (and possibly make a copy of) the file that you want to replace. Go to the file location, mount R/W, and long-press the file and choose permissions - and remember them, or write it down. (Note: All apps and framework in /system are rw-r--r--)
- Next, copy the new file that you want to put on your phone from your sdcard.
- IMPORTANT: Paste it in another system folder besides the final destination and SET the proper PERMISSIONS and rename if necessary to match the file you are replacing (need to mount R/W first). For example, paste your edited SystemUI.apk in the /system folder (NOT directly in the app folder), and change the perms there..
- IMPORTANT: Long-press on the file you are moving and select "MOVE".
- Then paste it in the final destination folder (i.e. /system/app), and select ok to overwrite the existing.
- Don't try to do anything else except reboot. And, it would be nice to wipe dalvik and cache partition while you are rebooting, if you have the chance.
Please, if anyone tries this method, be cautious, use CWM on Boot, and have a fresh backup just in case.. also, I assume no responsibility for your actions.. I have done this multiple times with many different file types and locations..
Sent from my phone's mind

chrisn91 said:
I followed the instructions to the letter worked great ur awesome. Got my status bar clock red yea buddy lol
Sent from my MB865 using xda premium
Click to expand...
Click to collapse
Very cool! Glad to hear it worked for you! You got a screenshot of the red?
Sent from my phone's mind

Yea..
Im reading on how to center my lockscreen clock and changing the color red as well
Sent from my MB865 using xda premium

chrisn91 said:
Yea..
Im reading on how to center my lockscreen clock and changing the color red as well
Sent from my MB865 using xda premium
Click to expand...
Click to collapse
Nice. You make all the edits yourself or is that a custom rom? Either way, lookin good, man.. keep it up!
And, I was also just about to dig into a few things, lockscreen clock color happens to be one of them.. but, I got the old moto lockscreen (which has a centered clock), so I'm thinking those xmls might be in a different place than the new moto lockscreen stuff... we'll see..
Sent from my phone's mind

alteredlikeness said:
Nice. You make all the edits yourself or is that a custom rom? Either way, lookin good, man.. keep it up!
And, I was also just about to dig into a few things, lockscreen clock color happens to be one of them.. but, I got the old moto lockscreen (which has a centered clock), so I'm thinking those xmls might be in a different place than the new moto lockscreen stuff... we'll see..
Sent from my phone's mind
Click to expand...
Click to collapse
Its a little of both. I.did some theming to sv6 with some pngs from other roms although I've learned alot here creating a img from scratch is a hard thing for me to grasp lol. I've tried many times to change the status bar clock but it won't work I would get systemui force closures or no change at all but thanks to ur steps and how to guide I got it
Sent from my MB865 using xda premium

Well I couldn't figure it out for the old native AOSP jog tab lockscreen, but I managed to change the clock and date color on the new Moto sliding door lockscreen... also changed the font style of the clock to DroidSans (which is actually Ubuntu font on Romulus, the default system font - it was Chulho_Neue)..
But, as you can see, I didn't get the "charging" text color. Also didn't look at moving the position yet..
Oh, yea... it's in framework-res.apk/layout/zz_moto_sd_keyguard_screen_tab_unlock.xml - look for the lines with the ids "timeDisplay", "am_pm", and "date"...
But the zz_moto_keyguard_screen_unlock_portrait.xml threw me off, and may have something more to do with this...
I'll try to look into this and post something better 2moro..
Sent from my phone's mind
EDIT: I think I just found it for the native jog tab lock... in a very obvious place: keyguard_screen_tab_unlock.xml (without the zz_moto_sd part, obviously) - this may help to center the zz_moto_sildingdoor lockscreen text as well... get some ideas or lines of code from it, and copy it over to the zz_moto keyguard xml..

Related

[Guide] Hacks and mods: Three tutorials for modifying your x10 OS aesthetically

Updated: July 24/2010 Go to the X10 Theme repo for a listing of uploaded themes.
Thanks to everyone that is helping out and contributing. I also apologize if I rip anything off. If I do please post it and I will definitely correct it.
The usual disclaimer goes with this... Use at your own risk and backup your system before making any changes. You know what to do if you run into problems
I think this is important...
Links for various stuff:
framework-res.apk
/system/app/ folder
startup show (boot animation)
Mms.apk
Phonebook.apk
apps2sd-work in progress?
http://forum.xda-developers.com/showthread.php?p=7037044#post7037044
Many visual aspects of the os and system apps can be changed and surprisingly easily. By default when opening an apk you should look around the res-drawable folders for the pngs to edit. If you have noticed, there are some png's that look like xxx.9.png. To modify these files easily, remove the 9 from the filename and open with your preferred editor. When you are done editing the files save them, open the command prompt and type draw9patch. This should open a window with an arrow in it. Drag your file there and I'm pretty sure it goes into the same folder. That's it.
If you are using a mac use betterzip and take a look here.
You can also use root explorer (I havent tried this myself)
Step 1:
Connect phone to pc, enable usb debugging and open adb. Type:
adb pull /system/framework/framework-res.apk framework-res.apk
That will pull your framework-res.apk to whatever folder is displaying in your command line.
Step 2:
Find the framework-res.apk on your hard drive, right click and open with 7zip.
Step 3:
Use png's here or create your own and dump into the appropriate folder within framework-res.apk.
Step 4:
When you are done editing the files open up adb and type the following command:
adb shell mount -o remount,rw -t yaffs2 /dev/block/mtdblock2 /system
adb push framework-res.apk /sdcard/framework-res.apk
adb shell dd if=/sdcard/framework-res.apk of=/system/framework/framework-res.apk
That will put the new framework-res.apk on your phone. It should automatically reboot (if not reboot it) and your changes should be applied!
When running the script above you can replace framework-res.apk with whatever you want. For example, Timescape.apk
Remember, it is CASE sensitive I made this problem many times)
If you would like to pull an entire folder put a slash at the end of the last word. For example, adb pull /system/etc /etc"/" (no " in actual script )
Courtesy of corruptfate is the steps to modify the startupshow (post #207)
step 1: open adb shell
step 2: type "adb shell"
step 3: type "su"
step 4: type "mount -o remount,rw -t yaffs2 /dev/block/mtdblock4 /system"
step 5: type "mkdir system/etc/semc/startupshow"
step 6: exit and redo step 1 - 4
step 7: type "mkdir system/etc/semc/startupshow/default"
step 8: exit and open command prompt again, this time type "ddms"
step 9: look for the default folder in system > etc > semc > startupshow > default
step 10: push the images into that folder
Possible reasons your phone won't boot after modifications:
images anren't stored properly, right format, right size etc.
unpacked apk improperly, use 7zip, it doesn't mess anything up
you signed the package before pushing it- unless you know what you're doing follow the directions to a tee and you should be fine
pushed the package to the wrong directory, /system/framework-res.apk XX, /system/framework/framework-res.apk
I'm sure many other reasons, these were the only ones I encountered
How to get past boot screen:
Use backup framework-res.apk and push that one to your phone. Remember to place that one where the modified one is.
To see if adb sees your phone type adb devices, if a serial number pops up try pushing your original, if not...
Flash your phone again from scratch . Sorry, I don't know any better way yet.
Please post your themes and download themes from the X10 theme repo
The basics:
http://forum.xda-developers.com/showthread.php?t=502010
http://developer.android.com/index.html
http://developer.android.com/guide/developing/device.html
Some Links:
Notification background color
Status bar clock color
Notification font color
Notification bar shortcuts
Edit 9.png's
Install mobile defense as system app through terminal (I haven't tried this yet)
Resigning apps
http://forum.xda-developers.com/showthread.php?t=549109
http://androidforums.com/developer-101/8665-how-signing-roms.html This is the one I have been using. I just noticed its for roms
http://code.google.com/p/android-apktool/ Figured it out but no need for it as of yet
How to modify notification background colors
Some of the files; not sure which is the top band displaying carrier(semc_avctivity_title.9.png??):
statusbar_background.png
status_bar_background.png
status_bar_close_on.9.png
status_bar_header_background.9.png
status_bar_item_background_normal.9.png
They should be in res/drawable-240dpi. Once you find them open them and modify as you wish. Once completed save your changes.
Getting FLAC working, I was wrong, mixed up file folders. Apparently meridian pioneer works. Havent gotten a chance to test for sure yet. I am now trying to manually add flac support to mediascape
Second tutorial: Busting open apks so you can edit xml's!!
So has anyone tried opening up an xml file on their phone to edit only to find incoherent coding. Well I have. So I have stumbled upon a tool called apktool. The tool somehow breaks down the apk into readable xml files. I haven't gotten so far as to test out an edited xml because I wanted to post this so I don't forget how to do it.
1. follow instructions on installing apktool. Unzip the files into your android-sdk-windows/tools folder
2. Put a copy of your framework-res.apk into the same tools folder
3. from command type: java -jar apktool.jar if framework-res.apk
4. Put whatever apk you want to edit into tools folder and type this: java -jar apktool.jar d xxx.apk
5. Look in your tools folder and voila there will be a folder named with whatever apk you worked with.
Third tutorial: Use smali/baksmali to edit services.jar and services.odex
1. follow instructions on downloading and installing smali/baksmali
2. pull these files from your phone and place them into the same folder as smali (should be android-sdk-windows\tools):
code.odex
ext.odex
framework.odex
android.policy.odex
There may be other ones needed that Im missing so if you find this out please let me know
3. place the odex you want to modify into the same folder (android-sdk-windows\tools)
4. from the command line type java -jar baksmali-1.2.3.jar -x services.odex
your pc will work a little bit and when its finished will just show your directory again.
5. minimize that screen and go into the folder you put everything in there should be an out folder. Open it up and all the files to edit will be there!
I haven't recompiled yet but when I do Ill finish this tutorial.
COMMON PROBLEMS:
These are some problems I ran into because I am a noob. I figure it may help a couple people out
1.unable to access apktool.jar/baksmali-1.2.3.jar
Im pretty sure you are in the wrong directory
from the command line type: cd C:\whatever\directory\leadsto\android-sdk-windows\tools\the.jarfileyouaretryingtoaccess
2....
Modification requests:
Custom boot screens-- find your startupshow folder=== SOLVED
custom response to invalid password
Ad hoc support
Disable slide lock
App drawer categorization=== THERE'S AN APP
map hardkeys
cool, gonna try and change the battery indicators
I was able to replace framework-res while the phone was running, but now the phone wont boot.. good thing I made a backup of the original one
xxsashixx said:
I was able to replace framework-res while the phone was running, but now the phone wont boot.. good thing I made a backup of the original one
Click to expand...
Click to collapse
Thats where I'm stuck too. Did you resign the package after modifying it? Im going to try that in a bit.
Does anyone know of a good n00b guide to emulating our phone in eclipse?
@microkiwi can you post how it went?
I did make some new icons in PS, but unfortunately I wasn't able to boot the phone after pushing my new files to it
I also tried to sign it with the autosign (testsign.java) application but no luck...
mikrokiwi said:
I did make some new icons in PS, but unfortunately I wasn't able to boot the phone after pushing my new files to it
I also tried to sign it with the autosign (testsign.java) application but no luck...
Click to expand...
Click to collapse
Cool thanks, hey have you seen an app called metamorph? I just noticed it right now but it seems like stericson automated and simplified the process. Heres a link
http://forum.xda-developers.com/showthread.php?t=591329
Have you tried that app yet?
Yes, I have made a metamorph theme now and everything seems fine, the theme shows up and I can apply it and everything.
But after reboot the phone is still using the old icons
Any other metamorph themes that we can install?
I think for 1.6 only
gavriel18 said:
http://code.google.com/p/android-apktool/ Looks cool I just wish I knew how to use it
Click to expand...
Click to collapse
Apktool is just for everything else but signing ;-)
mikrokiwi said:
Yes, I have made a metamorph theme now and everything seems fine, the theme shows up and I can apply it and everything.
But after reboot the phone is still using the old icons
Click to expand...
Click to collapse
Could you please upload the theme, I'd like to learn how theming works. In the AndroidThemes thread I found only themes for custom roms. THX !
mikrokiwi said:
Yes, I have made a metamorph theme now and everything seems fine, the theme shows up and I can apply it and everything.
But after reboot the phone is still using the old icons
Click to expand...
Click to collapse
Could you please post the .png files from the framework pull? I would like to change the colors and then try to replace them with files in a theme that I found that might work with our phone. The only issue is the resolution of the theme that I had in mind. If this works then we can all make custom themes for our X10 using that theme as a template. Not sure if it will work, but I would like to try.
pietropizzi said:
Could you please upload the theme, I'd like to learn how theming works. In the AndroidThemes thread I found only themes for custom roms. THX !
Click to expand...
Click to collapse
Unfortunately it does not work at the moment, but when I get it to work I will upload it for everyone to use
troyjamz said:
Could you please post the .png files from the framework pull? I would like to change the colors and then try to replace them with files in a theme that I found that might work with our phone. The only issue is the resolution of the theme that I had in mind. If this works then we can all make custom themes for our X10 using that theme as a template. Not sure if it will work, but I would like to try.
Click to expand...
Click to collapse
http://www.mediafire.com/file/kkmhmnyhgyw/framework-res.apk open it with 7zip
Thx man!
mikrokiwi said:
Unfortunately it does not work at the moment, but when I get it to work I will upload it for everyone to use
http://www.mediafire.com/file/kkmhmnyhgyw/framework-res.apk open it with 7zip
Click to expand...
Click to collapse
Tack så mycket!
@microkiwi Thanks for the upload, do you mind if I post that link in the first post?
@brut.all Does it work the same way as autosign? I followed the instructions properly on installing it but when I try to open it a command line pops up for a second (too fast for me to read) and then closes. Am I missing something?
Also do you know if framework-res.apk needs special signing? I'm just trying to figure out why the phone gets stuck at boot after pushing the modified apk.
@pietropizzi I have made one as well it doesn't work but I'll upload it right away. Check out the metamorph thread for some tutorials on theming. It is surprisingly easy.
On another note has anyone gotten to move their apps to the sdcard? I've tried but with no luck..
heres a post I made about it:
http://forum.xda-developers.com/showthread.php?p=7037044#post7037044
Cool ,I'm going to try it tonight. Mind if I add it to the list at the top?
BTW did anyone know mediascape supports wav audio Swwweeeeeetttt

How to: Transparent Notification/Window Shade in Froyo -

Transparency MOD:
If you want to have a transparent notification window (the window shade), you can follow these steps:
Required:
- a working adb connection (you will need a PC because of the executable below)
- a transparent status_bar_background.png (if you do not have your own, the one i used is attached)
- xUltimate-TP.exe (attached)
- a file archiver (i used WinRAR)
Note: This should work on any Android phone running Froyo.
Firstly, you need to copy services.jar and framework-res.apk from the Android Phone to your PC
1.) Reboot into Recovery (fake-flash, Unrevoked, or adb recovery, they will all work)
2.) adb shell
mount /system
adb pull /system/framework/services.jar c:\
adb pull /system/framework/framework-res.apk c:\
3.) Optional: Copy the framework-res.apk and services.jar files to a separate directory.
4.) Copy xUltimate-TP.exe to the same directory the files mentioned above are located in.
Run xUltimate-TP.exe and wait for it to say it is finnished (it takes about 2 minutes to complete)
5.) Open framework-res.apk in WinRAR and go -> res -> drawable-hdpi-v4
Copy your status_bar_background.png into this folder inside WinRAR by dragging it over the window.
Close WinRAR
6.) Copy the patched services.jar and framework-res.apk to c:\
7.) adb shell
rm /system/framework/services.jar
rm /system/framework/framework-res.apk
**CTRL+C (to exit back to the windows shell)
adb push c:\services.jar /system/framework/services.jar
adb push c:\framework-res.apk /system/framework/framework-res.apk
adb reboot
And that's it.
I have attached my patched services.jar and framework-res.apk
If you are running Defrost 2.0+, using them may work for you (I am using DeFrost 2.4).
Major props to:
http://www.droidforums.net/forum/xeudoxus/47283-release-xultimate.html
as it is his executable that patches the transparency.
Josh.
fllash said:
Hi there,
I apologize if this seems to be the incorrect sub forum to post in, however the thread i made in Themes has no responses after a week or so.
On to my question.
I have flashed many froyo roms for the desire, but they all have one thing in common - they do not have a transparent window shade/notification thingo.
I dismantled a few themes with transparent windowshades, copied them across to my framework-res.apk file and pushed it back to system/framework, but nothing changes. Well, a couple of the png's i have overwrote in the framework-res file caused the window shade to change colour (for example in the theme where the windowshade had a dark transparent background, the background turned black).
Is there a limitation somewhere preventing desire users of froyo to change transparency?
Or is there another file that needs to be edited?
Thanks for readin'
Josh.
Click to expand...
Click to collapse
I've asked the same thing and no one has replied, I assume you mean the notification drawer?
Changing the png file alone doesn't add transparency, it only does on the notification bar, there must be an xml file in framework-res.apk which handles transparency for it, but I'm so inexperienced in xml I haven't tried looking and there's so many xml files it would take days to convert each one to "readable" xml and find which line of code among thousands controls it
I haven't tested it, didn't have the chance, but you can check here
http://www.droidforums.net/forum/xeudoxus/47283-release-xultimate.html
Look for xUltimate Froyo Transparency Fix
Yeah, i mean the notification draw - that you drag downwards.
Thanks for the link, im checking it out right now.
phunkycow said:
I haven't tested it, didn't have the chance, but you can check here
http://www.droidforums.net/forum/xeudoxus/47283-release-xultimate.html
Look for xUltimate Froyo Transparency Fix
Click to expand...
Click to collapse
I tried patching the service.jar with it but it doesn't seem to work.. anyone else have tried too?
sckc23 said:
I tried patching the service.jar with it but it doesn't seem to work.. anyone else have tried too?
Click to expand...
Click to collapse
Did you make sure the background image of the "notification drawer" is transparent? Or applied it using the stock framework-res?
phunkycow,
You are a Genius,
It worked like a charm!
For anyone who is interested, the steps i followed were:
1.) Reboot into Recovery
2.) adb shell
mount /system
adb pull /system/framework/services.jar c:\
3.) Download the Transparency patch (I've attached it if that makes it easier)
4.) Copy the services.jar from c:\ to a folder (i used the desktop), and make sure that the Transparency fix executable (xUltimate-TP.exe) is in the same folder.
5.) Run xUltimate-TP.exe and wait for it to say it is finnished (it takes about 2 minutes to complete)
6.) Copy the patched services.jar (it overwrote the one in the folder) to c:\
7.) adb shell
rm /system/framework/services.jar
**CTRL+C (to exit back to the windows shell)
adb push c:\services.jar /system/framework/services.jar
adb reboot
And that's it.
I have also attached my patched services.jar, and framework-res.apk with a transparent status_bar_background.png.
If you are running Defrost 2.0+, using them may work for you (I am using DeFrost 2.4).
Now, you MAY NOT notice any transparency straight off the bat because your theme may not have a transparent status_bar_background.png.
If you find that it isnt transparent, i have attached a transparent status_bar_background.png
You need to add this to your framework-res.apk.
Major props to:
http://www.droidforums.net/forum/xeudoxus/47283-release-xultimate.html
as it is his executable that patches the transparency.
Josh.
Glad I've helped, even a little. I was lucky enough to bump to that thread accidentally after looking for ways to deodex! You may want to edit the original post with the steps to apply transparency, and maybe edit the title as well? I'm sure other people might be interested as well
phunkycow said:
Did you make sure the background image of the "notification drawer" is transparent? Or applied it using the stock framework-res?
Click to expand...
Click to collapse
I did. I took the background image from Amer v4 (which is transparent) and flashed both the patched service.jar and new image to the phone. The notification panal ended up solid black.
Anyway will definitely try it again to see if i have any luck this time=)
Can someone post a screenshot? I could have sworn I have tried all this already to no avail.
edit: also, I thought that the services.jar patcher mentioned above was for the notification bar. Does this only make the notification bar transparent, or the actual background of the shade (where not covered by notifications)
This method did not work for me, however this one did
http://forum.xda-developers.com/showpost.php?p=7739623&postcount=53
Glacier with Gr8gorillas desire HD port 2.2

[GUIDE] Newbie's How To: Port Theme's

How To Port Theme's
(Using Apktool, and Theme Porter)
Since there are some people out there willing to learn but not exactly able to with all of the convoluted information on the forums, I decided I'd start putting together a guide similar to other's to aid those trying to learn. Stay tuned as this is under construction!
All credit is due to original creators of the product's used in this process, without them there wouldn't be a reason for this guide . Please be respectful of other's work, sometimes it's best to ask before attempting (if it is an original product) but at very least give credit and a link back.
What is porting?
Porting very basically is taking .png files and XML changes from one theme (typically created for a different model, but using the same resolution) and copying them into deodexed stock rom's such as EC10/EE19 Pick and Pack so that they can be flashed onto our phones and used with our framework and/or updated framework.
Sounds really easy, doesn't it? At first it will be cumbersome and frustrating, but after you've used the processes enough you will be able to snap these out in 30 minutes or less! The problem lies in the way these files are packaged, they are mainly just a .zip file that isn't compressed, however there is another layer to an .apk that you can only see once you've learned how to use tools such as apktool/apkmanager. The other tool we will use to aid us in this painstaking process is an application called Theme Porter, which essentially is a script that has been written that will do all of the legwork for us. Let's get started!
What will I need?
Apktool I currently use an older version of the program, you can download here, this one I know works for sure - last I heard the other has issues.
ThemePorter
7zip (Win rar could be used instead)
Notepad++ (Or equivalent code editing software) which will be used to make the xml changes. If you're not familiar with using something such as this, you may want to take time to research before attempting to port.
How to set up;
Begin by getting ThemePorter setup, you just need to unzip the download and that will be "theme porter" It is basically just made up of a few folders, and has a batch script that you will use to initiate the process. I just place mine on the desktop for easy access.
Secondly, get apktool downloaded and unzipped. place the apt folder somewhere where you can easily navigate to it through a command prompt. C: might be a good place if you want to save yourself some keystrokes.
Next just make sure you have notepad++ or another editor installed for use later.
Lastly, get 7zip installed so that you're able to open .apk and .zip files without actually extracting the files.
Where do I get my source files?
You can use any framework from any rom that can be decompiled correctly with apktool. This means when you decompile it, there are no errors and it generates a folder with the same name. Download the rom of your choice and save it (still zipped) somewhere on your desktop, and make an extra copy in case you mess up and overwrite the wrong files. You will ALWAYS use these in the NEW folder within theme porter, but we will get to that.
As for the theme you're trying to port, I usually use fascinate theme's, because it is basically a direct copy of our phone (Note: As of 2.2 they now have a Data on/off icon in their status pull down, where we have Silence, so this will often need to be taken care of separate from this process.) I've also recently started using Vibrant theme's, as these are also very similar - but there are tweaks with these too and I will try to cover them in the guide at some point. You may find others that will work too, at this point this is all I've had time to mess with. Either way, download the .ZIP file and also place it somewhere easy to access.
This is where it get's sort of difficult.
Stock ROM's have some differences to theme's that theme porter cannot handle for you. These are basically MOD's that may exist in the theme ROM and/or XML changes that have been made to alter text color's to accommodate the theme (black to white, white to black, etc.) These changes WILL NOT be ported over using theme porter and unfortunately also cannot be made AFTER using theme porter, so there is a certain process to go about this.
Now enter's apktool. Apktool is a script brut.all very kindly wrote to assist android developers in decompiling/recompiling .apk files without losing structure that normal compression software breaks. Basically there are two reasons you will need to take this step.
When;
Editing Text Color- When choosing a theme to port you will need to pay attention to the screenshots the original poster has posted, as these will clue you in whether or not this needs to happen.
The Pick and Pack rom is essentially still stock, as far as XML goes - so the text on menu's for example, will be Black text on a white background. If the theme you chose has something different, you will need to take this step so that the text is legible in the final theme.
Adding accurate battery MOD- Also when choosing a theme you will need to take a look at the framework-res.apk file to determine if the themer has added the accurate battery mod. Essentially all this means is the XML and image's have been edited to show you each percentage of battery life vs. the stock one that only shows odd increments of 10/15/20.
Open framework-res.apk with 7zip
Navigate to res/drawable-hdpi (this also may be drawable-hdpi-v4 depending on your theme, I haven't quite figured out why this is)
Scroll down until you see the status_battery icons near the bottom - if there are not images for every percentage - then no mod exist's and you can skip using apktool for this step.
How;
For either change you will follow this process to decompile To gain access to the XML/PNG files that contain these text values, we will need to decompile the framework-res.apk file from the rom.
Copy framework-res.apk from the rom and place in the APT folder created earlier.
Rename this to something shorter such as "FW.apk" for easier command lines
Start a command prompt (in windows 7 type "cmd" in the search bar within start menu)
Navigate to the APT folder, For example;
Code:
CD c:\Users\brandon\Desktop\apt
Type
Code:
apktool d FW.apk
This will decompile the .apk into a folder called FW within the APT folder, allowing you access to the files. I will cover the actual changes in a later post.
At this point you have the files in a folder and they can be edited how you see fit (should you choose to just edit the stock ones vs. actually porting already changed ones).
You'll notice when examining the folder that there are quite a bit more files. Also, you will be introduced to the .9.png file type, which essentially is just a .png file that has some black lines embedded in the file to instruct android how to resize and reuse the image within the framework.
Any edits made to these files must be made carefully, as to not alter the integrity of these black lines. When the file is recompiled, the lines will disappear but will be included (if you tried doing this without decompiling - your photo editor would nix these lines and android wouldn't know how to size them)
If all your edits were complete, you would then recompile the file through apktool. (I will continue with the theme porting guide in the next step, this is just a good reference point for these steps.)
Type this into the command prompt
Code:
apktool b FW framework-res.apk
This would then create the framework-res.apk file in the APT folder, however there is an important step here. During this process the META folder is lost, and the AndroidManifest file is corrupted.
Delete the AndroidManifest.xml file from the new framework-res.apk
Copy the META-INF folder and the AndroidManfiest.xml file from the ORIGINAL framework-res.apk (now named FW.apk in this example) and place it in the new framework-res.apk using 7zip (do not extract the file, open the archive with 7zip.)
At this point, your framework could be ready for replacing in your theme.zip (will be covered later) with the edit's you've made Or if you're learning how to port theme's, continue reading.
Guide Part 2....
Preparing for Theme Porter
Okay now that we have some of the side process out of the way, let's get back to the guide.
Determine if you need to make any XML edit's for battery or text color changes and perform them per the processes detailed below. If you do not need to make them, you may skip this step completely and move on to using theme porter.
Correcting Accurate Battery Mod Animations-
Follow this guide to make the changes to the framework to use the new charging animation images and will allow you to then use theme porter to swap the .png files
Decompile the framework-res.apk from the ROM download (I usually just rename this to EE19.apk or whatever the rom is i'm working with)
Decompile the framework-res.apk (I first rename the framework-res.apk file to NEW.apk (or whatever you wish) Note: It will typcially give you errors (unless it's theme'd correctly) but you're just after some code from a few .xml files so don't worry.
In the NEW folder Navigate to
Code:
\res\drawable-hdpi\
or
\res\drawable-hdpi-v4\
Copy all of the battery charging .png's and drag them to a folder on your desktop. Then open the EE19 folder within APT (the one you decompiled from the rom you're working from) Drag those images into the /res/drawable-hdpi-v4 directory replacing any existing ones.
open the following file in notepad++
Code:
\apt\NEW\res\drawable\stat_sys_battery_charge.xml
Also open the same file within the EE19 decompiled folder
In the THEME xml file select all and copy
In the EE19 xml file, paste this replacing the text. Then save it overwriting the original.
At this point, the battery mod is done and the new .png files exist so that theme porter can do it's work (And the xml is there to make it works when it get's to your phone). If you don't have any text edits to make, you can recompile the apk (as stated in steps in first post) and move on to steps below (skipping the section on changing text).
Changing text colors-
If you have determined that the text in the theme is different from the rom framework (I.E. Text on notifications, menu's, etc.) then you will follow these steps to locate where these changes need to be made.
If you haven't already, decompile the framework-res.apk from the Rom.
Next, determine what text color edit's you need to make and then use this wonderful reference to determine which actual files those edit's correspond to.
Locate the file you need to edit in the decompiled folder, and open it with 7zip.
Typically removing the "inverse" reference on the color line will change it from black to white, or white to black and is the easiest/best way to alter colors in a ROM. (For a quick note, searching for "menu" in the styles.xml files located in /values/ will give you the items you need to change, watch for _bright references for the dividers, change those to _dark instead.
Once you are done making these edits, recompile the folder as stated in first post. And move on to using theme porter.
Using Theme Porter-PAY CLOSE ATTENTION HERE.
Now that you have the appropriate prep-work done, the easy part finally comes. (Hopefully)
Copy and paste the applications & framework-res.apk twframework-res.apk files from the THEME.zip into the appropriate folders within the OLD folder in theme porter.
Now copy and paste the same files that you copied from the theme.zip, now from the rom (EE19 for example) to the NEW folder in theme porter.
Once all files are in appropriate folders, run the Script.bat file in theme porter. Use a selection of "1" and press enter.
Theme porter will now copy all of the .png files from one .apk to the other (where the folder names are an exact match)
NOTE:At this step, you may have issues where the images aren't brought over (This typically only effects the framework files and just depends on how the file was generated/edited). This can be detrmined by opening the .apk in 7zip and pulling out the res folder, where you can view the files (you will see if it's been changed or not) If it hasn't, you will need to make sure the folder within the Themed .apk's are the exact same as the ROM you're themeing and re-run the theme porter script. (meaning you need to add or remove the -v4 ending depending on where the previous themer placed the themed files)
If you're lucky, everything is done at this point and you can move on to packaging a flashable update.zip.
Packaging A Flashable Update.Zip
A flashable package is simply a .zip file (stored as "store" in 7zip, no compression) that is made up of META-INF and System folders. The META-INF folder is very important as there is a big difference between using one from a ROM (pick and pick) and a theme (NeonGT) You will need to download a theme and pull the META-INF folder out so that you can use it in your theme ports. This is to ensure you have the correct script (edify or ammend) typically now we're using edify so use one from one of the H57 theme's via baked_tator The system folder should contain two folders "framework" and "app" each of which will hold the respective .apk files you have been working with. (but could also contain a "Media" folder for changing bootanimation.zip files, basically any files within the folder structure you create (matches the system structure) will be replaced when flashed. So be careful not to include things I haven't listed here unless you know what you're doing. And be sure to test these things before even thinking about a release.
Create the following folder that can be re-used with any new theme port, it's the easiest way to keep things organized and not lose track of files.
Create a new folder on your desktop called New Theme
Within that folder paste in the META-INF folder from another EE19 theme.
Create a new folder called "system"
Open system and create two new folders "app" and "framework" (and "media" if you are including the bootanimation.zip from the theme (which typically will work on our phone)
Place approprate files from the NEW folder within theme porter into these folders, respectively
Back up so that you see the META-INF folder and System folder, select those two, right-click and select "add to archive" in the 7zip menu.
Name the file "EE19 ThemeName VX.zip" and select "Store" for the method
Drag this to your desktop and this will be what you will place on your SD card for flashing.
Test the theme thoroughly to make sure everything ported over and everything still works (make sure to test USB, even color XML edits can cause odd issues) and get help from others to make sure the bugs are out.
If you run into issues, check the next post for possible resolutions.
BE SURE TO CREDIT THE PROPER CREATORS!!! I can't express this enough, I have a format for the way I do release posts, feel free to copy it if you'd like but either way make sure you make it known that it's not your work!
FAQ / Common Issues / Other Resources
Common Issues:
Images do not transfer to new framework.apk files.
(typically the applications all have the same folder names, so no problems occur here.)
As stated in the guide, all folders within each res folder within each .apk file used in theme porter must have exact matching folders/files for the .png to actually transfer. If it's been edited with apktool, it typically has the -v4 extension.
Troubleshoot your issue by opening the resulting .apk file in 7zip and comparing to the downloaded theme file in 7zip. You may have to pull the res folders out and look that way to actually see which images didn't transfer.
First thing to check is the folder names within the res folder, if the rom folder's names are "drawable-hdpi" and "drawable-land-hdpi" and the theme has "drawable-hdp-v4" then you need to remove the -v4 from those folders and run theme porter again.
NOTE: I've also run into situations where both folder's existed in the .apk file, meaning both drawable-hdpi and drawable-hdpi-v4 folders were there, but only one actually had the themed .pngs. In this case it was the drawable-hdpi folder that had the themed ones, but I needed it to be -v4, so I deleted the existing -v4 folders and renamed the others to -v4 - this also slimmed the rom because you really don't need the extra folders/files (nor wan't them!)
Some times icons don't exist on other phones, or they are completely different icons. I.E. with 2.2 fascinate theme's the Silence icon does not exist and therefore would need to be pulled from another theme or created to be fixed. This can be done with 7zip, no need to decompile the file if you're just swapping .png files (in the final framework-res.apk .
[*]Problems after testing theme.
This has happened to me on all sorts of levels;
Problems Restoring - Sometimes after testing theme's you'll go to restore and things will not be right when you boot, FC's and whatnot. Best case scenario you can restore to a vanilla restore (meaning your rom + any app's you wanted, but no theme's) or just flash your rom to fix.
Problems with icon's not being correct on a restore or a flash.
Same as above, sometimes things just go awry when you're flashing theme on top of theme, so i'ts best to start from the rom. Make a restore point with your rom + all your apps, then you can always go back to it and flash your day to day theme - this will give you the least trouble.
Phone stuck in airplane mode, setting is disabled.
I had this happen to me randomly once, no idea why but if you do run into this the only thing that fixed it for me was an odin back to a full build. No restore or flash would fix it. Typically your problem should be solved with a fresh flash of your rom, but sometimes going to a full build with odin is the only way.
FAQ:
Post them and we'll get them answered and edited in here. So far I've tried to cover everything I knew of in the guide .
Reserved
Reserved
Reserved
Other Resourcs:
Great guide by nitsuj17 on how to theme
Hex Colors
Free Photoshop Alternative
XML Color Edit Guide - in case you missed it above - credits to KBanause
wow, you rock bde. thanks for your time and help with this, I will be following it to help you guys out with stuff more.
Sent from my SCH-I500 using Tapatalk
sageDieu said:
wow, you rock bde. thanks for your time and help with this, I will be following it to help you guys out with stuff more.
Sent from my SCH-I500 using Tapatalk
Click to expand...
Click to collapse
Great, and thanks, I'm glad to share what I've learned with the community
Great write up,ive read through it several times. Just wish I hadn't traded my desktop for tattoo work this weekend. ..
Sent from my SCH-I500 using Tapatalk
man you write some good tutorials...
Very thorough and still easy to understand, Great work!!
Very nice! Just fixed the white on white text in my super light port. Big Thanks!
Great write up!
So, I tried using apktool to decompile the framwork-res.apk and it worked fine, recompiled it and everything was good, are these the same steps I would use for other APK's such as in the apps folder (i.e. Settings.apk) because I cannot get them to work I keep getting brut.androlib errors
bwot75 said:
So, I tried using apktool to decompile the framwork-res.apk and it worked fine, recompiled it and everything was good, are these the same steps I would use for other APK's such as in the apps folder (i.e. Settings.apk) because I cannot get them to work I keep getting brut.androlib errors
Click to expand...
Click to collapse
Usually if you get errors in compiling there have been things added or removed after compiling, this is sometimes caused by using theme porter for example.
Apktool works on any apk, but i'ts fussy about what's there before it recompiles. Try decompiling and recompiling with no changes, if it doesn't work then it won't work on that .apk (to my knowledge). You basically will always need to start with one of the deodexed apks from phidelt's pick and pack, then add changes while i'ts decompiled, then run theme porter after it's recompiled if needed.
And glad you all appreciate it
I vote sticky on this how-to...very good write up and it makes my life easier!!!
Definitely sticky
Sent from my SCH-I500 using XDA App
Thanks for the good reading bde. great tutorial.
Hey thanks, glad to share the wealth
Sent from my SCH-I500 using XDA Premium App
I followed this guide and made XML editing for Framework-res.apk to change font colour in the Menu using Notepad++, but after xml edit, cant build the framework.apk, it says sources have changed and does not build the apk. Am using apktool for this. Any suggestions how to go about it. Or somebody can guide, how can I change the menu background so that Menu texts are visible?
trip007in said:
I followed this guide and made XML editing for Framework-res.apk to change font colour in the Menu using Notepad++, but after xml edit, cant build the framework.apk, it says sources have changed and does not build the apk. Am using apktool for this. Any suggestions how to go about it. Or somebody can guide, how can I change the menu background so that Menu texts are visible?
Click to expand...
Click to collapse
As stated in an above post, try decompiling the framework-res.apk you are working with - without any edits and see if it will recompile with no error. If it doesn't then re-read my guide
Ok thanks will check it.
Never mind, I figured it out.
Sent from my SCH-I500 using XDA App
I did some major fixin' on the OP, hope it's more clear!

[MOD]TF700T Battery % Mod

This is a mod for the TF700T to add 1% battery indicators for both the tablet and dock.
This posting is for developers, not newbies who usually do not know what they are doing.
First things first: I am a retired software engineer (and approaching retirement age). I do not have much time for support of this mod as I spend most of my time teaching English in Thailand and I develop ROMs for the SGS3. With that said, you are free to use this however you wish. BUT, please give me credit for the work. A link back to this page would be great. AND, I cannot guaratee it will will for everyone. Use at your own risk.
I will try to answer questions as soon as I can. Hopefully, some of the better developers can jump in and help with questions. If I do not answer a question right away, it is because I am busy with school.
This is probably not one of the better how-to-do-it posts, but it is the best I can do at this time.
What you will need:
1. Winmerge - you can get it here: Winmerge
This is a great app for making changes to newer ROMs without having to manually find all your previous changes. It is a pretty much cut 'n paste layout as you can see where the changes are and just copy them into the new source file. It uses a split window format for comparing previous and new source files. I usually view the original modded file in the right window and the new file I want to mod in the left window. Differences will be highlighted. Just marked the changes and copy them from the right window to the left window. Don't forget to save the file before exiting.
2. The attached zip file which contains the battery icons for both the dock and tablet and the modified xml files. The icons were created using BatteryIconCreator_V9.0 which you can find on the web. Makes creating icons easy plus you can merge 2 icons into 1. The zip file contains xml files for JellyBean v10.4.4.20 ROMs. It should work on previous versions as I started working on this with v10.4.4.16.
3. apktool150.jar - from here: http://miui.connortumbleson.com/other/apktool/apktool_1.5.0.jar
4. aapt.exe - from here: http://miui.connortumbleson.com/other/apktool/aapt/win/aapt.exe
For items 3 and 4, I have included them for Windows only. You should already know how to use apktool already and where these files go.
IF your ARE NOT on Windows O/S, go to this link to get the correct aapt file: APKTOOL
You MUST HAVE both of the files (3 & 4). Very important.
There are no install zips attached to this post. I am just too lazy to make them.
This is mostly for developers of TF700T Roms.
The files we will be modding:
framework-res.apk
SystemUI.apk
Transformer.apk
First thing to do is to decompile all 3 files:
java -jar apktool150.jar d <source.apk> <folder>
where <source.apk> is one of the above 3 files and <folder> is where you want them decompiled to.
Example: java -jar apktool150.jar d SystemUI.apk systemui
First the tablet battery mod:
SYSTEMUI.APK
Tablet icons
1. Copy the tablet battery icons to: /res/drawable-sw720dp-hdpi
2. Copy stat_sys_battery.xml AND stat_sys_battery_charge.xml to /res/drawable
3. Add the following to the end of /res/values-sw600dp/styles.xml:
<style name="StatusBarBatteryNotificationText2">
<item name="android:textSize">1.0dip</item>
<item name="android:textColor">#00999999</item>
</style>
4. Change /res/layout/status_bar_quick_settings_title.xml
(change both dock and battery) below is the modified script change (partial script).
<TextView android:id="@id/battery_text" android:layout_width="wrap_content" android:layout_height="1.0dip" android:layout_marginTop="-4.0dip" android:src="@drawable/ic_notification_open" android:text="@string/status_bar_settings_settings_button" android:singleLine="true" android:layout_below="@id/battery" android:layout_centerHorizontal="true" style="@style/StatusBarBatteryNotificationText2" />
FRAMEWORK_RES.APK
Dock-icons
1. Copy the dock battery icons to /res/drawable-hdpi
2. Copy stat_sys_dock_battery.xml AND stat_sys_dock_battery_charge.xml to /res/drawable
TRANSFORMER.APK
1. Change res/layout/status_bar_docking.xml:below is the modified script change (partial script).
<ImageView android:layout_gravity="center_vertical" android:src="@drawable/asus_ep_kb_battery_dock" android:layout_width="32.0dip" android:layout_height="32.0dip" android:scaleType="centerInside" />
<TextView android:layout_gravity="right|center" android:id="@id/battery_level" androidaddingRight="12.0dip" android:layout_width="56.0dip" android:layout_height="wrap_content" android:singleLine="true" android:layout_toRightOf="@drawable/asus_ep_kb_battery_dock" android:layout_alignBaseline="@drawable/asus_ep_kb_battery_dock" style="@style/StatusBarNotificationText" />
2. Add asus_ep_kb_battery_dock.png to /res/drawable-hdpi/
After you have done all of that, you need to compile them:
BUT FIRST: SystemUI.apk will not be decompiled correctly -> res/values/public.xml
We need to change some things or it will not compile.
Open /res/values/public.xml and go all the way to the end.
Change the last 2 entries to look like the following (the decompile hex value ordering in out of sequence):
<public type="menu" name="notification_popup_menu" id="0x7f0f0000" />
<public type="menu" name="recent_popup_menu" id="0x7f0f0001" />
Save the file and exit.
Now we can compile all the files.
java -jar apktool150.jar b <source folder>
where <source folder> is where you decompile the apk to.
Example: java -jar apktool150.jar b systemui
the apk file will be in the dist subfolder under systemui
After all 3 files have been compiled, you need to copy the META-INF folder and the AndroidManifest.xml from the original apk to the newly built apk. You need to do this for each of the 3 files.
The TF700T does not like the resources.arsc entry compressed. So...we have to extract the contents from SystemUI.apk and Transformer.apk. Create a new apk (using store only) no compression. You can use 7zip for this.
After you have done this for the SystemUI.apk and Transformer.apk files, zipalign all 3 files and install them in their proper folders on your tablet. I have included a zip align program in the attached zip file. Put the 3 files in the align folder and run the zip-app.bat program.
I have tried to make this easy, especially if you use WinMerge. It's as easy as copy 'n paste.
All files, including the modded source files (except Winmerge) are included in the attached zip file.
ZIPFILE: TF700T 1% Battery Mod
Thanks man, donno if im gonna implement this but hopefully we can get some devs to preload it onto other roms. You should pm scott and hiemanshu! thanks again.
Sent from my ASUS Transformer Pad TF700T using Tapatalk 2
gutts10 said:
Thanks man, donno if im gonna implement this but hopefully we can get some devs to preload it onto other roms. You should pm scott and hiemanshu! thanks again.
Sent from my ASUS Transformer Pad TF700T using Tapatalk 2
Click to expand...
Click to collapse
I'm sure users would prefer percentage anyways, right?
From TF700, hit THANKS for others
Hi! thanks for this mod and for opening a dedicated thread.
Does the zip have a version to go for the latest job update? I can implement it straight into the ROM quickly if so. Otherwise I'll work through instructions and ask as I go.
sbdags said:
Does the zip have a version to go for the latest job update? I can implement it straight into the ROM quickly if so. Otherwise I'll work through instructions and ask as I go.
Click to expand...
Click to collapse
The easiest way is to just do file compares based on the files mentioned in Post #1.
If you use winmerge.exe it is easy to find the differences and cut and paste. It's what I use for all my ROM development for TF700T and GS3.
The files are from 104420.
OK Couple of questions - I tried to use the .20 files but SystemUI.apk is different.
There is no res/values folder......
neither is there a /res/values-sw600dp either ....
Are they important or have Asus changed the files?
Edit: Ah figured it out - ignore me!
I'm watching you
sbdags said:
OK Couple of questions - I tried to use the .20 files but SystemUI.apk is different.
There is no res/values folder......
neither is there a /res/values-sw600dp either ....
Are they important or have Asus changed the files?
Edit: Ah figured it out - ignore me!
Click to expand...
Click to collapse
Sent from my ASUS Transformer Pad TF700T
chogardjr said:
I'm watching you
Sent from my ASUS Transformer Pad TF700T
Click to expand...
Click to collapse
Figured it out and got it working
Thanks OP!
The icon and the % are not clear like stock...hard to read.
buhohitr said:
The icon and the % are not clear like stock...hard to read.
Click to expand...
Click to collapse
Agreed.
For my GNex I use circlesmod by hooolm, which is a lot clearer. I think I'll try throwing a mod together with those icons...
http://circlesmod.dk/?s=dl

[Guide:] The Definitive APK Modding and Theming Thread...

First of all, you don't actually need to be a "developer" as such to be able to theme and you don't need to know or have to learn lots of code either.
Secondly, EVERYTHING you need to know and need to use to modify an .apk is in this thread!
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
The greatest thing about Android is that you can change just about every element of the U.I and it’s really easy to do too. I wrote this guide to share the experience and knowledge I've gained since joining xda to debrand my SonyEricsson XPERIA X10i that was running Gingerbread. In 2017 there are a few different ways you can theme a ROM.
Apktool, which can decompile an .apk allowing you to modify your own .xmls and .9png images, which is what this thread will focus on.
RRO, Xposed essentially overlay themes or mods.
There is a variety of programs that use a GUI to do the work of Apktool for you, some good, some bad but at the end of the day they all ultimately do what you can easily do yourself in a faster, cleaner and more efficient manner in my opinion.
Overlaying doesn't cover every element so falls short of a one stop solution for being able to fully theme a ROM and is a bit more complex and/or restrictive in it's approach.
Tools you're going to need:
Java - Do this first if you don't have it installed already.
Apktool - The main tool for decompiling and recompiling apks.
Notepad++ - An essential program for xml editing!
Photoshop or Gimp - You'll need one of these for image editing.
7-Zip or WinRar - Required for working with apks.
We also need the ADB files from the SDK Platform and a sign.jar but to simplify this as much as possible I've made a zip for you to download which contains Apktool and everything else you need that you haven't got from the list above.
Download APKTool_2.2.4.zip to a location of your choice, preferably the C:\ drive which will give you a folder to work from. To keep the folder updated you can download the updated files from the retrospective thread/sites and simply replace them in the folder.​
This thread will cover the following in an easy to follow and straight forward manner that will have you theming your own apks in no time.
Getting apks from a ROM
Deodexing
.apk De-compiling
.apk Recompiling
.apk Signing
.apk Zipaligning
Pushing Files to your Phone
.9 images
Vector Drawable
.xmls
+More
Quick Tips;
.apk files can be browsed like .zip files so set your zip program as the default for handling apks which will makes things much easier.
If all you want to do is edit images then you don't need to decompile, you can just drag and drop images in to an apk to replace a stock image so long as they have the same file name.
Restoring files if you mess up is easier and quicker with a CWM.zip, especially if you're modifying framework apks! Just because an apk might build with no errors doesn't mean it won't give you any when installed to the Phone.
​
Getting apks from a ROM:
Once your Apktool folder is setup you need to get the apks you want to theme out of a ROM or off of your Phone and there are a couple of ways to do this.
1. The simplest method is to extract your phones whole system from an unofficial update file from xda, whatever format that may be in depends on your device. I extract the whole system with every new update before doing anything because it gives me a backup of stock files which I can also copy and deodex to be themed.
2. Use adb commands to pull files to your computer, to do that we need to open a command prompt window (hold the shift key then right click your mouse in the Apktool folder and select "open command window here").
The command to pull your whole system is...
Code:
[B]adb pull /system/ XC_206[/B]
...you can choose something other than XC_206 as your folder name but it will create that folder in your Apktool folder. Alternatively, you can just download individual folders and the commands to do that are…
Code:
[B]adb pull /system/app/ XC_206 app
adb pull /system/priv-app/ XC_206 priv-app
adb pull /system/framework/ XC_206 framework[/B]
...or to pull individual files...
Code:
[B]adb pull /system/framework/framework-res.apk[/B]
3. Use a root explorer on your phone to copy files to your SD and then to your PC.​
Depending on your method you should now have a ApkTool_2.2.4 folder with another folder named 206_system for example in it. The only folders we need at this point are app, priv-app and framework which we need for the next step.
Deodexing:
“Deodexing is basically repackaging of these APKs in a certain way, such that they are reassembled into classes.dex files. By doing that, all pieces of an application package are put together back in one place, thus eliminating the worry of a modified APK conflicting with some separate odexed parts.” – What Is Odex And Deodex In Android​The tool I use is this - [Tool/Utility] JoelDroid Lollipop Batch Deodexer. To save a lot of time I only deodex the apps I'm going to use because it removes the process of having to mess about with smali and baksmali, plus YOU DON'T NEED TO DEODEX YOUR WHOLE FW!, depending on the apk and/or the mod you want to make you don't even need to deodex.
So now you should have a folder named system full of deodexed apks that are ready for playing with.
Decompiling:
Decompiling is the process of deconstructing an apk which gives us workable source code so to speak and we need to do this to be able to edit xmls in Notepad++ or .9 images in an image editor. As said above if you don't want or need to decompile because you just want to change an image here or there you can just drag and drop your res folder out of the apk, find the image I wanted to replace or modify, drag and drop it back in to the apk and push it back to your phone.
Before proceeding you need to install your framework-res.apk and depending on your FW possibly another apk if there is one in the framework folder, which will put one (or two) apks at C:\Users\your-pc-name\AppData\Local\apktool\framework The two commands to install your apks are...
Code:
[b]apktool if framework-res.apk
apktool if SemcGenericUxpRes.apk[/b]
The command for decompiling always begins the same, apktool d then simply change it for the name of the next apk you want to modify. To decompile the framework-res.apk the command is...
Code:
[B][U]apktool[/U] [U]d[/U][/B] framework-res.apk
...this will create a folder named framework-res and it’s at this stage that you can now begin to modify .9 images and xmls to create the desired look or mod you’re after. In this folder you'll find a couple of folders but the one we want is the res folder. First glance of a decompiled res folder can be overwhelming, 1541 folders in my framework but we only need to focus on a handful and it's generally the same in every apk...
drawable
drawable-xhdpi-v4 (depending on your device)
layout
values
​...you may need to delve into others sometimes but it's very rare that I've had to.
Quick Tip;
Once you've entered a few commands so long as you leave the cmd window open you can quickly scroll back through them using your arrow keys.
Recompiling:
Once you've finished making your mods you need to recompile your apk using the following command...
Code:
[B][U]apktool[/U] [U]b[/U][/B] framework-res
...notice you only use the folder name here. If you get any errors here due to a bad edit apktool will usually tell you, in a roundabout way, you just need to read the code it throws up then retrace your steps, correct any bad edit and try again. If all goes smoothly you'll now have a new folder called dist, which contains your newly modified apk, but you can't use that just yet.
Signing:
To sign stock system .apks we need to extract from the original apk the Android.Manifest.xml and META-INF folder, into the dist folder, then from the new apk extract the resources.arsc also into the dist folder, then drag and drop all three files back into the new apk, but NOTE, it's important that you choose store as the compression method, any other will break the apk, and if you replace a broken framework-res.apk you will BOOTLOOP!. And signing is as simple as that.
For 3rd party apps you can use the following command...
Code:
[B]java -jar signapk.jar testkey.x509.pem testkey.pk8[/B] Chrome.apk ChromeS.apk
...notice the extra "S", the output name has to differ from the input name otherwise it will give an error, if done right it will create a new apk called ChromeS.apk, just remember to rename it back to the original before using it on your Phone.
[TOOL] pySignare - Quickly Sign APKs [Windows]​
Signing For The Play Store
If you plan on Publishing a Theme or any other app/apk to the Play Store then using the above method to sign your apks just wont work because you need to give it an individual signature that is unique to you, thankfully @AndroidGraphix has written a great guide that will show you how, it's a bit more fidgety than the above method but simple enough to follow...
AndroidGraphix said:
What you'll need to sign an APK.
Click to expand...
Click to collapse
- Noobs guide to signing an APK with a Private Key​
Zipaligning:
DISADVANTAGES OF UNALIGNED APKs; Quite understandably, situation would be reserved for unaligned application packages. Resource reading would be slow and memory usage would be on the higher end of the spectrum. It would also depend on how many unaligned applications are present. For example, if less number of applications with an unaligned home application, you’d see slower application launch times. This is the best case scenario. For a worst case scenario, having a number of unaligned applications will result in the system repeatedly starting and killing processes, struggling with lags and huge battery drain. - SOURCE​Move your new signed apk into your APKTool folder, you can overwrite your original if you want, and use the following command...
Code:
[B][U]zipalign -f -v 4[/U][/B] framework-res.apk ZAframework-res.apk
...notice the ZA, zipaligning creates a new apk which has to be named different from the original, but use what you want, it'll need renaming back to the original again before you use it.
Pushing Files to your Phone:
So now we need to transfer your apk back to your Phone, you can do it by copying to your SD, then to your system, change permissions, then copy to the right folder, but that's not only time consuming but highly tedious too, so a simpler method is to use adb using the push command as this allows us to push to the SD Card then install it to the system overwriting the original with the correct permissions too. If you do this with the framework-res or SystemUI apks you will need to reboot but generally all other apps will just refresh with the changes applied. The command to push to the SD Card is...
Code:
[b]adb push SystemUI.apk /sdcard/SystemUI.apk
[/b]​...then we need to mount the system before we can install our modified apk and the commands for that are...
Code:
[b]adb shell
[/b]​
Code:
[b]su
[/b]​The prefix will then change to the $ sign
Code:
[b]mount -o rw,remount /system
[/b]​...then to install your apk...
Code:
[b]dd if=/sdcard/SystemUI.apk of=/system/priv-app/SystemUI/SystemUI.apk
[/b]​If any of that fails you could try an unsecure kernel and/or Chainfires adbd Insecure app. Try the app first but if you still can't mount and push files read this thread - [HOW TO]Make your favorite kernel adbd insecure to run ADB as root on /system and try again.
.9 pngs:
I hope after reading this explanation you're not still left wondering what all the fuss is about as it really is quite simple. I'll use the following two images, btn_default_pressed_holo.9 & status_bar_close_off.9 to illustrate the basic point of the borders...
Decompiled .9pngs:
Recompiled .9pngs:
Those borders control which part of the image is stretched (Left & Top) and where on the image content will be displayed (Right & Bottom). We'll use Draw 9-patch which is for editing the borders of decompiled .9pngs and lets you see how the image, when stretched, will be displayed on the Phone. Notice that the borders are different sizes, well that's because I only want/need a certain part of the image to stretch to get the desired look on the Phone.
...in the image below the left side shows the stretched image and desired effect should look on the Phone and the right side shows how it would look if I had edited the borders incorrectly or used none at all...
You can get away by not using a border but you would need to edit your image to specific dimensions to accommodate for the stretching, for example it might look fine for a simple OK button but it might not look right if you used the same .9png for a screen press which stretches the whole length of the screen, so you're better off just using them to begin with, plus you'll more than likely get errors down the line while decompiling or recompiling your apk.
The use of the border is made even more clear when you add text to an image. For my status_bar_close_off.9 I've filled all four sides of the image (except for an empty pixel in all four corners as that is the max amount of border you can use) as I need it to stretch the image just how I've edited it...
...but if I used the same sized left side border as the btn_default_pressed_holo.9 then this is how it would look on the Phone...
...which is obviously not the look I'm trying to achieve, as the left side border is causing the image to stretch incorrectly.
So that's basically it, depending on the image you're editing you can usually leave the borders alone but if you create one from scratch then you might need to play about with them if your images doesn't look quite right when used on the Phone. Here's a few links that will assist you further, especially the batch editing...
How to edit .9.pngs
[TUTO] Create your 9.png !
[UTILITY][TOOL] 9patchPngSuite [Windows&Linux]
How to draw NinePatch images with Photoshop - .9.PNG
[TOOL][Multi-Platform][.9.png][ALL DPIs] Android Resizer Tool
[Tutorial][Commentary] How To Batch Edit .9PNG/PNG Images
9compiler - batch process for themers android
Vector Drawable:
A VectorDrawable is a vector graphic defined in an XML file as a set of points, lines, and curves along with its associated color information. The major advantage of using a vector drawable is image scalability. It can be scaled without loss of display quality, which means the same file is resized for different screen densities without loss of image quality. This results in smaller APK files and less developer maintenance. You can also use vector images for animation by using multiple XML files instead of multiple images for each display resolution.​- developer.android.com/guide/topics/graphics/vector-drawable-resources
Vector drawables obviously serve a purpose but are a pita imo for themers as they are a lot more difficult to edit and achieve the look you want.
Using my power menu to illustrate the issue, Power off, Restart and Take screenshot icons are vector drawables but the Record screen icon is a png...
...as you can see the Record screen icon is significantly bigger and ruins the look of my power menu, to over come this I have two options.
1. Learn how to edit vector drawables and create a new icon.
2. Replace the vector drawables and use pngs.
The latter to me is preferable because I already have images that I've been using for the last few years and want to continue using, to do so I need to replace the code in the relevant xmls to point at images...
framework-res/drawable/ic_lock_power_off.xml
Vector drawable code...
Code:
<?xml version="1.0" encoding="utf-8"?>
<vector android:tint="?colorControlNormal" android:height="24.0dip" android:width="24.0dip" android:viewportWidth="24.0" android:viewportHeight="24.0"
xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#ff000000" android:pathData="M13.0,3.0l-2.0,0.0l0.0,10.0l2.0,0.0L13.0,3.0zm4.83,2.17l-1.42,1.42C17.99,7.86 19.0,9.81 19.0,12.0c0.0,3.87 -3.13,7.0 -7.0,7.0s-7.0,-3.13 -7.0,-7.0c0.0,-2.19 1.01,-4.14 2.58,-5.42L6.17,5.17C4.23,6.82 3.0,9.26 3.0,12.0c0.0,4.97 4.03,9.0 9.0,9.0s9.0,-4.03 9.0,-9.0c0.0,-2.74 -1.23,-5.18 -3.17,-6.83z" />
</vector>
My edited code...
Code:
<?xml version="1.0" encoding="utf-8"?>
<bitmap android:src="@drawable/ic_lock_power_off_alpha"
xmlns:android="http://schemas.android.com/apk/res/android" />
framework-res/drawable/ic_restart.xml
Vector drawable code...
Code:
<?xml version="1.0" encoding="utf-8"?>
<vector android:tint="?colorControlNormal" android:height="24.0dip" android:width="24.0dip" android:viewportWidth="24.0" android:viewportHeight="24.0"
xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#ff000000" android:pathData="M12.0,4.0L12.0,1.0L8.0,5.0l4.0,4.0L12.0,6.0c3.9,0.0 7.0,3.1 7.0,7.0c0.0,3.9 -3.1,7.0 -7.0,7.0l0.0,2.0c5.0,0.0 9.0,-4.0 9.0,-9.0C21.0,8.0 17.0,4.0 12.0,4.0z" />
<path android:fillColor="#ff000000" android:pathData="M5.0,12.9C5.0,11.0 5.8,9.2 7.2,7.9L5.8,6.4C4.0,8.1 3.0,10.5 3.0,12.9c0.0,4.0 2.7,7.6 6.5,8.7l0.5,-1.9C7.1,18.8 5.0,16.1 5.0,12.9z" />
</vector>
My edited code...
Code:
<?xml version="1.0" encoding="utf-8"?>
<bitmap android:src="@drawable/ic_lock_restart"
xmlns:android="http://schemas.android.com/apk/res/android" />
framework-res/drawable/ic_semc_ic_dialog_screenshot.xml
Vector drawable code...
Code:
<?xml version="1.0" encoding="utf-8"?>
<vector android:height="24.0dip" android:width="24.0dip" android:viewportWidth="24.0" android:viewportHeight="24.0"
xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#8a000000" android:pathData="M5,5l4,0l0,-2l-4,0l-2,0l0,2l0,4l2,0l0,-4z" />
<path android:fillColor="#8a000000" android:pathData="M19,3l-4,0l0,2l4,0l0,4l2,0l0,-4l0,-2l-2,0z" />
<path android:fillColor="#8a000000" android:pathData="M5,15l-2,0l0,4l0,2l2,0l4,0l0,-2l-4,0l0,-4z" />
<path android:fillColor="#8a000000" android:pathData="M19,19l-4,0l0,2l4,0l2,0l0,-2l0,-4l-2,0l0,4z" />
<path android:fillColor="#8a000000" android:pathData="M16,13l0,-2l-3,0l0,-3l-2,0l0,3l-3,0l0,2l3,0l0,3l2,0l0,-3l3,0z" />
</vector>
My edited code...
Code:
<?xml version="1.0" encoding="utf-8"?>
<bitmap android:src="@drawable/semc_ic_dialog_screenshot"
xmlns:android="http://schemas.android.com/apk/res/android" />
...and the result as you can see here provides a much more unified look...
...and finally my desired end result...
.xmls:
Modifying .xmls is easy and pretty simply to understand, a massive clue in finding the ones you need to edit is the file names. You're not going to find a better guide than the one by Ticklefish so I'll just post a snippet here and you can head over and give the main thread a read and and a thanks.
Ticklefish said:
XML 101 - XML Modding Made Easy!
If you're modding Android, eventually you're going to have to edit some XML.
Want to center the clock in your statusbar? Rearrange the icons in your navbar? Change the layout of your notification screen? Get rid of a carrier label? Change the colour of some text?
Then you need to edit some XML files.
And you might not have any idea how...
Well, don't worry. The purpose of this thread is to show you just easy XML-editing can be. Once you've read it, you'll be one step closer to being an XML expert!
This guide is meant for noobs, experienced modders and everyone in between. Hopefully everybody can learn something..
Here's what this thread has to offer so far:
- Introduction (This Post)
- How To Delete A Line (Yes, Really)
- Some Useful Codes To Know
- How To Change The Colour Of The Status Bar Clock
- How To Put An Invisible Softkey In The Status Bar
- How To Center The Clock In The Status Bar...Part 1
- How To Center The Clock In The Status Bar...Part 2
- Centering The Clock In Xperia KitKat
- android:layout_gravity, android:gravity AND android:layout_weight
- Do NOT Edit "public.xml"!!​I also encourage others to post guides as well:
- How To Remove "am/pm" From The Clock On Pre-4.2 Roms (by @KronicSkillz)
- How To Swap The Notification And Status Bar Icons (by @Anmol0022)
- How To Hide A Centered Status Bar Clock When A Lollipop Device Is Locked (by @S0bes)​
Click to expand...
Click to collapse
Use Linux or a Mac? See the following threads for more information on using apktool on other Operating Systems...
[WIN/LINUX][Decompile/Compile] Quick Mod Tool 4.0 [decompile and compile with speed]
APK Manager for Mac OS X
[Linux][UTILITY][TOOL] APK Multi-Tool
[tutorial] decompiling,recompiling and signing in linux (27-01-2013)
​
The following programs are some of the better programs you can use to automate Apktool for you...
@Diamondbacks - Virtuous Ten Studio
@Ticklefishs - Tickle My Android
@BDFreaks - Advanced ApkTool
@mDroidds - StudioAndroid # Automize everything!
...there are many others but these are a couple of what I've tried, still use or are popular on xda.
Quick Tip; Use VTS to edit certain xmls because it gives you a preview of any hex colour code and has a built in editor too which makes finding and changing colours a breeze.
And that's pretty much it, the only way you're really going to learn is by reading then putting into practice what you've read and picking stuff up along the way. I've posted a few links to different tutorials in the next post that you can use as a reference to theme your own phone, while the versions of Android change the methods and code are pretty consistent but you will have to adapt from time to time, but that's how you learn, refine your skills and become able to pass on your knowledge back to the xda community in the form of guides themes and mods.​
Notable credits and thanks to @iBotPeaches, @Brut.all, @jairomeo, @manup456, @armyranger251, @Stericson, @brandenk, @beagz
ClockworkMod Recovery:
ClockworkMod Recovery zips are used for flashing individual files to whole ROMS and can be a life saver if you push a badly edited apk to your Phone that results in a bootloop. There's also a few programs that can assist you with that too, but if all you're doing is replacing a few files all you really need is a template, then it's just a matter of creating the Phones folder setup in the zip which is simply creating folders: system\app - system\media\audio etc then dragging and dropping your files into it. A basic understanding of the updater script is essential, a ROM.zip will more than likely wipe your Phone whereas a Theme.zip may just replace files but it might delete some also.​
ERRORS encountered in CWM Recovery
[Tool]easy flasher v4 (ur own update.zip)
[Tool][Windows/Linux] Android Flashable Zip Creator
How to edit updater-script and make recovery flashable zips and updates
[TUTORIAL] Making Flashable ZIPs, EDIFY Script, ZIP Signing & Key Creation
[Utility-Tool][DEVandThemers]CWMflashpack.zipCreatorV1{TheCollective}w/EdifyScripting
In the Apktool_2.4.4.zip is my CWM_backup.zip which is set up so you can add your own files to the framework and apps folders in the main system location, but you can easily add other folders to it if you want to add things like fonts, tones or anything else, just remember to add folders within folders if that's where the files you want to include are such as tones, media\audio\alarms for example. When adding files to your zip add them using Normal as the Compression Method and remember to remove any example files I've added otherwise they will be flashed to your phone too.
Links:
The following liks are what I've bookmarked over the years and posted them here for you to use as a reference, some of these may not apply for your device directly but that doesn't mean you can't learn from or adapt them to.
Locating hidden values, random dialogs and hardcodes
Theme Apps To Dark Theme | Theme Whole System | Newbies Here!
Theming 3rd Party Apps
Interactive Phone Modification
Theme Debugger - Test your themes
Rom Porter / System Extractor
9-Patch-Resizer
Android Drawable Resizer Tool
HOW TO THEME SystemUI.apk for TOTALLY newbie!
How to theme Lollipop and Marshmallow ROMs!
Theming Lollipop w/ Picture References
How to theme TW SystemUI
Where to find the colors for making a theme
Create Your Own Themed apk & Become a Themer
Power menu light><dark
Rom Logo In Settings/About
Theming Settings Heavily
Integrating/Adding applications to the settings menu
Quick Panel with Lidroid Toggles & Volume Sliders
Add Quickpanel Button In Statusbar To Switch Layouts
Increase QuickSettings Maximum number
How to add 0.00k/s meter on statusbar ICS/JB
How to add/ Change Clocks to Analog/ Digital with Seconds
Centre clock and icon switch. Update: bottom power control widget!
Xposed:
Advantages:
No need to modify any APKs. This means:
No need to decompile, change things in smali, compile, sign, ...
It will work for odexed and deodexed ROMs.
Your mod is not bound to a specific version of the ROM. Unless there is a major change in the methods called for a certain functionality, your mod will continue to work even when you upgrade your ROM. Many modules work for a wide range of ROMs from different vendors.
Multiple mods can be installed at the same time, even if they modify the same app. So you can use these battery icons and those quick toggles. Even hooking the same method twice is possible. Of course, this only works properly if the mods are not trying to do incompatible things.
Click to expand...
Click to collapse
- Xposed
Porting XTheme themes
CM Theme to XThemeEngine Converter / Porter
Port CM Themes to Xtheme Engine in One Click!
List of APPs & MODs that use XPOSED Module
Xposed Framework/TabletUI (Noob-Friendly)
XThemeEngine beta5 - Theme engine for any rooted phone
ResXploit : Theming your android the easiest way! No decompiling APKs!
hello XperienceD,
first i want to say thank you, finally i can make some modifiaction of my rom, i am managed to get 3-wa-power on my stock rom, show full option in developer setting, change color and icon, etc (still far from my target though).
for now im trying to make my phone running holo dark themes (default is light), at first it looks fine, background change from light to dark, text black to white.
but now i found some color problem, can you help me locate color setting for this :
and for setting color, i want to change text color to holo_blue
for now, i am doing bruteforce, line per line, hope can fix this tonight, but if anyone know the where should i change the color setting, i am more than happy to accept it
thanks,
jacknb1ack
jacknb1ack said:
but now i found some color problem, can you help me locate color setting for this :
Click to expand...
Click to collapse
Check the links above "where to find colors" and "changing system text".
great, i think i've clicked all the link in ur post ... but looks like i've missde some link xD ...
thanks again.
jacknb1ack said:
great, i think i've clicked all the link in ur post ... but looks like i've missde some link xD
Click to expand...
Click to collapse
Did you find it in the end?
nice tutorial
XperienceD said:
Did you find it in the end?
Click to expand...
Click to collapse
yes .. thanks to you and all developers and themer here, i can finish my own customizing rom xD
and lately i've found that its need to resign all system apps to do better in what i want, and here is my last work xD
https://picasaweb.google.com/117267626749690688218/Halo2?authuser=0&feat=directlink
jacknb1ack said:
yes .. thanks to you and all developers and themer here, i can finish my own customizing rom xD
Click to expand...
Click to collapse
Nice 1.
jacknb1ack said:
https://picasaweb.google.com/117267626749690688218/Halo2?authuser=0&feat=directlink
Click to expand...
Click to collapse
Colourful.
Thread updated.
Awesome job on this man!
ssojyeti2 said:
Awesome job on this man!
Click to expand...
Click to collapse
Thank You, just trying to do my bit.
Can we get a linux version?
</end_troll>
thanks for the guide. really appreciated it. sharing knowledge is priceless.
im trying to re compile a APK which i have edited. but always it gives error. even if i de compile it and without touching anyting and try to re compile same result.
apk is a keyboard. i was trying to edit the layout. so is there any other way to do to modify 3rd party apks??
i do without any issue with systemui's framework etc
thanks again
EDIT - is that cos i have installed framework ????
Thank you for the post.
One thing that i have been trying to do is make a theme for "Floating Notifications" i was able to edit the apk and the xml files. everything works great on the phone and everything.
my issue is once if edited an app for theming how do i sign it so i can upload my theme to the playstore?
when i upload it to the dev console it says that my apk is not signed correctly or something like that.
can you please show me how to sign an apk after editing it for the playstore
thank you
That's exactly what i was looking for! Great post mate! Thank you!
Holy [email protected] dude this is monstrous! Thanks for your dedicated work!
Man I have seen tutorials but none as comprehensive as this. I mostly know all of whats here, but you have some invaluable links to all sorts of resources. This would have taken you a long time, I hope XDA members are appreciative!
Jarmezrocks said:
Holy [email protected] dude this is monstrous! Thanks for your dedicated work!
Man I have seen tutorials but none as comprehensive as this. I mostly know all of whats here, but you have some invaluable links to all sorts of resources. This would have taken you a long time, I hope XDA members are appreciative!
Click to expand...
Click to collapse
Thanks for your comments.
Sent from my C6603 using xda premium
Roladriz said:
Can we get a linux version?
Click to expand...
Click to collapse
These links should help...
XperienceD said:
Use Linux or a Mac?
See the following threads for more information on using apktool on other Operating Systems...
APK Manager for Mac OS X
[Linux][UTILITY][TOOL] APK Multi-Tool
[tutorial] decompiling,recompiling and signing in linux (27-01-2013)
How to install and use Apktool with Ubuntu
Click to expand...
Click to collapse
Dilesh Perera said:
EDIT - is that cos i have installed framework ????
Click to expand...
Click to collapse
I don't think it will be, it is either a protected apk or from a brand of Phone that isn't that common would be my guess, but you'd need to list the error logs?
amadovi43 said:
can you please show me how to sign an apk after editing it for the playstore
Click to expand...
Click to collapse
This is the only link I have bookmarked in regards to this - Noobs guide to signing an APK with a Private Key which is the one I used for my IceGreen theme.

Categories

Resources