Jump to content

How to replace framework-res.apk??


Guest redhawkuk

Recommended Posts

Guest redhawkuk

There are 4 things really annoy me about Android on the ZTE Racer:

- low battery life warning box <= 15% I would prefer 8% before giving a damn. (/res/values/integers.xml)

- low memory warning that won't go away if your internal storage is < 30MB

- the default "beep" tone when you adjust your volume control - where is this sound file?? (appears to be software generated - http://www.netmite.c...olumePanel.java).

- the emergency call button that if touched enables call mode and calls emergency services.

This is particularly dangerous while in flight because it's so easy to trigger without realising it.

Now I have found the settings for changing the low battery life threshold they're stored inside framework-res.apk my only problem is how the hell do I replace this file without screwing up the Operating System??

I have ADB drivers installed as well as cwm however any tips on replacing files or restoring would be most appreciated.

btw: if anyone has details regarding the other 3 issues I would be interested to know

Richard S.

Edited by redhawkuk
Link to comment
Share on other sites

Guest massacre^

It is possible to open it through winrar...just right click > open with > choose winrar.

in it u will find a bunch of xmls in which i tried to find battery related stuff but failed.....

good job hunting :lol:

Link to comment
Share on other sites

Guest Racerboy

ok, their are numerous ways to edit the framework-res.apk and any other .apk file, if your simply replacing a like for like file ie "res/drawable-ldpi/ic_jog_dial_unlock" for example you can use 7-Zip to drag and drop replacement files, the modified file should ok to use.....if however you need to modify .xml`s (example res/values/arrays.xml) you need to decompile the .apk file (i use Apk Multi-Tool to decompile/recompile and Notepad ++ to edit .xml`s and smali`s to change certain values)........make backups of the original source rom or .apk your working on, always make backups of installed roms with CWM BEFORE you install a modified rom or push a modified .apk file via ADB.........

useful links http://forum.xda-dev...d.php?t=1136625 editing .apks for smali files

http://apkmultitool.com/ for editing. decompiling/recompiling and a bunch of other stuff

http://notepad-plus-plus.org/ notepad++ for editing .xml* and or smali files

*NOTE: when editing .xml`s only change values that are in BLACK

hope it helps and their is alot to learn, but basic editing is quite easy

BASIC cmd commands to use with ADB on a Windows based computer system:

you want to pull an .apk from a rom you currently have installed: example framework-res.apk

open cmd window and type:

adb pull  /system/framework/framework-res.apk
the pulled file will be located in the C:/Users/YOUR-USER-NAME/ to push a modified .apk file....example: location of modified file on your computer (push and pull same location) C:/Users/YOUR-USER-NAME/framework-res.apk
adb push framework-res.apk  /system/framework/framework-res.apk

NOTE .apk file names are case sensitive.......

for apps its basically the same command just different folder location on phone, instead its /system/apps/whatever.apk to push n pull files

Edited by Racerboy
Link to comment
Share on other sites

Guest ClydeRadcliffe

Here is a guide on how to use apktool to decompile/recompile apk's

apktool Guide

Be sure to backup old framework-res or entire rom before trying this so you can revert to old one if something goes wrong.

In my experience framework-res.apk is the most difficult file to succesfully modify and recompile. Since i am compiling CM7 myself from source sometimes best way is to make changes directly in source before compiling.

Link to comment
Share on other sites

Guest ClydeRadcliffe

@ClydeRadcliffe

are you compiling for Racer and will you be releasing it here?

I don't own a Racer. I am lurking here because I am maintaining a friends Racer. Sorry if I am intruding here.

I am compiling CM7 roms for HD2. And so far I didn't had much luck with recompiling framework-res without errors so all changes I need I do in source before building a kang.

Link to comment
Share on other sites

Guest equiliym

Now I have found the settings for changing the low battery life threshold they're stored inside framework-res.apk my only problem is how the hell do I replace this file without screwing up the Operating System??

hey could you tell me in what xml is the setting for low battery alarm? sounds nice to change the value, too lazy to search on my own so if you know, it would be helpful :P

Link to comment
Share on other sites

Guest Racerboy

I don't own a Racer. I am lurking here because I am maintaining a friends Racer. Sorry if I am intruding here.

I am compiling CM7 roms for HD2. And so far I didn't had much luck with recompiling framework-res without errors so all changes I need I do in source before building a kang.

thats not a problem you are free to "Lurk" around whenever you like whether you have a Racer or not :) after all it is free and open info we share here on these forums.....................regards framework-res.apk have you tried editing using the above tools in 3rd post, they are quite handy for editing decompiling/re-compiling an existing .apk BUT as i see your compiling from source which is better......

Edited by Racerboy
Link to comment
Share on other sites

Guest ClydeRadcliffe

hey could you tell me in what xml is the setting for low battery alarm? sounds nice to change the value, too lazy to search on my own so if you know, it would be helpful :P

Just looked into racer's framework-res.apk and found next line in /res/values/integers.xml

<integer name="config_lowBatteryWarningLevel">15</integer>

I guess that would be the one.

Edited by ClydeRadcliffe
Link to comment
Share on other sites

Guest ClydeRadcliffe

thats not a problem you are free to "Lurk" around whenever you like whether you have a Racer or not :) after all it is free and open info we share here on these forums.....................regards framework-res.apk have you tried editing using the above tools in 3rd post, they are quite handy for editing decompiling/re-compiling an existing .apk BUT as i see your compiling from source which is better......

I havent tried to use those tools, I only used apktool which I think is also what is used in apk Multi tool.

Anyway on some occassions I managed to succesfully recompile framework-res file but most of the time I am getting an compile error or I get a apk file with I cant boot or have some other problems. Maybe

In my experience apk's like framework-res, Contacts.apk and Settings.apk are pain to recompile without errors.

Link to comment
Share on other sites

Guest Racerboy

I havent tried to use those tools, I only used apktool which I think is also what is used in apk Multi tool.

Anyway on some occassions I managed to succesfully recompile framework-res file but most of the time I am getting an compile error or I get a apk file with I cant boot or have some other problems. Maybe

In my experience apk's like framework-res, Contacts.apk and Settings.apk are pain to recompile without errors.

yes apktool is the command tool chain included in the apps above, its just intergrated into a nice UI for easy use for novice users of commands (like myself, although am learning) and afew other features, which is nice............at first when i started editing .apk files i did get errors in framework-res.apk but i put it down to the app package and not my good self :D ......seriously though they can be a pain in the backside........all depends on what your editing or adding

Edited by Racerboy
Link to comment
Share on other sites

Guest equiliym

Just looked into racer's framework-res.apk and found next line in /res/values/integers.xml

I guess that would be the one.

onice, thanks, gonna make it pop on every 5% (15-10-5) now lolol :D

Link to comment
Share on other sites

  • 2 weeks later...
Guest redhawkuk

Okay so I have a really big problem my framework-res.apk won't rebuild using the apktool.

To make sure it wasn't related to my modded files I tested it against an untouched copy but still won't build.

I'm getting a lot of "declared here is not defined." in \res\values\plubic.xml

apktool is version 1.4.2 (and yes I have tried --forced-all as well)

Any idea what I'm doing wrong??

Richard S.

Edited by redhawkuk
Link to comment
Share on other sites

Guest redhawkuk

I've solved it the ROM I was editing (Ricky Wyatt's v2 Android 2.1) had the default wallpaper saved in JPG format with a PNG extension.

I guess the apktool does strict checking of file formats but why it was throwing loads of strange errors is another mystery.

The only thing I can't work out is how did Ricky Wyatt manage to pack this file in the first place?? :blink:

Richard S.

Edited by redhawkuk
Link to comment
Share on other sites

Guest redhawkuk

I decided to play around with the original framework-res.apk 2.1 from the Three UK stock ROM but there's something weird about the unpack / rebuild process.

Original APK size 6.18MB

Unpacked to folder total size: 5.73MB

Repacked APK size: 3.72MB

Somehow I've gone from 6.18MB ot 5.73MB, what happened to the rest of the data I thought APKs were compressed?? (original apk appears to be uncompressed with unicode text).

I repacked, resigned and replaced the framework-res.apk file but on rebooting my phone it didn't get past the little green man.

Obviously I'm missing something important but what is it??

Richard S.

Edited by redhawkuk
Link to comment
Share on other sites

Guest equiliym
I repacked, resigned and replaced the framework-res.apk file but on rebooting my phone it didn't get past the little green man.

i think thats just your problem, framework-res.apk is a system file, you should not resign it, keep the original signature and it should work.. for compression, its probably different compression method used in 7z that apk tool uses :P

also, /res/drawable/default_wallpaper.jpg < not sure why that is a problem, its supposed to be .jpg

Link to comment
Share on other sites

Guest redhawkuk

Compression does seem to be the issue here I used Winzip32 no compression to repack the APK and then resign it.

Now it boots all the way to the welcome / unlock screen however when I do unlock all I get are FCs. :mellow:

I realise that this is a system file which shouldn't be mucked about with but Ricky has done it I don't see why I cannot do the same.

Any ideas how to prevent apktool compressing the data in the APK build or do I need another tool?

Richard S.

Edited by redhawkuk
Link to comment
Share on other sites

Guest equiliym

Compression does seem to be the issue here I used Winzip32 no compression to repack the APK and then resign it.

Now it boots all the way to the welcome / unlock screen however when I do unlock all I get are FCs. :mellow:

I realise that this is a system file which should be mucked about with but Ricky has done it I don't see why I cannot do the same.

Any ideas how to prevent apktool compressing the data in the APK build or do I need another tool?

Richard S.

try using 7-zip and without resigning of system files, i never had issues when i edit and repack apk files

Link to comment
Share on other sites

Guest redhawkuk

I've extracted and rebuilt many APKs in the past without problems but for some reason framework-res.apk seems to be something of a special case.

All I ever wanted was to change the low battery warning threshold and remove the stupid emergency button crap from the locked screen.

I suspect Android probably has some kind of anti-tampering mechanism because only the slightest insignificant change would causes all applications to FC.

For example I replaced the startup screen images using Winzip not apktool this time which kind of worked except everything FC when I unlocked the phone.

Anyway I'm about to throw in the towel soon unless someone knows of a solution (yes I have tried cleaning dalvik-cache). :mellow:

Richard S.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.