Jump to content

  1. 0
  2. 0
  3. 0/5

Rate this Topic

* * * * *
1 votes

[ProTip] Getting Data working on that Epic Port you just did

port data wifi
  • Please log in to reply

OP erishasnobattery

erishasnobattery

Developer

Posted 25 February 2012 - 07:38 AM #1

A lot of you probably don't know me if you never owned a Thunderbolt, but somewhere along the line, I got the reputation as the guy that can port anything. I don't know how much truth there is to that, but I did make CDMA/LTE, WiFi, and Bluetooth work on a device using a base from a device that was GSM with a completely different chipset (TI vs. Broadcom). I also managed to get everything working on MIUI using a similar approach. This isn't a "tutorial" per se, more of just a brain dump. I'm not going to tell you every step to get things going, as I don't think there is a right answer for every situation.

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
  • Binaries
    • Bluetooth (bluetoothd, etc)
    • Wifi (wpa_supplicant, netcfg, netd, etc)
    • RIL/Data (ril, rild, netmgrd, 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
  • lib - as with binaries, you'll need all the correct libraries for bluetooth, wifi, and the RIL to make it go.
This is by no means a complete list, and I don't think I could write one if my life depended on it. It takes a lot of trial and error with the libs and binaries to get it all going, so we're also going to assume you have the correct libs and binaries where they belong. If you're not sure on some of that, check the build.prop and init files in the ramdisk. It has some good indicators as to what files it is looking for.

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. :lol: I don't know why this gets overlooked so much. Maybe it's a lack of understanding or just a general fear of smali, but 90% of the work I did to get Sense 3.5 and MIUI working on the Bolt was in the framework. I highly recommend you get a copy of Beyond Compare if you're going to continue any further into 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
In system/app, make sure you replace Bluetooth.apk, and BrcmBluetoothServices.apk. You will also need to merge all the bluetooth classes inside Settings.apk and Phone.apk.

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
At this point, you will probably just have a huge mess of force closes if it even boots. The only real option is to use logcat and fix one error at a time. It's a terrible, awful, time-consuming process.

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. :P

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.

  • 7 Likes
Samsung Galaxy Nexus <-- HTC Rezound <-- HTC Thunderbolt

Like my Work? Donate

OP erishasnobattery

erishasnobattery

Developer

Posted 25 February 2012 - 09:01 AM #2

Reserved for Questions/Answers.
  • 1 Likes
Samsung Galaxy Nexus <-- HTC Rezound <-- HTC Thunderbolt

Like my Work? Donate

joelz9614

joelz9614

Developer

  • 389 posts

Posted 25 February 2012 - 09:32 AM #3

nice man :D
  • 0 Likes

Posted Image


Like my work? Donate

JM-G®@¶h!¢S

JM-G®@¶h!¢S

Dev In Training

Posted 25 February 2012 - 10:29 AM #4

Great Thread Eris! My only issue is that i have no idea what im looking at when i look at smali and java! If there are some good tutorials on that send them my way.
  • 0 Likes

 VZW-HTC ONE>iPhone 5>Galaxy SIII>Galaxy Nexus>Thunderbolt>iPhone>Tmobile Nexus One>G1
 


dmeadows013

dmeadows013

Semi AOKP Dev

Posted 28 February 2012 - 10:04 AM #5

Will this work on AOSP ports?
  • 0 Likes


Posted Image


dmeadows013

dmeadows013

Semi AOKP Dev

Posted 28 February 2012 - 03:25 PM #6

Me = Smali's bitch
  • 0 Likes


Posted Image


OP erishasnobattery

erishasnobattery

Developer

Posted 28 February 2012 - 08:04 PM #7

Yep. Same basic principles.

Sent using Morse code.
  • 0 Likes
Samsung Galaxy Nexus <-- HTC Rezound <-- HTC Thunderbolt

Like my Work? Donate

kidhudi

kidhudi

Android Lover

  • 182 posts

Posted 06 March 2012 - 01:55 PM #8

question... what's smali?
Just kiddin bro great instructional i am sure it will help somone out. thanks for taking the time to write.

Edited by kidhudi, 06 March 2012 - 01:55 PM.

  • 0 Likes

erickwill

erickwill

Android Beginner

  • 1 posts

Posted 11 March 2012 - 05:20 PM #9

Very nice topic! Please, go forward and give us more details! It's just awesome content. Thanks!
  • 0 Likes

heleos

heleos

Average Android

  • 1 posts

Posted 19 April 2012 - 01:32 PM #10

When you talk about merging all these smali files, do you actually mean merging like taking all the files and combining them into a single file?
  • 0 Likes