FORUMS
Remove All Ads from XDA

[TUT] Custom frameworks for Gen 8

2,331 posts
Thanks Meter: 4,306
 
By fisha21, Senior Member on 6th March 2011, 10:27 PM
Post Reply Email Thread
So, it seems that more people are taking an interest in making custom frameworks. This isn't really a full tutorial, but I thought it would be helpful to just post some tips on how to go about making your own framework-res.apk, save others a bit of time retreading old ground, since the methods are scattered around the site a bit!

Thanks to wdl1908 for prompting me to do this - should really have done this sooner!

Okay, so basic requirements:
  1. Rooted Gen 8 (Uruk or chulri method)
  2. Original Archos framework-res.apk
  3. zip editor
  4. image editing software
  5. .png's to replace the stock ones with

That's about it! I've been using GIMP on Ubuntu for the image editing, and Phatch for batch resizing, but Photoshop will work just as well on Windows.

Edit: Thanks to wdl1908, have found that Gwenview gives much better results when resizing, compared to Phatch or GIMP. Works on both Ubuntu and KDE.

Use your preferred zip editor to unzip the contents of framework-res.apk to your chosen folder. The main folder of interest is "drawable-mdpi".

The Gen 8's use MDPI resolution images (well, A70 and A101 to at any rate. I think someone mentioned the A32 or A43 used HDPI images). Depending on your .png source, you may need to resize the images. I took my images from themes made for the Desire, which is an HDPI device, so I used GIMP/Phatch to resize them.

In terms of resizing, I compared the size of each new png with the original one, and resized. I know p0rkburn just resizes the images to 66%, but I've had problems with some images not coming out the right size that way. The other thing to watch out for is that not all the images need resizing. Also, some of the textfield and tab_select images are different proportions to their phone equivalents, so again watch out for that.

Once you've replaced the images you want to, they need to be put back into the .apk. I used to copy and paste into the framework-res.apk, but that doesn't work for 9patch files. Also, wdl1908's FrameWorkBuilder makes the compile process so ridiculously easy, there is no reason not to use that instead.

To put the new framework-res.apk on the device, I use this method via ADB wireless, which works fine.

Happy theming!

EDIT: 9patch files

These can be a PITA, until you understand how they work. I used the following two sources to finally crack it :

http://developer.android.com/guide/d...raw9patch.html

http://forum.xda-developers.com/showthread.php?t=580351

If you are changing 9patch files, you have to decompile and recompile using the FrameWorkBuilder.

I prefer using the draw9patch tool, as it lets you check that the 9patch works as expected.

Spent enough time bashing my head against a brick wall trying to sort out 9patch files, so if I can spare anyone else that, feel free to post/PM..
The Following User Says Thank You to fisha21 For This Useful Post: [ View ] Gift fisha21 Ad-Free
 
 
6th March 2011, 11:19 PM |#2  
wdl1908's Avatar
Senior Member
Thanks Meter: 157
 
More
I'll leave this post here for my recommendations that will be more complex when you need to modify xml files.

In short the procedure is a follows (this needs to be expanded)
  1. unpack the apk to framework-res-UNPACKED dir
  2. decompile the apk to framework-res-DECOMPILED (with apktools)
  3. copy framework-res-MOD to framework-res-DECOMPILED
  4. compile framework-res-COMPILED (with apktools)
  5. unpack the compiled apk to framework-res-COMPILED (with 7za)
  6. remove all the files that are present in framework-res-MOD from the framework-res-UNPACKED dir
  7. remove the file resources.arsc from framework-res-UNPACKED
  8. copy all files from framework-res-UNPACKED to framework-res-COMPILED
  9. zip all files in framework-res-COMPILED to the new framework-res.apk
  10. remove the resources.arsc from that apk file
  11. readd the resources.arsc file without compression to the new apk file
  12. Done

The reason this is so complex is that their are bugs in apktools and the signature needs to be preserved.

FrameWorkBuilder v0.3

README.txt
-------------------------------------------------------------------------------------------------------
Place the script FrameWorkBuilder.sh in a directory and execute.

The script will download all the needed tools.

Place framework-res.apk in the dir framework-res-STOCK
Place mods in framework-res-MOD follow the usual directory structure.

Example:

framework-res-MOD
framework-res-MOD/res
framework-res-MOD/res/drawable-hdpi
framework-res-MOD/res/drawable-mdpi
framework-res-MOD/res/drawable

Execute FrameWorkBuilder.sh to apply the mod.

Modded framework-res.apk will be stored in the directory framework-res-MODDED.
-------------------------------------------------------------------------------------------------------

Changelog
-------------------------------------------------------------------------------------------------------
v0.3 Added xml png duplication check to avoid that animations don't work. .9.png support
v0.2 Added mod checks Added compile failure test
v0.1a BUGFIX cp dirs
v0.1 Initial version
-------------------------------------------------------------------------------------------------------
Have fun modding.
7th March 2011, 11:26 AM |#3  
fisha21's Avatar
OP Senior Member
Thanks Meter: 4,306
 
More
Quote:
Originally Posted by wdl1908

I'll leave this post here for my recommendations that will be more complex when you need to modify xml files.

If you don't mind we'll make it a joined tutorial. I have no time now it's time I got some sleep.

I have no idea about editing XML files, but that was the next thing on my "To learn" list. I would be very happy for you to add your knowledge to this thread.

Also, if anyone has info to add/corrections to make, please feel free.
7th March 2011, 05:02 PM |#4  
Member
Thanks Meter: 6
 
More
Good stuff, guys. At the very least we can make this a three man party.
7th March 2011, 07:48 PM |#5  
fisha21's Avatar
OP Senior Member
Thanks Meter: 4,306
 
More
The more the merrier!

Guys, can I ask what device you're both using?
7th March 2011, 08:18 PM |#6  
wdl1908's Avatar
Senior Member
Thanks Meter: 157
 
More
Quote:
Originally Posted by fisha21

Guys, can I ask what device you're both using?

A101IT with archangel root
A70IT with chulri's root
7th March 2011, 08:24 PM |#7  
Senior Member
Thanks Meter: 174
 
More
Quote:
Originally Posted by fisha21

The more the merrier!

well, if i can do something, i'm here ;)
7th March 2011, 08:43 PM |#8  
fisha21's Avatar
OP Senior Member
Thanks Meter: 4,306
 
More
Quote:
Originally Posted by wdl1908

A101IT with archangel root
A70IT with chulri's root

Cool, thanks. Also, can I ask how you're viewing the XML files? Every program I've tried won't open them - keep getting error messages about invalid character content.

Quote:
Originally Posted by woti23

well, if i can do something, i'm here ;)

Welcome...
7th March 2011, 08:45 PM |#9  
wdl1908's Avatar
Senior Member
Thanks Meter: 157
 
More
Quote:
Originally Posted by fisha21

Cool, thanks. Also, can I ask how you're viewing the XML files? Every program I've tried won't open them - keep getting error messages about invalid character content.

You have to decompile the framework-res.apk with the apktools then all is revealed.
8th March 2011, 02:01 PM |#10  
Senior Member
Thanks Meter: 359
 
More
I have an A43it, and I find it to use a mixture of the hdpi and mdpi drawables, it is quite odd how they have it. I am drawing this conclusion because I only changed the hdpi drawables, and some things (status bar pull down for one) stayed original. I am going to work some more on it later today and will update here. My method for pushing to the device uses adb like such:
Code:
adb push framework-res.apk /sdcard/framework-res.apk
adb shell
su
stop
cp /sdcard/framework-res.apk /system/framework/framework-res.apk
chmod 644 /system/framework/framework-res.apk (only needs to be done the first time, as the permissions will adopt those when replacing in the future)
start
This causes the device to do a little soft-reboot (does not perform a proper full shutdown/reboot) that is pretty quick, and avoids any f/c situations you may encounter replacing the file while the system is live.

Edit 2 - ok, I just plain old missed the drawables earlier, they are all in hdpi for the A43. Posting screenshots of what I have put together shortly.
The Following User Says Thank You to daveid For This Useful Post: [ View ] Gift daveid Ad-Free
8th March 2011, 03:11 PM |#11  
wdl1908's Avatar
Senior Member
Thanks Meter: 157
 
More
Quote:
Originally Posted by daveid

My method for pushing to the device uses adb like such:

Code:
adb push framework-res.apk /sdcard/framework-res.apk
adb shell
su
stop
cp /sdcard/framework-res.apk /system/framework/framework-res.apk
chmod 644 /system/framework/framework-res.apk (only needs to be done the first time, as the permissions will adopt those when replacing in the future)
start
This causes the device to do a little soft-reboot (does not perform a proper full shutdown/reboot) that is pretty quick, and avoids any f/c situations you may encounter replacing the file while the system is live.

Great I was looking for that.
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes