[TUT] Implementing EPRJ RIL in Custom Roms by Yourself
A. Why change RIL?
As a user that's been using custom roms since our bootloader was unlocked, I'm aware that some of us have some issue with telephony & mobile data (in short, RIL) - occasionally IMEI wouldn't be read on boot, which would lead to device not being registred on network. Sometimes, the network would "die" in a way - you'd get an error when trying to dial a number, and when someone would call you, they'll hear the ringing tone while your cell phone would not ring at all.
The cause of the problem seems to be some lazy coding by official CM developers/maintainers for our device. This was picked up by a developer named kholk, so he did his best to recode it properly, however it was never included into official CM device tree for reasons unknown to me (more info about the issue can be found here: http://review.cyanogenmod.org/#/c/47980/
Kholk did include his own custom RIL into his EPRJ roms, but the roms are kinda old and have iffy baseband (which seems to be kernel issue, as he's using his own, 3.4 kernel instead of CM's 3.1 kernel in other custom roms).
So, with the help of Adam77Root, I've learned a way on how to implement EPRJ RIL into other custom roms (since I still had RIL issue with default CM RIL in 4.3 roms even) - so far I've tested it with Vanir 4.3, Carbon 4.3, Carbon 4.3.1, and few 4.2.2 roms, and I havent had ANY issues I had in CM RIL.
So, this is a tutorial to show you how you can import EPRJ RIL to any custom rom you'd like, in case you have issues with cell connection.
-this should work on any kernel and any custom rom (4.2.2+)! Tested so far, as far as kernel goes, are iodak 8/8.5, WWJB8/8b, Optimus Prime several versions, Optimus Play! 2.53.
-KK roms tested are P.A. by @dcos which has eprj ril by default, official CM nightlies and several others
-some KK roms, for some reason, don't have x3ril.smali file in their telephony-common.jar. To implement EPRJ RIL in these roms, follow the tutorial up to point 5, and skip that one, since you don't have anything to delete. After point 13, you need to do one additional thing - you need to edit ROM's build.prop settings, look for this line: "#ro.telephony.ril_class=X3RIL", and delete "#" so this line would be included in build.prop. After that, you're ready to flash. Thanks goes to @gerciolisz
for the tip on the build.prop settings.
-/As of 24.01.2014. i've added another zip file which contains x3ril.smali taken from P.A. port by dcos - i'd recommend using this one for 4.4.2 roms/
-as of 11.06.2014., I've added x3ril.smali (it's in omni-v1.rar) made by adam, which is based on omni's RIL but has eprj RIL recovery. if you're on 4.4.3 kitkat rom and have issues, i suggest you give this file a try first before others
B. What's needed?
First off, you'll need a few things:
- Android Multitool from http://forum.xda-developers.com/show....php?t=2326604
, many thanks to @Flextrick
- Read the linked topic - it's the instruction on how to use it, and in case you encounter any errors, that's the place to search for solutions
- Attached is a RAR with two files in it, X3RIL_old.smali and X3RIL_new.smali. You need only one of those - but more info about them will be in the other steps.
- Custom ROM you want to edit
- Common sense
- WinRAR & JAVA
C. How to change RIL?
1. First step is to open the .zip of your custom ROM you want to edit, and search for system/framework/telephony-common.jar
2. Extract it to AndroidMultitool/Files, and after extract is done, delete it from .zip
3. Open Android Multitool, under Decompiling select .jar, then select telephony-common.jar in AndroidMultitool/Files, click "decompile"
4. After you're done, check if there were any errors in the Log, in AndroidMultitool main window
5. Head over to AndroidMultitool/Decompiled_jar/telephony-common/com/android/internal/telephony and look for X3RIL.smali. This is CM's RIL implemented in custom roms, which we dont need anymore, so delete it
6. Now, you need to decide wether to use X3RIL_old.smali, which is RIL from EPRJ CM10.2 built on 20130813, or X3RIL_new.smali which is RIL from EPRJ CM10.2 built on 20131007. I'm using 20131007 atm, and it's working without issues
7. When you've decided, move it back into AndroidMultitool/Decompiled_jar/telephony-common/com/android/internal/telephony and rename it to X3RIL.smali
8. Back in AndroidMultitool, under Compilin, select jar, and for folder select AndroidMultitool/Decompiled_jar/telephony-common, press "compile", and check for errors in Log
9. Output should be classes.dex file under AndroidMultitool/Compiled_jar
10. Open telephony-common.jar in AndroidMultitool/Files with WinRar - you should see META-INF folder, with classes.dex file
11. Delete classes.dex file in WinRAR
12. Move classes.dex file from AndroidMultitool/Compiled_jar to telephony-common.jar opened in WinRAR
13. Paste telephony-common.jar into system/framework inside the custom rom .zip file
14. You now have modified ROM ready to flash on our device!
D. Thank You's
Thank you's go out to @kholk
for his RIL programming, @dcos
for first implementing EPRJ RIL into a rom (his P.A. unofficial port for our device) different than EPRJCM10.2, @Adam77Root
for his tutorial that I basically beutified and made sure is easier to understand & his modification of x3ril.smali from omni, @gerciolisz
for the tip about build.prop settings, @Flextrick
for his Multitool with neat GUI to extract .jar files, and all the other devs of p880 making our device worth every dime I've spent on it.