[G1 Themes and Wallpapers] Paulo Monto:
First let me say thank you to:

mattahan for his artwork/icons.

dthadamaja for his buuf theme.

Cyanogen for his ROM.

Jesus Freke for his ROM.

Stericson for his guide to theme making.

Now let me warn you:

Please back up your phone before you do any updates on it. I am not responsible if you ruin your phone. I am not responsible if you destroy your computer. I am not a responsible person in general. The scripts provided are pretty simple and straightforward with no malicious design but some of them are designed to delete files and if you use it incorrectly it could delete files that you did not want to delete. And this would be terrible.

Why:

So, I wanted to get the totally bad-ass Buuf theme on 1.5r2 but ports were hard to come by. It was also IMO a nightmare to do all this crap on Linux so I set up what I believe is a nice environment/system for doing this rapidly and effectively.

Requirements:

- the shell scripts I've attached to this post

- 7zip (Ubuntu: sudo apt-get install p7zip-full)

- Java

OPTIONAL - the Android 1.5r2 SDK: http://developer.android.com/sdk/download.html?v=android-sdk-linux_x86-1.5_r2.zip

OPTIONAL - compiled signapk.jar from mydroid

OPTIONAL - testkeys from mydroid

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

I included the last two files but if you want you can get them yourself by:

go to: http://developer.android.com/sdk/1.5_r2/installing.html and follow the Installing the SDK notes and the Ubuntu Linux Notes (or other if you do it like that).

go to: http://source.android.com/download and follow the instructions for getting the Android source. once you have it go to your mydroid directory and run: make signapk

copy mydroid/build/target/product/security/testkey.pk8 to the directory you extracted my files to

copy mydroid/build/target/product/security/testkey.x509.pem to the directory you extracted my files to

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

Setting up the environment:

- Extract the file attached to this post to somewhere, and add that folder to your path.

e.g. if you were in ~ and you did tar xvzf theme_maker.zip you'd end up with ~/theme_maker

edit your .bashrc file and add this to your PATH, it should look like:

export PATH=$PATH:~/theme_maker

- Edit signapk, there are 3 variables at the top:

TESTKEY1=

TESTKEY2=

SIGNAPKJAR=

These should be the full path to your testkeys and JAR file. I left mine in as examples.

Now your that environment is set up, let's do this.

How to Use:

First you are going to need a template for your ROM. I am a noob but as far as I can tell most people are distributing a theme template with their ROMs. This template contains a bunch of APKs with their res/drawable directories and such.

Extract this template to theme_dest. This tree/extraction is going to be your where your theme ends up.

If you are modifying the theme extract the template again to theme_src, this will be where you source your files from.

If you are porting a theme extract the old version of the theme to theme_src. This will be your source directory for your theme.

Now you will want to clean out any non-image files so that you don't overwrite some changed XML file or what-have-you. To do this run:

clean_template theme_src

This will extract all APKs into the full tree, and then delete all non-png/jpg/gif (please let me know if Android uses others) files from the directory tree. Please be careful when doing this.

If you are modifying the theme, now you will want to modify/replace files in the theme source directory.

Now assuming your directory structures are exactly the same, you can do:

update_apks theme_src theme_dest

This will only work if you have a structure like:

./theme_src/system/app/

./theme_src/framework/

./theme_dest/system/app

./theme_dest/framework

A theme I extracted came out like:

./theme_src/system/app/

./theme_src/framework/

./theme_dest/app

./theme_dest/framework

update_apks won't break anything if the directory tree styles don't match, but it won't update the icons in the mismatched trees. To get around this, in the example above you'd do:

update_apks theme_src/system/app theme_dest/app
update_apks theme_src/framework theme_dest/framework

Now that you have updated your APKs with the new files from theme_src you will want to resign the APKs and create an update.zip for your theme.

To do this run

sign_apks theme_dest

This will recursively sign all APKs and zips in the tree.

Now run

create_update theme_dest

This will create an update.zip from the tree below and sign it.

Now copy the update.zip and load as normal.

I hope this is useful to anyone trying to streamline their theme making, I will try to update it as improvements become apparent to me. If you have any questions or ways to improve the scripts please let me know.

Thanks,

Paulo

EXAMPLE USAGE:

This is a step-by-step walkthrough of how I got the BUUF theme onto CM 3.4.4:

du@crustacean:~/tmp-workspace$ ls

BUUFbrownfinal.zip template-cm-3.4-signed.zip

du@crustacean:~/tmp-workspace$ mkdir theme_src theme_dest

du@crustacean:~/tmp-workspace$ ls

BUUFbrownfinal.zip template-cm-3.4-signed.zip theme_dest theme_src

du@crustacean:~/tmp-workspace$ cd theme_src

du@crustacean:~/tmp-workspace/theme_src$ unzip ../BUUFbrownfinal.zip

Archive: ../BUUFbrownfinal.zip

inflating: yada yada yada

du@crustacean:~/tmp-workspace/theme_src$ cd ..

du@crustacean:~/tmp-workspace$ cd theme_dest

du@crustacean:~/tmp-workspace/theme_dest$ unzip ../template-cm-3.4-signed.zip

Archive: ../template-cm-3.4-signed.zip

inflating: blah blah blah

du@crustacean:~/tmp-workspace/theme_dest$ cd ..

du@crustacean:~/tmp-workspace$ clean_template theme_src

Extracting APKs

blah blah blah

Deleting non-image files

blah blah blah

Deleting empty directories.

Done!

du@crustacean:~/tmp-workspace$ update_apks theme_src theme_dest

updating framework-res.apk

updates not found for packages: AlarmClock.apk Browser.apk BugReport.apk Calculator.apk Calendar.apk CalendarProvider.apk Camera.apk checkin.apk Clicker.apk com.amazon.mp3.apk com.android.term.apk Contacts.apk ... MediaProvider.apk MediaUploader.apk Mms.apk Music.apk NetworkLocation.apk PackageInstaller.apk PDFViewer.apk Phone.apk QxdmLog.apk Settings.apk SettingsProvider.apk SetupWizard.apk SoundRecorder.apk SpareParts.apk Street.apk Superuser.apk SystemUpdater.apk Talk.apk TelephonyProvider.apk TmoImPlugin.apk UserDictionaryProvider.apk Vending.apk VoiceDialer.apk VoiceSearch.apk YouTube.apk

--- Here we notice a large # of APKs did not update. It's possible that the directories do not line up in this case. As we see below they don't but we can work around this.

du@crustacean:~/tmp-workspace$ ls theme_src

framework system

du@crustacean:~/tmp-workspace$ ls theme_dest

app framework META-INF

--- The app directory in theme_src is under system, whereas it is directly in theme_dest, so we do:

du@crustacean:~/tmp-workspace$ update_apks theme_src/system theme_dest

updating AlarmClock.apk

updating everything else..

updates not found for packages: framework-res.apk ... NetworkLocation.apk PDFViewer.apk QxdmLog.apk SpareParts.apk UserDictionaryProvider.apk

--- More packages that did not update, some of these were just not included in the Buuf theme (e.g. PDFViewer) whereas others were renamed across versions (e.g. Maps became GoogleMaps.

--- In the latter case you could rename theme_src/system/app/Maps to theme_src/system/app/GoogleMaps to update correctly.

du@crustacean:~/tmp-workspace$ sign_apks theme_dest

signing framework-res.apk

signing all that other stuff..

du@crustacean:~/tmp-workspace$ create_update theme_dest

creating update.zip

signing update.zip

done.

du@crustacean:~/tmp-workspace$

You would now have a signed file theme_dest/update.zip with your theme applied to the template provided. At this point you can apply the theme to your mobile and see how it came out. In my case I noticed the GoogleTalk icon did not update and the IM icon was not the one I wanted, so I did this:

du@crustacean:~/tmp-workspace$ mkdir theme_test

du@crustacean:~/tmp-workspace$ cd theme_test

du@crustacean:~/tmp-workspace/theme_test$ unzip ../template-cm-3.4-signed.zip

du@crustacean:~/tmp-workspace/theme_test$ cd ..

du@crustacean:~/tmp-workspace$ ls

BUUFbrownfinal.zip template-cm-3.4-signed.zip theme_dest theme_src theme_test

du@crustacean:~/tmp-workspace$ clean_template theme_test

Now I have a directory theme_test with the fully extracted template, I can go browse the drawable directories in there and see what file names have changed or what file locations are different. For example one of the icons that used to be provided by IM was now provided by ImProvider, so I modified the theme_src files to match the template & updated my APKs again.