How to mod android.policy.jar? - Sony Xperia S, Acro S, Ion

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.

Related

[fix] WIFI for JVU (useable on previous release to) 100% tested

I will be releasing the fix on my rom sometimes next week , and I will not compile this for every set up / theme / rom out there but if you know what you are doing this is pretty easy fix
Here is how the fix works :
Our present kernel source is 2.3.4 and we are running 2.3.6 base . So I looked at what was different in the wifi files from 2.3.4 to 2.3.6 and there you go .
Files attached at the end of the post are 2.3.4 JVQ (already modified for JVU)
(fyi these files come from apk manager just rename your jar files to apk to decompile them then copy the files attached at the end of the post in there respective places )
_framework.jar :
delete: \android\net\wifi\WifiStateTracker$1.smali
and copy paste the files attached and recompile
_services.jar :
copy paste the files attached and recompile
_'etc' folder copy paste into your /system folder in your rom/Phone
(not 100% sure its needed but better use them anyways)
IF you are not on JVU you need to change the ids manually , the names of the values are written in the smali so that will make it easier to port to other versions .
Tested on Belkin router (the worst of them all) and on public wifi with no dhcp assigned . after an hour no disconnect flawless victory
For beginers here is a guide by pantrif13 : http://forum.xda-developers.com/showpost.php?p=22032781&postcount=16
Credits to Shoman94 for pointing me in the right direction and providing files to help me diff(and being insistent about it )
suprstar for testing
and gtg465x who achieved this first on the SGS2
Will this fix the adhoc problem too ?
You are the master.
Sent from my GT-I9000 using xda premium
HSaber said:
Will this fix the adhoc problem too ?
Click to expand...
Click to collapse
well this fix the current wifi bug , rule of thumb if it was wokring back on JVQ for you , and it stopped after that , now it works .
try and tell us
I'm using it in my rom thank you!
Can some1 please explain me how to recompile...
Sent from my GT-I9000 using XDA App
burakgon said:
I'm using it in my rom thank you!
Click to expand...
Click to collapse
Pleasure.. Spam my thx button ?
Little mention on your credits maybe
To others if you don't know how to use apkmanager this mid is not for you
Tell your favorite rom dev about it it takes a few minutes to apply this
I could have kept this to my rom but I put it out there for all rom to use
This fix really works
DAGr8 said:
Pleasure.. Spam my thx button ?
Little mention on your credits maybe
To others if you don't know how to use apkmanager this mid is not for you
Tell your favorite rom dev about it it takes a few minutes to apply this
I could have kept this to my rom but I put it out there for all rom to use
This fix really works
Click to expand...
Click to collapse
Bootloop when I try it on odexed rom. (Deodexed applied odexed) JVU
burakgon said:
Bootloop when I try it on odexed rom. (Deodexed applied odexed) JVU
Click to expand...
Click to collapse
well use odex jvq ..
(fyi these files come from apk manager just rename your jar files to apk to decompile them then copy the files attached at the end of the post in there respective places )
_framework.jar :
delete: \android\net\wifi\WifiStateTracker$1.smali
and copy paste the files attached and recompile
_services.jar :
copy paste the files attached and recompile
_'etc' folder copy paste into your /system folder in your rom/Phone
(not 100% sure its needed but better use them anyways)
Click to expand...
Click to collapse
cant get the instrucstion newbie here..how can i use this one pls can u use much more clearer instructions for newbies..thank you very much in advance
Great work!
Thx for your time.
titaempoy said:
cant get the instrucstion newbie here..how can i use this one pls can u use much more clearer instructions for newbies..thank you very much in advance
Click to expand...
Click to collapse
As said in OP, until built for any ROM version: Be your own developer!
Adb pull the system .jar files, decompile with dependency, edit, compile, rename, adb push result.
are a beginner and I did not understand anything ,more clear PLEASE if you can, thanks!...I think your work is useful
I think many people could do with a step by step guide for this if anyone has the time to do it
Please note our desires about this topic...declared above..thanks!
romyo said:
Please note our desires about this topic...declared above..thanks!
Click to expand...
Click to collapse
I think that dagr8 explain very clear what needs to be done (but you need to have some experience with decompiling and compiling).
Here what you need to do in case you are on jvu:
1) First off all you need the latest JDK and JRE installed on your system.
2) Then go here to learn how to set up apktool.
3) After the setup of apktool pull the services.jar (services.odex if you have odex rom) and framework.jar (framework.odex in case of odex rom) and put it in your apktool folder
4)
a. If you are on deodex rom you only need to run these commands from the folder of apktool (go to apktool folder and press ctrl and shift -open command window here)
Code:
apktool d framework.jar
apktool d services.jar
You will find two new folders (servicesout and frameworkout)
Then do what dagr8 said in op.
b. if you are on odex rom: get the latest baksmali from here
then pull all your system/framework to your pc and put baksmali.jar there.
Open commant window and write:
for sevices:
Code:
java -jar baksmali.jar -c :core.jar:bouncycastle.jar:ext.jar:framework.jar:android.policy.jar:services.jar:core-junit.jar -xa 10 services.odex -o services.jar.out
for framework:
Code:
java -jar baksmali.jar -c :core.jar:bouncycastle.jar:ext.jar:framework.jar:android.policy.jar:services.jar:core-junit.jar -xa 10 framework.odex -o framework.jar.out
Then do what dagr8 said.
5)Both deodex odex: get the latest smali from here
Put it in the folder with out folders and write:
for services:
Code:
java -jar smali.jar sevices.jar.out -o classes.dex
you will find a new classes.dex file.Open services.jar with winrar and drag and drop (overwrite) there.
Then for framework:
Code:
java -jar smali.jar framework.jar.out -o classes.dex
Same here (open the jar with winrar and drag and drop)
5) if you are on deodex rom you finished just push the new services and framework to the system along with the files which provide dagr8 for etc folder.
6) if you are on odex...go here and follow the guide from the part odexing back...
I hope i helped!
Thanks a lot dagr8 for this!!
can dev provide the public.xml that this was made with for comparison of ids?
Thanks for your time and explanations given pantrif13 and dagr8, expecting something more simple ... you can install the CWM (example) ... so (who knows it's easy anyway)...expect other solutions!!!to solve the problem with wifi...
Great job. Thanks
i m on jw1 deodex jetpack custom rom 8.2 and i am using the jvt modem...
will you provide fix for jw1 rom next days? thank you !!!

[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

[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!

[Q] Decompiling android.policy.jar not working

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

[Q] How to edit systemui.apk in Stock ROM?

How to edit systemui.apk in Stock ROM?
denisf1981 said:
How to edit systemui.apk in Stock ROM?
Click to expand...
Click to collapse
Decompile it with apktool
Make changes
Recompile with apktool
Push to system with permissions 644 & restart phone or make a flashable zip
Apktool with instructions & usage can be found
https://ibotpeaches.github.io/Apktool/
Can use Ubuntu/Linux or Windows
Obviously requires rooted phone

Categories

Resources