Framework-res.apk utility

Chris3D

Well-known member
Sep 21, 2010
646
179
0
Visit site
For anyone who wants to mess around with their framework-res.apk, I wrote this little bat program to automate the task of downloading, decompiling, recompiling and uploading.

A common issue I found with apktool is that all the files get compressed, where certain file types are stored with no compression in the original apk. So, to address that and make sure the new apk is properly signed, this utility builds the new apk, extracts all the files and puts them back into the original apk, properly compressed, leaving the signing intact.

To the best of my knowledge, all the tools included in this are freely redistributable (adb, aapt, 7 zip, etc.).

To use this, you'll need the Java JDK installed (it's needed to run apktool specifically, not my little bat program). You can find the JDK here.

You'll also need the Samsung drivers for the phone installed, but I'm going to assume if you're here, you already have them.

Finally, if you're going to use this, you should have a general idea of how to edit the resources in the apk, or at least the willingness to learn. This just automates the tasks of getting and processing the file, it doesn't edit anything itself. This doesn't do anything invasive, and it pulls a backup of your current framework.apk the first time it's run, so you can always restore, but as always, you're proceeding at your own risk.

I've tested it on Windows 7, but it *should* work fine on any version of Windows since it's just a simple DOS bat program. Also, it works specifically with the Fascinate framework-res.apk file. It may or may not work with frameworks from other phones.

Anyway, here it is... FrameworkUtility Hope someone finds it useful...
 
  • Like
Reactions: ot3pch4n

jhnstn00

Well-known member
Apr 26, 2010
116
0
0
Visit site
Question: Do you have any idea why 3G would display instead of H when connected to HSDPA? The png files are present, but it seems like there is some programming or logic saying display the 3G png when connected to HSDPA. H does not display for upload, download, or for just connected. 3G always displays.
 

Chris3D

Well-known member
Sep 21, 2010
646
179
0
Visit site
Question: Do you have any idea why 3G would display instead of H when connected to HSDPA? The png files are present, but it seems like there is some programming or logic saying display the 3G png when connected to HSDPA. H does not display for upload, download, or for just connected. 3G always displays.

Not sure, is this after you changed something?

I've noticed a few things in my poking around:

1- When encountering modified images that, for whatever reason, aren't what it expects, it'll sometimes fall back to another image. When replacing my battery icon, there were times that it'd revert to the stock image even if my updated XML pointed to my new image.

2- There seems to be some unused images in framework-res. It may be that while the HSDPA images are there, they're simply not called or the conditions for them being called are never met, such as...

3- In modding my battery, I discovered a definite bug somewhere in the battery stats being reported by whatever part of the OS reports them. When discharging, the battery percent is reported in 1% increments. But when charging, the battery is always reported as somewhere around 20%. Even the stock XML in framework-res is set to display 6 to 8 different animated sequences depending on the battery level (<10%, 15%, 20% 25% 35% and so on), but when I look at what's actually displayed when charging, it's always the 20% sequence. Perhaps the connection images are the along the same line - the XML may be set up to display 3D and HSPDA images, but the OS always reports a 3G connection.

Just some ideas...
 

jhnstn00

Well-known member
Apr 26, 2010
116
0
0
Visit site
Not sure, is this after you changed something?

I've noticed a few things in my poking around:

1- When encountering modified images that, for whatever reason, aren't what it expects, it'll sometimes fall back to another image. When replacing my battery icon, there were times that it'd revert to the stock image even if my updated XML pointed to my new image.

2- There seems to be some unused images in framework-res. It may be that while the HSDPA images are there, they're simply not called or the conditions for them being called are never met, such as...

3- In modding my battery, I discovered a definite bug somewhere in the battery stats being reported by whatever part of the OS reports them. When discharging, the battery percent is reported in 1% increments. But when charging, the battery is always reported as somewhere around 20%. Even the stock XML in framework-res is set to display 6 to 8 different animated sequences depending on the battery level (<10%, 15%, 20% 25% 35% and so on), but when I look at what's actually displayed when charging, it's always the 20% sequence. Perhaps the connection images are the along the same line - the XML may be set up to display 3D and HSPDA images, but the OS always reports a 3G connection.

Just some ideas...

Great ideas. I thought one of the xmls was pointing to what image to display but what xml is it? This is the first time I went into the framework-res.apk or any apk for that matter.

The ROM is a captivate rom based off of a vibrant rom (jk2) and has always displayed only 3g. the images are there but not being called to display perhaps.

another issue is the battery charging displays, it doesnt display the rotating (animation) while charging, again i think the problem may be in the xml, but which one. I will poke around later. thanks in advance.

edit: what are you using to edit xml?
 
Last edited:

Chris3D

Well-known member
Sep 21, 2010
646
179
0
Visit site
Great ideas. I thought one of the xmls was pointing to what image to display but what xml is it? This is the first time I went into the framework-res.apk or any apk for that matter.

Most of the XML is in res\drawable. The ones controlling the battery are:

stat_sys_battery.xml
stat_sys_battery_charge.xml
stat_sys_battery_charge_err_vinsq.xml
stat_sys_battery_charge_vinsq.xml
stat_sys_battery_vinsq.xml

Not sure about the connection type/status ones. It sounds like the OS could simply be reporting a data connection and throwing up the 3G icon - not differentiating between connection types.

edit: what are you using to edit xml?

Good 'ol Windows Notepad!
 

jhnstn00

Well-known member
Apr 26, 2010
116
0
0
Visit site
error. what is causing it?

error. what is causing it?

**********************************************************
* *
* Framework Utility Script 1.0 *
* *
**********************************************************

New framework will be uploaded to your phone

Make sure phone is connected and rebooted into
Clockwork recovery

Press any key to continue...

failed to copy 'new_framework-res.apk' to 'system/framework/framework-res.apk':
Permission denied

Press any key to return to main menu.
 

Chris3D

Well-known member
Sep 21, 2010
646
179
0
Visit site
error. what is causing it?

Is your phone rooted? Sounds like adb doesn't have permission to write to your phone.

Try opening a command prompt, navigating to the utility folder and then to \tools folder (where adb is located) and typing adb shell. That should connect to your phone. Then type su and see if you get a message on your phone to allow superuser permissions. Click the allow button and make sure it remembers the choice. Should work after that.
 

jhnstn00

Well-known member
Apr 26, 2010
116
0
0
Visit site
Is your phone rooted? Sounds like adb doesn't have permission to write to your phone.

Try opening a command prompt, navigating to the utility folder and then to \tools folder (where adb is located) and typing adb shell. That should connect to your phone. Then type su and see if you get a message on your phone to allow superuser permissions. Click the allow button and make sure it remembers the choice. Should work after that.

rooted yes. definetly.

su and adb shell:

C:\android\tools>su\
'su\' is not recognized as an internal or external command,
operable program or batch file.

C:\android\tools>adb shell\
Android Debug Bridge version 1.0.26

-d - directs command to the only connected USB devic
e
returns an error if more than one USB device is
present.
-e - directs command to the only running emulator.
returns an error if more than one emulator is r
unning.
-s <serial number> - directs command to the USB device or emulator w
ith
the given serial number. Overrides ANDROID_SERI
AL
environment variable.
-p <product name or path> - simple product name like 'sooner', or
a relative/absolute path to a product
out directory like 'out/target/product/sooner'.

If -p is not specified, the ANDROID_PRODUCT_OUT

environment variable is used, which must
be an absolute path.
devices - list all connected devices
connect <host>[:<port>] - connect to a device via TCP/IP
Port 5555 is used by default if no port number
is specified.
disconnect [<host>[:<port>]] - disconnect from a TCP/IP device.
Port 5555 is used by default if no port number
is specified.
Using this ocmmand with no additional arguments

will disconnect from all connected TCP/IP devic
es.

device commands:
adb push <local> <remote> - copy file/dir to device
adb pull <remote> [<local>] - copy file/dir from device
adb sync [ <directory> ] - copy host->device only if changed
(-l means list but don't copy)
(see 'adb help all')
adb shell - run remote shell interactively
adb shell <command> - run remote shell command
adb emu <command> - run emulator console command
adb logcat [ <filter-spec> ] - View device log
adb forward <local> <remote> - forward socket connections
forward specs are one of:
tcp:<port>
localabstract:<unix domain socket name>
localreserved:<unix domain socket name>
localfilesystem:<unix domain socket name>
dev:<character device name>
jdwp:<process pid> (remote only)
adb jdwp - list PIDs of processes hosting a JDWP transport

adb install [-l] [-r] [-s] <file> - push this package file to the device and i
nstall it
('-l' means forward-lock the app)
('-r' means reinstall the app, keeping its data
)
('-s' means install on SD card instead of inter
nal storage)
adb uninstall [-k] <package> - remove this app package from the device
('-k' means keep the data and cache directories
)
adb bugreport - return all information from the device
that should be included in a bug report.

adb help - show this help message
adb version - show version num

DATAOPTS:
(no option) - don't touch the data partition
-w - wipe the data partition
-d - flash the data partition

scripting:
adb wait-for-device - block until device is online
adb start-server - ensure that there is a server running
adb kill-server - kill the server if it is running
adb get-state - prints: offline | bootloader | device
adb get-serialno - prints: <serial-number>
adb status-window - continuously print device status for a specifie
d device
adb remount - remounts the /system partition on the device re
ad-write
adb reboot [bootloader|recovery] - reboots the device, optionally into the boo
tloader or recovery program
adb reboot-bootloader - reboots the device into the bootloader
adb root - restarts the adbd daemon with root permissions
adb usb - restarts the adbd daemon listening on USB
adb tcpip <port> - restarts the adbd daemon listening on TCP on th
e specified port
networking:
adb ppp <tty> [parameters] - Run PPP over USB.
Note: you should not automatically start a PPP connection.
<tty> refers to the tty for PPP stream. Eg. dev:/dev/omap_csmi_tty1
[parameters] - Eg. defaultroute debug dump local notty usepeerdns

adb sync notes: adb sync [ <directory> ]
<localdir> can be interpreted in several ways:

- If <directory> is not specified, both /system and /data partitions will be u
pdated.

- If it is "system" or "data", only the corresponding partition
is updated.

environmental variables:
ADB_TRACE - Print debug information. A comma separated list
of the following values
1 or all, adb, sockets, packets, rwx, usb, sync
, sysdeps, transport, jdwp
ANDROID_SERIAL - The serial number to connect to. -s takes prior
ity over this if given.
ANDROID_LOG_TAGS - When used with the logcat option, only these de
bug tags are printed.

C:\android\tools>
 

Chris3D

Well-known member
Sep 21, 2010
646
179
0
Visit site
rooted yes. definetly.

Is USB debugging turned on on our phone? Settings>Applications>Development

ADB can't connect to your phone without USB debugging enabled. If it was turned off, turn it on and try again. If you still get the permissions error, command prompt to the tools folder, then type:

"adb shell" without the quotes. This should connect to your phone and you should get a # prompt. If you get all the text you were getting before, it's still not connecting to your phone.

If you get the # prompt, then type "su" (no quotes) and check your phone for the SuperUser permissions verification thing.
 

jhnstn00

Well-known member
Apr 26, 2010
116
0
0
Visit site
Is USB debugging turned on on our phone? Settings>Applications>Development

ADB can't connect to your phone without USB debugging enabled. If it was turned off, turn it on and try again. If you still get the permissions error, command prompt to the tools folder, then type:

"adb shell" without the quotes. This should connect to your phone and you should get a # prompt. If you get all the text you were getting before, it's still not connecting to your phone.

If you get the # prompt, then type "su" (no quotes) and check your phone for the SuperUser permissions verification thing.

i was using / after adb shell so I never got to $ prompt for su

thanks will keep going.

why does decompile change v4 folders to non v4? does it make a difference when recomplileing and putting back. anyways will try it.
 

jhnstn00

Well-known member
Apr 26, 2010
116
0
0
Visit site
failed to copy 'new_framework-res.apk to 'system/framework/framework-res.apk': Read-only file system :(

Was able to push via adb push framework-res.apk /system/framework (after renaming the file and putting in /android/tools folder

Mods didnt work though :(

will keep trying.
 

Chris3D

Well-known member
Sep 21, 2010
646
179
0
Visit site
It's likely an issue between Fascinate and Captivate. The Fascinate framework-res.apk has no v4 folders inside, so that's probably it. When my lil utility rebuilds the apk, it manually adds the files from each of the folders in the new apk to the old one using 7z. Since the fascinate doesn't have any v4 folders, the bat program ignores them.

Let me play with this a little tonight, I'll see if I can add the signing to the new apk as opposed to adding all the files to the old, signed apk. That way it'd probably be more compatible with other frameworks, but even then, I have no way of knowing exactly what's in a framework from another system.
 

Skwurlsoft

New member
Dec 26, 2010
1
0
0
Visit site
can you please re-upload this, I'm having issues with my modified framework-res.apk
and I think that your tool might help, but all of the links I've found to chris3d.com are broken.

Thanks in advance.
 

Forum statistics

Threads
943,144
Messages
6,917,505
Members
3,158,841
Latest member
kirk781