[Tilt, TyTN II, MDA Vario III Android Development] enatefox:
Quick reference

Table of Contents

Files to modify

A word on APK files

Convert binary XML into human-readable text

How to deodex files

Closing notes

-------------------------------------------------------------------------

Files to modify:

/system/app/Launcher.apk--

kind of self explanatory

/system/app/Phone.apk--

this does not contain the dialer. only the keypad while in a call.

/system/app/Contacts.apk--

this contains the actual dialer images among other things

/system/framework/framework-res.apk--

main files to edit. minor changes here can crash your system if you fail at it.

/system/framework/framework-res.apk/res/layout/status_bar.xml--

hex edit this to change the notification bar text color

In a hex editor, search for 00 00 1C and replace the next 3 value with HTML color codes (RGB)

Refer to this for more info

/system/framework/services.jar

Changing notification text color, among other things..

Refer to this excellent guide. Worked for me.

-------------------------------------------------------------------------

A word on APK files

APK files are signed (SHA1 sigs) so don't just unzip, paste and zip back or you will wonder why things don't work. The easiest method is to use a GUI ZIP program like 7zip or Ark (Linux) to open the archive without extracting it. Drop your images over the existing ones and call it a day.

There is also apkopt which can optimize APKs (as the name implies) but will create a temporary folder with which you can inject your images to before it is resigned by the script. Some files do not like to be optimized like framework-res.apk which is why I don't use this method.

-------------------------------------------------------------------------

Convert binary XML into human-readable text

I haven't done this yet but feel I should list it here. You should be able to make changes, compile back (see the next section below) and diff the binary result for future reference.

http://xdaforums.com/showthread.php?t=514412

-------------------------------------------------------------------------

How to deodex files

Generally it is not too difficult. There are some APKs that will throw errors and I'm trying to figure them out. It's a tedious but simple process and luckily I made some scripts to more or less automate it. I use Linux so BASH scripts are all you're getting.

I made a script that will take an app folder of APK and ODEX files and dump the dex files into subfolders. You will then need to add the dex file to the APK to finish. Unfortunately, because the process runs on the phone, you can overload it if you just try to run the output script. Many APKs required me to go line by line such as Music.apk because they are large files and for some reason the script will not wait for the first part to run so you must manually enter them and wait for each line to finish. I know, I'd love some help with this.

I've attached Deodex_Step1.sh.txt. Rename it to .sh and execute in the folder with APK and ODEX files and it will create a script RunScript.sh with the commands needed to deodex. As I said, this is very memory intensive and I could not just run this script so I went through and did a few at a time, careful to watch for errors and retry until it was done.

You need to download deodexerant (or take it from the SDK), smali and baksmali from here. I shouldn't have to mention that whatever build you are deodexing, you need to be running that on your phone when you connect.

Now, you will have RunScript.sh in the folder. You must connect to the phone with ADB. Set up the environment:

adb push deodexerant /data/local
adb shell chmod 755 /data/local/deodexerant
adb forward tcp:1234 tcp:1234

Here's an example for deodexing Browser.apk from the RunScript.sh you will end up making:

adb shell /data/local/deodexerant /system/app/Browser.odex 1234 &
java -jar baksmali.jar -o output/Browser.odex/out/ -x :1234 Browser.odex
java -Xmx512M -jar smali.jar output/Browser.odex/out/ -o output/Browser.odex/classes.dex
adb shell killall deodexerant && clear && echo Done Processing Browser.odex

Important notes are that smali.jar and baksmali.jar were put in the same folder and that I am actively killing the deodexerant process at the end to help prevent overloads though they can and will occur between the baksmali and smali commands so watch out.

Okay, still with me? Now you have a folder called "output" with a subfolder "Browser.odex/" containing classes.dex. Open the Browser.apk file with Ark (Linux) or 7zip and drop in the classes.dex file.

Repeat for all files and you're done.

-------------------------------------------------------------------------

Closing notes

If you are not using an ext2 system partition then you have more patience than I will ever have. It's easy to test your themes on the system using ADB to push your modified files. I recommend that you, in ADB, run "stop" and kill vold, service-manager and acore then run "start" to return to the Android splash screen. Protip: If you use the terminal on the phone you will freeze it the moment you type "stop" so use ADB.

That's all I can think of. Please share any tips you have to help others