HOWTO Theme Guide

Need help creating a theme? need help installing a theme? Questions here.

HOWTO Theme Guide

Postby enate » Wed Dec 09, 2009 10:23 pm

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)

/system/framework/services.jar--
Changing notification text color, among other things..

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

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.

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

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.zip. Extract and 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:
http://code.google.com/p/smali/downloads/list

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:

Code: Select all
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:

Code: Select all
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
Attachments
Deodex_Step1.sh.txt.zip
(520 Bytes) Downloaded 130 times
User avatar
enate
Global Moderator
Global Moderator
 
Posts: 27
Joined: Tue Dec 08, 2009 9:52 pm

Re: HOWTO Guide (No Downloads But Full of Info)

Postby brybam » Sun Dec 13, 2009 1:42 am

great post, gonna sticky this. maybe i'll put some themes together.

edit: do you know how to make meta morph themes? just asking because that seems to be the new cool thing haha.
User avatar
brybam
androidnetwork.org Admin
androidnetwork.org Admin
 
Posts: 133
Joined: Sun Dec 06, 2009 4:37 pm
Location: Baltimore, MD

Re: HOWTO Guide (No Downloads But Full of Info)

Postby enate » Sun Dec 13, 2009 8:24 am

I'll look into MetaMorph as that's about as close to what I use anyway when doing this. I guess a unified system would draw the biggest crowd and doesn't require a specific image for users to switch to.

Also, JesusFreke updated features for smali/baksmali to make things much easier to deodex. Among them, no need to manually extract the .dex file which was very time consuming. I'll update the OP as I get to it (although the instructions now still work)
User avatar
enate
Global Moderator
Global Moderator
 
Posts: 27
Joined: Tue Dec 08, 2009 9:52 pm


Return to How to/Help

Who is online

Users browsing this forum: No registered users and 0 guests