Kenny
Kenny

Reputation: 5410

Modify java code in framework.jar

My stock rom on my phone has issues with MVNO's (mobile virtual network operator). Basically this means that my data connection only works when Roaming. This is a know issue that has already been fixed on several roms (but not on mine).

To fix this I would like to modify the source of the framework.jar file (/system/framework/framework.jar), more specific the file : /com/android/internal/telephony/gsm/GsmServiceStateTracker.java

To start I will list the steps I have take to show you where I'm stuck at the momoment: I have fully deodexed my stock rom, both the JAR files and the APK files in both /system/framework/ and /system/app

This is where I'm stuck, I need to figure out how to edit the java file I want and end up with a working framework.jar again that I can upload to my phone.

Am I doing this the wrong way? Any other way to resolve my issue? I hope to get some help from people who have experience in doing this...

Upvotes: 5

Views: 11606

Answers (3)

Caleb Fenton
Caleb Fenton

Reputation: 1214

If you want to make modifications, you will not want to do them at the Java level. You can decompile to Java to broadly understand what's going on, but you will need to modify the Smali directly.

Once you have modified the Smali, you can rebuild with:

smali -o classes.dex frameworkSmaliDirectory

Then, add the updated classes.dex back to the framework.jar. On Linux this is simple:

zip framework.jar classes.dex

Finally, remount /system read-write, and push updated framework.jar to device:

adb shell mount -o rw,remount /system
adb push framework.jar /system/framework/

Now cross your fingers and hope you didn't break anything.

Upvotes: 1

binhgreat
binhgreat

Reputation: 1002

Can you try apktool. This is an example, let check Q&A "How do I make a patch manually myself?"

Upvotes: 0

Shravan
Shravan

Reputation: 341

I also worked on the same approach to fetch the network related parameters like; BAND, BCCH etc. Once you got the *.class file after decompilation of framework.jar, You can use Java DCompiler or JDclipse to convert the .class file into .java file. Now modify the java file as per your requirement.

I modified the RIL.java but I am stuck on repacking. I am unable to convert RIL.java into RIL.class. It has many dependencies/import of framework's hidden files. Ref: http://www.mailinglistarchive.com/html/[email protected]/2010-02/msg00325.html

Android Gents, Please throw some lights if We are on wrong tack...

Upvotes: 1

Related Questions