ThirdPartyPhone: DTMF & callerDisplayName plumbing DO NOT MERGE
Plumbing for callerDisplayName argument from TelephonyManager to
ThirdPartyPhone.
Also fixes issues with DTMF.
Change-Id: If1484a5196485cbcd098f863765bf579d0a3d6bf
diff --git a/src/com/android/phone/CallNotifier.java b/src/com/android/phone/CallNotifier.java
index 80807a2..6094467 100644
--- a/src/com/android/phone/CallNotifier.java
+++ b/src/com/android/phone/CallNotifier.java
@@ -763,11 +763,12 @@
}
}
- if ((fgPhone.getPhoneType() == PhoneConstants.PHONE_TYPE_GSM)
- || (fgPhone.getPhoneType() == PhoneConstants.PHONE_TYPE_SIP)) {
+ if (fgPhone.getPhoneType() == PhoneConstants.PHONE_TYPE_GSM
+ || fgPhone.getPhoneType() == PhoneConstants.PHONE_TYPE_SIP
+ || fgPhone.getPhoneType() == PhoneConstants.PHONE_TYPE_THIRD_PARTY) {
Call.State callState = mCM.getActiveFgCallState();
if (!callState.isDialing()) {
- // If call get activated or disconnected before the ringback
+ // If call gets activated or disconnected before the ringback
// tone stops, we have to stop it to prevent disturbing.
if (mInCallRingbackTonePlayer != null) {
mInCallRingbackTonePlayer.stopTone();
@@ -1274,8 +1275,9 @@
toneType = ToneGenerator.TONE_CDMA_NETWORK_BUSY_ONE_SHOT;
toneVolume = TONE_RELATIVE_VOLUME_LOPRI;
toneLengthMillis = 1000;
- } else if ((phoneType == PhoneConstants.PHONE_TYPE_GSM)
- || (phoneType == PhoneConstants.PHONE_TYPE_SIP)) {
+ } else if (phoneType == PhoneConstants.PHONE_TYPE_GSM
+ || phoneType == PhoneConstants.PHONE_TYPE_SIP
+ || phoneType == PhoneConstants.PHONE_TYPE_THIRD_PARTY) {
toneType = ToneGenerator.TONE_SUP_BUSY;
toneVolume = TONE_RELATIVE_VOLUME_HIPRI;
toneLengthMillis = 4000;
diff --git a/src/com/android/phone/DTMFTonePlayer.java b/src/com/android/phone/DTMFTonePlayer.java
index b8adaf1..2b04415 100644
--- a/src/com/android/phone/DTMFTonePlayer.java
+++ b/src/com/android/phone/DTMFTonePlayer.java
@@ -365,7 +365,9 @@
*/
private static boolean useShortDtmfTones(Phone phone, Context context) {
int phoneType = phone.getPhoneType();
- if (phoneType == PhoneConstants.PHONE_TYPE_GSM) {
+ if (phoneType == PhoneConstants.PHONE_TYPE_GSM
+ || phoneType == PhoneConstants.PHONE_TYPE_SIP
+ || phoneType == PhoneConstants.PHONE_TYPE_THIRD_PARTY) {
return false;
} else if (phoneType == PhoneConstants.PHONE_TYPE_CDMA) {
int toneType = android.provider.Settings.System.getInt(
@@ -377,8 +379,6 @@
} else {
return false;
}
- } else if (phoneType == PhoneConstants.PHONE_TYPE_SIP) {
- return false;
} else {
throw new IllegalStateException("Unexpected phone type: " + phoneType);
}
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 05b2308..9ad47ac 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -38,7 +38,6 @@
import android.telephony.ServiceState;
import android.text.TextUtils;
import android.util.Log;
-import android.util.Pair;
import com.android.internal.telephony.DefaultPhoneNotifier;
import com.android.internal.telephony.IccCard;
@@ -95,6 +94,19 @@
}
}
+ private static final class IncomingThirdPartyCallArgs {
+ public final ComponentName component;
+ public final String callId;
+ public final String callerDisplayName;
+
+ public IncomingThirdPartyCallArgs(ComponentName component, String callId,
+ String callerDisplayName) {
+ this.component = component;
+ this.callId = callId;
+ this.callerDisplayName = callerDisplayName;
+ }
+ }
+
/**
* A handler that processes messages on the main thread in the phone process. Since many
* of the Phone calls are not thread safe this is needed to shuttle the requests from the
@@ -178,11 +190,10 @@
break;
case CMD_NEW_INCOMING_THIRD_PARTY_CALL: {
request = (MainThreadRequest) msg.obj;
- Pair<ComponentName, String> pair =
- (Pair<ComponentName, String>) request.argument;
+ IncomingThirdPartyCallArgs args = (IncomingThirdPartyCallArgs) request.argument;
ThirdPartyPhone thirdPartyPhone = (ThirdPartyPhone)
- PhoneUtils.getThirdPartyPhoneFromComponent(mCM, pair.first);
- thirdPartyPhone.takeIncomingCall(pair.first, pair.second);
+ PhoneUtils.getThirdPartyPhoneFromComponent(mCM, args.component);
+ thirdPartyPhone.takeIncomingCall(args.callId, args.callerDisplayName);
break;
}
@@ -756,13 +767,15 @@
}
@Override
- public void newIncomingThirdPartyCall(ComponentName component, String callId) {
+ public void newIncomingThirdPartyCall(ComponentName component, String callId,
+ String callerDisplayName) {
// TODO(sail): Enforce that the component belongs to the calling package.
if (DBG) {
log("newIncomingThirdPartyCall: component: " + component + " callId: " + callId);
}
enforceCallPermission();
- sendRequestAsync(CMD_NEW_INCOMING_THIRD_PARTY_CALL, Pair.create(component, callId));
+ sendRequestAsync(CMD_NEW_INCOMING_THIRD_PARTY_CALL, new IncomingThirdPartyCallArgs(
+ component, callId, callerDisplayName));
}
//