[Galaxy Tab 10.1v Android Development] lavender.t:
got a GT-P7510 last week which is WiFi-only. my first thought was why can't i make free phone calls out from Google Voice. it turned out to be quite a daunting task. if you happened to have tried installing GV from either market or a custom-made apk for Xoom (see thread: http://xdaforums.com/showthread.php?t=984111), then you'd have an idea what i'm talking about. even with a working GV on my phone, if i pull out the SIM and connect Wifi, when calling out with GV it complains that "Mobile network not available" regardless that the internet is perfectly connected!! WTF!

with the help of seo from another thread i'm now able to get a little further into this quest. if you also need a bit help decompiling and recompiling jar/apks, and updating core apps and resources, please refer to these 2 posts:

http://xdaforums.com/showpost.php?p=20392590&postcount=82

http://xdaforums.com/showpost.php?p=20439914&postcount=84

basically at this time i'm focused on Phone.apk and telephony under framework.jar. the following is what i have discovered so far.

1. update "framework-res.apk", under res/values/bools.xml, set the following values to true:

<bool name="config_voice_capable">true</bool>
<bool name="config_built_in_sip_phone">true</bool>

after this step, the phone app shows up and contacts app now allows to invoke the phone when a phone number is pressed. however, instead of showing up the in-call UI, it crashes the phone app. also, the phone app does not show the dialpad. it goes directly into contacts.

2. i investigated the crash and found it was because of PhoneUtils.okToAddCall() checking the phone type, which returned NONE and got it freaked out. digging deeper, i realized that com.android.phone registered a default phone as a faked GSMPhone. the code is under frameworks/base/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java. instead of setting the phone type to PHONE_TYPE_GSM, it uses PHONE_TYPE_NONE ! i dont have HC source code to refer to but i doubt this was the original coding from google. it appears to me that samsung might have modified the code to block off all phone accesses.

in smali i updated both getPhoneType() method and the ctor where setPhoneType() was called to apply PHONE_TYPE_GSM. now it doesnt crash anymore. however, instead of dialing out, now i'm seeing "Mobile network not available" message instead.

3. to prevent the GSM network check from kicking in, i then modified smali/com/android/phone/InCallScreen.smali in Phone.apk. in method checkIfOkToInitiateOutgoingCall(), update the switch jump-table to return InCallInitStatus.SUCCESS on OUT_OF_SERVICE. the change is shown in the following:

.line 2740
:pswitch_data_0
.packed-switch 0x0
:pswitch_0
:pswitch_3 ==> :pswitch_0
:pswitch_2
:pswitch_1
.end packed-switch

after this change, the error message doesnt show up any more.

but at this time, the call didnt really happen. another null-pointer exception was thrown from GsmCallTracker.smali when handling EVENT_GET_LAST_CALL_FAIL_CAUSE message. at the code:

.line 1083
.local v3, conn:Lcom/android/internal/telephony/gsm/GsmConnection;
invoke-static {}, Lcom/android/internal/telephony/NonstaticTelephonyFeature;->getInstance()Ljava/util/Map;
move-result-object v7
# <<<< if-eqz v7, :cond_e8
const-string v8, "CONFIG_FULL_DISCONNECT_CAUSE"
invoke-interface {v7, v8}, Ljava/util/Map;->containsKey(Ljava/lang/Object;)Z

apparently it did check the return value of NonstaticTelephonyFeature().getInstance(). adding the check "if-eqz v7, :cond_e8" as shown above shields off the FC.

this also revealed another problem: looks like the underlying GSM state machine returned an error so the call cound not continue. it is very interesting to see that GV actually plugs itself here and there very intimately into the innerworks of the GSM phone, maybe even piggyback on the GSM state machine while making the call.

this is where i am now before i put it down a bit. will come back for more when i have some spare time.

- lt