[Q] Decompiling android.policy.jar not working - AT&T, Rogers, Bell, Telus Samsung Galaxy S III

Whenever I decompile my android.policy.jar with apktool all I get is a folder called android.policy.jar.out with the file apktool.yml in it. Whenever I decompile any other jar or apk it decompiles all the xmls and resources just fine. I got my android.policy.jar from the /system/framework/ directory. The jar was only 303 bytes so maybe I am missing the files or something. Anyone have any clue why this is happening?
If it helps, I did the if framework-res.apk command and it mounted it just fine and I can decompile other jars and apks just fine. I am on sgs-i747 4.1.2 TW stock.
Thanks
I am trying to get the aosp lock screen as seen in this guide http://forum.xda-developers.com/showthread.php?t=2125330

aeppacher said:
Whenever I decompile my android.policy.jar with apktool all I get is a folder called android.policy.jar.out with the file apktool.yml in it. Whenever I decompile any other jar or apk it decompiles all the xmls and resources just fine. I got my android.policy.jar from the /system/framework/ directory. The jar was only 303 bytes so maybe I am missing the files or something. Anyone have any clue why this is happening?
If it helps, I did the if framework-res.apk command and it mounted it just fine and I can decompile other jars and apks just fine. I am on sgs-i747 4.1.2 TW stock.
Thanks
I am trying to get the aosp lock screen as seen in this guide http://forum.xda-developers.com/showthread.php?t=2125330
Click to expand...
Click to collapse
I use 7zip and remove the classes.dex
The decompile the classes.dex
java -jar baksmali.jar -x C:sdk/path_to/your/classes.dex -o C:sdk/destination/folder

evil1art said:
I use 7zip and remove the classes.dex
The decompile the classes.dex
java -jar baksmali.jar -x C:sdk/path_to/your/classes.dex -o C:sdk/destination/folder
Click to expand...
Click to collapse
Can I just use apktool to decompile it like "apktool d classes.dex classes" in the command prompt?
After I make modifications how would I pack it back into a jar? Would I recompile the classes folder and then insert this into the original jar or what? Thank you for the help

After its recompiled open the android.policy with 7zip and add the new classes.dex to it, it will overwrite the old one

evil1art said:
I use 7zip and remove the classes.dex
The decompile the classes.dex
java -jar baksmali.jar -x C:sdk/path_to/your/classes.dex -o C:sdk/destination/folder
Click to expand...
Click to collapse
I have checked the archive in the android.policy.jar with 7zip and the only thing in it was a folder named META-INF filled with a MANIFEST.ML file no classes.dex
EDIT: this may help, but all my jar files in the /system/framework folder are 313bytes exactly. Is this normal or a sign of something wrong

aeppacher said:
I have checked the archive in the android.policy.jar with 7zip and the only thing in it was a folder named META-INF filled with a MANIFEST.ML file no classes.dex
EDIT: this may help, but all my jar files in the /system/framework folder are 313bytes exactly. Is this normal or a sign of something wrong
Click to expand...
Click to collapse
If you dont have a dex file in there you have a problem

evil1art said:
If you dont have a dex file in there you have a problem
Click to expand...
Click to collapse
The problem with that is I just reflashed rooted stock rom with odin and the jars are all empty (just the meta-inf with the manifest.ml file in them). What is going on here?

aeppacher said:
The problem with that is I just reflashed rooted stock rom with odin and the jars are all empty (just the meta-inf with the manifest.ml file in them). What is going on here?
Click to expand...
Click to collapse
Deodexed?

evil1art said:
Deodexed?
Click to expand...
Click to collapse
no, like flashing stock rooted rom with odexes and all, all the jars are empty. I even downloaded the md5 sum from the root tab of the at&t gs3 xda page

aeppacher said:
no, like flashing stock rooted rom with odexes and all, all the jars are empty. I even downloaded the md5 sum from the root tab of the at&t gs3 xda page
Click to expand...
Click to collapse
There's your problem. It needs to be deodexed to do any modifications

iXanza said:
There's your problem. It needs to be deodexed to do any modifications
Click to expand...
Click to collapse
im having similar problem on the galaxy nexus !
Code:
C:\mod\Apktool-4.2.2\Apktool-4.2.2>apktool d classes.dex
Exception in thread "main" brut.androlib.AndrolibException: brut.directory.Direc
toryException: java.util.zip.ZipException: error in opening zip file
at brut.androlib.ApkDecoder.hasSources(ApkDecoder.java:184)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:79)
at brut.apktool.Main.cmdDecode(Main.java:141)
at brut.apktool.Main.main(Main.java:72)
Caused by: brut.directory.DirectoryException: java.util.zip.ZipException: error
in opening zip file
at brut.directory.ZipRODirectory.<init>(ZipRODirectory.java:55)
at brut.directory.ZipRODirectory.<init>(ZipRODirectory.java:38)
at brut.androlib.res.util.ExtFile.getDirectory(ExtFile.java:55)
at brut.androlib.ApkDecoder.hasSources(ApkDecoder.java:182)
... 3 more
Caused by: java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(Unknown Source)
at java.util.zip.ZipFile.<init>(Unknown Source)
at java.util.zip.ZipFile.<init>(Unknown Source)
at brut.directory.ZipRODirectory.<init>(ZipRODirectory.java:53)
... 6 more
C:\mod\Apktool-4.2.2\Apktool-4.2.2>

evil1art said:
After its recompiled open the android.policy with 7zip and add the new classes.dex to it, it will overwrite the old one
Click to expand...
Click to collapse
hi @evil1art -- how to recompile android.policy jar ...tks

Related

[Q] create a transparant notification screen

like the title sort of say's, i would love a transparent notification menu.
However, when i make the png for the background transparent, it just turns black. *see attachment*
is there any way to make it transparent or is it a no-go?
You have to change a line of code in services.jar
Decompile it using baksmali
Then in the folder services open up com/android/server/status/StatusBarService.smali
Then use find to find 'const/4 v5, 0x2'
And simply replace with 'const/4 v5, -0x3'
Then compile with smali
http://code.google.com/p/smali/ link to smali/baksmali
shoey-n said:
You have to change a line of code in services.jar
Decompile it using baksmali
Then in the folder services open up com/android/server/status/StatusBarService.smali
Then use find to find 'const/4 v5, 0x2'
And simply replace with 'const/4 v5, -0x3'
Then compile with smali
http://code.google.com/p/smali/ link to smali/baksmali
Click to expand...
Click to collapse
that doesn't seem so hard =)
i'll give it a try, thanks
EDIT: ehmm, how do i use baksmali and smali?
maybe someone can post a more detailed tutorial ?
I want a transparent service-popup, too
If your using Linux or Mac, I suggest using ThemePro to make this easier
There's a windows release but I don't know how well it works
Sent from my HTC Desire using XDA App
m8 we need an explanation on how to use these things, theres not much of an explanation in theme pro either. if you could kindly provide a step by step guide to get a transparent notification status background it would be much appreciate.
I'll post it up in the morning. Midnight here so I'm not on the computer
Sent from my HTC Desire using XDA App
thanks m8 looking forward to it
lincore said:
Transparent notification pull down (moded service.jar):
http://www.multiupload.com/V5FGAPJ42P
Click to expand...
Click to collapse
this is taken from lincore's expresso mod, the bottom zip will give transparent notification pull down only. wonder if its possible to make translucent
djtosh said:
this is taken from lincore's expresso mod, the bottom zip will give transparent notification pull down only. wonder if its possible to make translucent
Click to expand...
Click to collapse
i'll give that file a try =)
EDIT:
That file works great!!!!! Thank you so much =) =) =)
djtosh said:
this is taken from lincore's expresso mod, the bottom zip will give transparent notification pull down only. wonder if its possible to make translucent
Click to expand...
Click to collapse
Is this taken from or for, droid 2.1 or 2.2?
djtosh said:
this is taken from lincore's expresso mod, the bottom zip will give transparent notification pull down only. wonder if its possible to make translucent
Click to expand...
Click to collapse
Thanks for the link mate. will def try it out!
p.s. i think translucency depends on the png file you put in the framework.
This is only for 2.2 roms .
Could you make one for 2.1 modaco?
Thanks!!
Where do I push the jar file to, to have this on my droid?
edit: can I just flash the zip using recovery?
sorry, I am unsure.
patachon33 said:
This is only for 2.2 roms .
Could you make one for 2.1 modaco?
Thanks!!
Click to expand...
Click to collapse
you can extract the service.jar and the background png from customized 2.1 roms such as pays's bravesoul or Amer's v4 and push them to your device. hvn't tried it out but should work=)
qwertylesh said:
Where do I push the jar file to, to have this on my droid?
edit: can I just flash the zip using recovery?
sorry, I am unsure.
Click to expand...
Click to collapse
yes you can juz flash the zip=)
i still hvn't done so thou.. coz i'm using 2.06 based rom and lincore made it for the official 2.09.
It's not really hard to do it on your own:
First download smali.jar and baksmali.jar from here http://code.google.com/p/smali/
Open the services.jar file for example with winzip, 7z, winRar, or whatever.
Unzip the classes.dex file to your sdk/tools/ folder and place the baksmali and smali file there too. After that open a new commandbox an run following line:
java -jar baksmali.jar -o out/ classes.dex
You'll have a new folder now called "out". Browse to "out/com/android/server/status" and open the file called StatusBarService.smali with a text editor like notepad.
Search for ".line 1773" and you'll find also "const/4 v5, 0x2"
Just change this to "const/4 v5, -0x3" and save the file.
Open again a new commandbox and run this:
java -Xmx512M -jar smali.jar out/ -o edited-classes.dex
Now you'll have a new dex file called "edited-classes.dex".
Delete the old file an rename the new in "classes.dex".
Open again the services.jar file with any zip tool and overwrite the classes.dex file with the one just created.
Now search the status_bar_background.png file in the framework-res.apk and make it transparent.
You're done!
THIS WILL ONLY WORK ON DEODEXED ROMS!
Otherwise you won't find a classes.dex file in the services.jar!
You'd have to deodex all files before!
Sturmtief said:
It's not really hard to do it on your own:
First download smali.jar and baksmali.jar from here <snip to allow newbie posting>
Open the services.jar file for example with winzip, 7z, winRar, or whatever.
Unzip the classes.dex file to your sdk/tools/ folder and place the baksmali and smali file there too. After that open a new commandbox an run following line:
java -jar baksmali.jar -o out/ classes.dex
You'll have a new folder now called "out". Browse to "out/com/android/server/status" and open the file called StatusBarService.smali with a text editor like notepad.
Search for ".line 1773" and you'll find also "const/4 v5, 0x2"
Just change this to "const/4 v5, -0x3" and save the file.
Open again a new commandbox and run this:
java -Xmx512M -jar smali.jar out/ -o edited-classes.dex
Now you'll have a new dex file called "edited-classes.dex".
Delete the old file an rename the new in "classes.dex".
Open again the services.jar file with any zip tool and overwrite the classes.dex file with the one just created.
Now search the status_bar_background.png file in the framework-res.apk and make it transparent.
You're done!
THIS WILL ONLY WORK ON DEODEXED ROMS!
Otherwise you won't find a classes.dex file in the services.jar!
You'd have to deodex all files before!
Click to expand...
Click to collapse
Right, I'll be the token slow chap. I followed you right up to where you say "Open the services.jar file for example with winzip". Where do we find this file?
Open your ROM with a zip file manager, browse to /system/framework/ and there you'll find the services.jar file!
If you want to edit the file from the rom you are using, type this in a commandbox:
adb pull /system/framework/services.jar services.jar
Don't forget to make a backup of the file or a nandroid backup!
Thanks for that - found services.jar. However when I do a search on StatusBarService. smali I can't find a .line 1773 (or the string 1773 at all come to that). I'm using OpenDesire. There are lots of other files called things like StatusBarService$1.smali and similar.

[REQ] Volume rocker wake function request......

I am using XXLEF, is there anyone can help me on this please?
Any luck ?
bonglau0429 said:
I am using XXLEF, is there anyone can help me on this please?
Click to expand...
Click to collapse
Hey, if you upload the android.policy.jar (found in /system/framework) from the XXLEF ROM I can do this for you. If it's not deodexed I'll also need the android.policy.odex.
Alternatively you could DIY using the instructions on this thread: http://forum.xda-developers.com/showthread.php?t=1585309
Thanks Atarii!!:good:
but i have a problems on it,
I've extracted out a files from android.policy.odex and edit the KeyguardViewMediator.smali successfully, but how to compress it to a android.policy.odex............? Can you teach me?
:crying::crying:
Here is my odex and jar files
Thanks again Atarii!
bonglau0429 said:
:crying::crying:
Here is my odex and jar files
Thanks again Atarii!
Click to expand...
Click to collapse
Hey,
Good work getting the file editted. :good:
After you made the changes to the smali code, you need to compile it into a classes.dex file:
Code:
java -Xmx1024m -jar smali.jar out -o classes.dex
(Where out is the name of the folder with the smali code in)
Now drag that classes.dex file into the original android.policy.jar (keep a backup of the android.policy.jar somewhere else).
Then follow the steps from "ODEXING BACK" in this guide: http://forum.xda-developers.com/showthread.php?t=1208320 :fingers-crossed:
Let us know if you have any troubles

Please help me in this problem

Pleas Help..
When I work Combile and Decombile APKTOOL for File framwork-res.apk
Of Version Jelly Bean 4.1.2 XXLSJ All OK
But When Add My Rom BootLoop
Are you signing the apk after you recompile it??
Sent from my GT-I9300 using Tapatalk 2
AuSSiELaMbChOpS said:
Are you signing the apk after you recompile it??
Sent from my GT-I9300 using Tapatalk 2
Click to expand...
Click to collapse
no signing apk
whats this broplem
help
heeeeeeeeeeeeeeeeeeeeeeelp
amro habib said:
help
heeeeeeeeeeeeeeeeeeeeeeelp
Click to expand...
Click to collapse
The problem is with the signing. (The framework-res.apk has to be signed with the platform key)
Try to sign the apk (use apkmultitool), but I think it won't work, because you wont have the platform key.
I suggest you to do the following:
If you use apktool or apk-multi-tool apkmultitool.com:
1) if you want to change drawables, just push the new png-s into the original framework-res.apk (open the original framework-res.apk with 7zip, and drag and drop the new png in the corresponding drawable folder).
2) if you want to change xml-s, decompile framework-res.apk, change xml-s, recompile framework-res.apk, then extract the "resources.arsc" from the new apk, and push it to the original framework-res.apk (again with 7zip or any compatible file manager)
3) if you change some smali code, then you need to the same as in step 2, but with the classes.dex file.
Basically you should use the original framework-res.apk as a starting point, and (without extracting it) push all your mods into it!
OR try the UOT kitchen: http://uot.dakra.lt/
Cheers!
Gyebro said:
The problem is with the signing. (The framework-res.apk has to be signed with the platform key)
Try to sign the apk (use apkmultitool), but I think it won't work, because you wont have the platform key.
I suggest you to do the following:
If you use apktool or apk-multi-tool apkmultitool.com:
1) if you want to change drawables, just push the new png-s into the original framework-res.apk (open the original framework-res.apk with 7zip, and drag and drop the new png in the corresponding drawable folder).
2) if you want to change xml-s, decompile framework-res.apk, change xml-s, recompile framework-res.apk, then extract the "resources.arsc" from the new apk, and push it to the original framework-res.apk (again with 7zip or any compatible file manager)
3) if you change some smali code, then you need to the same as in step 2, but with the classes.dex file.
Basically you should use the original framework-res.apk as a starting point, and (without extracting it) push all your mods into it!
OR try the UOT kitchen: http://uot.dakra.lt/
Cheers!
Click to expand...
Click to collapse
all this work bootloop..

[Q]How to decompile framework.apk?

When I recompile framework-res.apk,the apktool notice "aapt:...".And the framework-res.apk still be builded.But I replace the resources.arsc and put it in the phone,reboot and always in bootanimation.I used apktool 1.4.10,1.5.0,1.5.1... and so on.I can not solve this problem,I need help.
Sent from my lt28h use sony fw.
kin912 said:
When I recompile framework-res.apk,the apktool notice "aapt:...".And the framework-res.apk still be builded.But I replace the resources.arsc and put it in the phone,reboot and always in bootanimation.I used apktool 1.4.10,1.5.0,1.5.1... and so on.I can not solve this problem,I need help.
Sent from my lt28h use sony fw.
Click to expand...
Click to collapse
I am not clear from what you did. But you need to do it this way.
apktool if ion SemcGenericUxRes.apk
apktool d -t ion framework-res.apk out
make changes to decompiled source
apktool b out new.framework-res.apk
Now open both framework-res.apk and new.framework-res.apk side by side using an archiver. Do not use windows open.
Now you will notice one thing that the new framework does not contain META-INF folder.
Delete the resources.arsc file from the original framework-res. Drag the resources.arsc from the new framework-res and dump it on to the original framework-res. Close both the files.
Now you are ready to use the updated original framework-res.apk
ganeshbiyer said:
I am not clear from what you did. But you need to do it this way.
apktool if ion SemcGenericUxRes.apk
apktool d -t ion framework-res.apk out
make changes to decompiled source
apktool b out new.framework-res.apk
Now open both framework-res.apk and new.framework-res.apk side by side using an archiver. Do not use windows open.
Now you will notice one thing that the new framework does not contain META-INF folder.
Delete the resources.arsc file from the original framework-res. Drag the resources.arsc from the new framework-res and dump it on to the original framework-res. Close both the files.
Now you are ready to use the updated original framework-res.apk
Click to expand...
Click to collapse
No need to install framework-res.apk only just SemcGenericUxpRes.apk?
ganeshbiyer said:
I am not clear from what you did. But you need to do it this way.
apktool if ion SemcGenericUxRes.apk
apktool d -t ion framework-res.apk out
make changes to decompiled source
apktool b out new.framework-res.apk
Now open both framework-res.apk and new.framework-res.apk side by side using an archiver. Do not use windows open.
Now you will notice one thing that the new framework does not contain META-INF folder.
Delete the resources.arsc file from the original framework-res. Drag the resources.arsc from the new framework-res and dump it on to the original framework-res. Close both the files.
Now you are ready to use the updated original framework-res.apk
Click to expand...
Click to collapse
I try to decompile this mod and it's sucessful.--->http://forum.xda-developers.com/showthread.php?t=2047999
Once I do the original framework-res I fail to make it use.
kin912 said:
I try to decompile this mod and it's sucessful.--->http://forum.xda-developers.com/showthread.php?t=2047999
Once I do the original framework-res I fail to make it use.
Click to expand...
Click to collapse
How are you trying to use it. Tell me the steps.
ganeshbiyer said:
How are you trying to use it. Tell me the steps.
Click to expand...
Click to collapse
1.Install framework about framework-res.apk and SemcGenericUxpRes.apk.
2.Decompile framework-res.apk and make change of the source.
3.Recompile framework-res.apk and build the new framework-res.apk.
4.Take the resources.arsc and the raw which I changed from the new framework-res.apk to the original framework-res.apk.
5.Replace the final framework-res.apk in my phone with 644 permission.
I reboot and loop in the bootanimation.
kin912 said:
1.Install framework about framework-res.apk and SemcGenericUxpRes.apk.
2.Decompile framework-res.apk and make change of the source.
3.Recompile framework-res.apk and build the new framework-res.apk.
4.Take the resources.arsc and the raw which I changed from the new framework-res.apk to the original framework-res.apk.
5.Replace the final framework-res.apk in my phone with 644 permission.
I reboot and loop in the bootanimation.
Click to expand...
Click to collapse
What are the sizes of the frameworks-res.apk's
ganeshbiyer said:
What are the sizes of the frameworks-res.apk's
Click to expand...
Click to collapse
Original:21MB
Decompile:14.9MB
If I do nothing change only recompile the frameworks-res.apk,it still has the bug.
kin912 said:
Original:21MB
Decompile:14.9MB
If I do nothing change only recompile the frameworks-res.apk,it still has the bug.
Click to expand...
Click to collapse
If you have followed pepitos tutorial from themes section then it should be ok.
There is nothing else to do.
Sent from my LT28i using xda premium
ganeshbiyer said:
If you have followed pepitos tutorial from themes section then it should be ok.
There is nothing else to do.
Sent from my LT28i using xda premium
Click to expand...
Click to collapse
I make sure the steps are ok because I can decompile the framework.apk of miui.Anyway,thanks a lot!

How to mod android.policy.jar?

My Xperia S is official , it is odex
I want to mod the android.policy.jar
but I find it in system/framework/android.policy.jar is only 1KB
and the android.policy.jar next to android.policy.odex which is 369KB
I think the android.policy.odex is normal.
The android.policy.jar 's information is not I need , only have a small data!
How can i mod the android.policy.jar??
Thank you Very much~!
The android.policy.jar & android.policy.odex :
View attachment 2205036
:fingers-crossed:
lllllllllll said:
My Xperia S is official , it is odex
I want to mod the android.policy.jar
but I find it in system/framework/android.policy.jar is only 1KB
and the android.policy.jar next to android.policy.odex which is 369KB
I think the android.policy.odex is normal.
The android.policy.jar 's information is not I need , only have a small data!
How can i mod the android.policy.jar??
Thank you Very much~!
The android.policy.jar & android.policy.odex :
View attachment 2205036
:fingers-crossed:
Click to expand...
Click to collapse
Hi,
In order to make changes in the android policy.jar file, you first need to deodex it. You can very easily deodex it using my software over here - http://forum.xda-developers.com/showthread.php?t=2213235
Then, follow this huide to decompile the jar - http://forum.xda-developers.com/showthread.php?t=1732635
Good luck
Sent from my LT26i using xda app-developers app
abcdjdj said:
Hi,
In order to make changes in the android policy.jar file, you first need to deodex it. You can very easily deodex it using my software over here - http://forum.xda-developers.com/showthread.php?t=2213235
Then, follow this huide to decompile the jar - http://forum.xda-developers.com/showthread.php?t=1732635
Good luck
Sent from my LT26i using xda app-developers app
Click to expand...
Click to collapse
OK, thank you
Am i just deodex the android policy.jar? Do not need to deodex my rom?
Then , it is different for decompile the jar and decompile the apk?
Thank YoU ~
I'm Hongkonger~~ :victory:
lllllllllll said:
OK, thank you
Am i just deodex the android policy.jar? Do not need to deodex my rom?
Then , it is different for decompile the jar and decompile the apk?
Thank YoU ~
I'm Hongkonger~~ :victory:
Click to expand...
Click to collapse
You do not need to deodex your entire rom. Only deodexing the android policy.jar file will suffice. Decompiling a jar file is slightly different from decompiling an apk. We do not use apktool to decompile jar files but execute these two commands - (First extract classes.dex from anroid policy.jar using winrar and place it in the same folder as smali.jar and baksmali.jar)
Code:
java -jar baksmali.jar -o classout/ classes.dex
Make any changes that you want to do now.
Code:
java -Xmx512M -jar smali.jar classout/ -o new-classes.dex
Then rename new-classes.dex to classes.dex and put it back into the jar file.
Regards,
abcdjdj
Is there a guide how to return to odex? My rom is odex. I now have my mod android.policy.jar
AFAIK, when you deodex a framework file, all the rest needs to be deodexed also, something that doesn't exist with apps files...
gercen said:
Is there a guide how to return to odex? My rom is odex. I now have my mod android.policy.jar
Click to expand...
Click to collapse
Here is a guide to re-odex framework files - http://forum.xda-developers.com/showthread.php?t=1208320
Felimenta97 said:
AFAIK, when you deodex a framework file, all the rest needs to be deodexed also, something that doesn't exist with apps files...
Click to expand...
Click to collapse
I am sorry, I confused framework files with apks coz I have myself tried using a deodexed apk on a fully odexed rom and it worked. You are right, using a partially deodexed framework causes bootloops.

Categories

Resources