Anyway, since the recent release of the Sense 4.0/ICS leaks, I've started getting PMs from everyone and their brother again about how I made these things work. While I don't mind the questions, I figure it's easier to just dump it all in one post rather than type it out 50 times to 50 different people and maybe help some folks who don't know me as well.
I'm going to do this working under the assumption you have some clue what you're doing. If you don't know smali, java, and how to read a logcat, you better just stop reading now. This will be geared more towards Sense based ROMs, but the same principles can be applied to AOSP and other vendor software as well, just keep in mind the files may be in different places. I'm also going to assume that at this point you have a booting ROM that is at least usable. If you don't, there are dozens of guides on porting floating around the interwebs.
On to the good stuff...
First, lets see what we're going to be dealing with.
- build.prop
- APKs
- Bluetooth.apk
- BrcmBluetoothServices.apk (Where applicable)
- EPST.apk (for CDMA devices)
- CdmaMccProvider.apk (sometimes)
- Mms.apk (sometimes)
- Phone.apk
- Settings.apk
- Stk.apk (SIM Toolkit)
- TelephonyProvider.apk
- Bluetooth.apk
- Binaries
- Bluetooth (bluetoothd, etc)
- Wifi (wpa_supplicant, netcfg, netd, etc)
- RIL/Data (ril, rild, netmgrd, etc)
- Bluetooth (bluetoothd, etc)
- etc - This mostly contains configuration files specific to your libs and binaries, so make sure they all match up
- Framework
- framework-res.apk
- framework.jar
- services.jar
- framework-res.apk
- lib - as with binaries, you'll need all the correct libraries for bluetooth, wifi, and the RIL to make it go.
Alright, so at this point, we have a booting ROM, and everything seems to be working, but one (or all three) of the big three (bluetooth, wifi, Data) isn't working. You've tried everything. You've moved binaries, apks, and libs around and changed every line in the build.prop and init files that you can think of and still it's not hooking up for you.
Time to play in the framework.
Bluetooth:
Bluetooth is really only a problem when the donor ROM has a different bluetooth chipset than the one you're porting too. ie. TI vs. Broadcom. We'll assume you have all the binaries, libs, and config files from etc moved over, as the file names are all basically the same.
Decompile your services.jar first. You'll need to move over the folders for ti and broadcom from your device. Generally, you can just move them with no changes, but you should always take a look first.
Now open up framework.jar. You're going to need to merge the following locations:
- android/bluetooth
- android/server/*bluetooth
- com/broadcom
At this point, it's just going to take some fancy logcatting to track down any remaining errors and get them fixed through merging things in smali. Look for "dead code" exceptions to help you find missing classes and methods.
Wifi:
Like bluetooth, wifi isn't usually too big of an issue unless the chipsets are different.
In services.jar, open android/server and merge over the WifiService and WifiWatchDog classes.
In framework.jar navigate to android/net/wifi and merge those classes.
One catch, with some devices, is that you'll overlook the calibration file in /etc. Make sure it's there if you need it.
Data:
This is the fun one. If this is an HTC Device, running Sense 3+, the first place to look is framework.jar\com\android\internal\telephony\HtcBuildUtils.smali. This file contains a bunch of true/false flags for available features. There is the off chance you can just flip some of these switches and get things working. The best chances of this working would be on a device that has a GSM and CDMA version like the EVO 3D. Don't get your hopes up though. :)
Let's assume that didn't work and move on to the painful stuff.
Decompile services.jar. You're going to need to merge ConnectivityService, TelephonyRegistry, and everything in the Connectivity folder.
Now open up framework.jar. There is a LOT of stuff to merge here, and it's going to cause a lot of errors that will need to be found in logcat and fixed.
- android/net - the ConnectivityManager classes and interfaces as well as all the NetworkStateTrackers.
- android/telephony
- com/android/internal/telephony
Once you get it booting again, and clear up most of the errors, you'll need to get Phone.apk, Settings.apk, MMS.apk and TelephonyProvider.apk talking to the framework again by merging the relevant classes over.
Follow-up:
Again, this is not the be-all-end-all definitive guide on how to do this, but just a breakdown of what I did. Hopefully it will help some of you and also reduce my PM count in the process.
I'll have a second post, where I can answer any questions that may arise. Feel free to post any issues you encounter, and I'll do my best to help you through them.
Edited by erishasnobattery, 25 February 2012 - 09:04 AM.







