resolved conflicts for merge of 74fb97de to master
Change-Id: Ia068e1e5f9f4995a84d5a184efa1cc76d0d159e4
diff --git a/src/com/android/phone/PhoneUtils.java b/src/com/android/phone/PhoneUtils.java
index 079f96e..e03171e 100644
--- a/src/com/android/phone/PhoneUtils.java
+++ b/src/com/android/phone/PhoneUtils.java
@@ -837,6 +837,33 @@
}
}
+ static void swap() {
+ final PhoneGlobals mApp = PhoneGlobals.getInstance();
+ if (!okToSwapCalls(mApp.mCM)) {
+ // TODO: throw an error instead?
+ return;
+ }
+
+ // Swap the fg and bg calls.
+ // In the future we may provide some way for user to choose among
+ // multiple background calls, for now, always act on the first background call.
+ PhoneUtils.switchHoldingAndActive(mApp.mCM.getFirstActiveBgCall());
+
+ // If we have a valid BluetoothPhoneService then since CDMA network or
+ // Telephony FW does not send us information on which caller got swapped
+ // we need to update the second call active state in BluetoothPhoneService internally
+ if (mApp.mCM.getBgPhone().getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA) {
+ final IBluetoothHeadsetPhone btPhone = mApp.getBluetoothPhoneService();
+ if (btPhone != null) {
+ try {
+ btPhone.cdmaSwapSecondCallState();
+ } catch (RemoteException e) {
+ Log.e(LOG_TAG, Log.getStackTraceString(new Throwable()));
+ }
+ }
+ }
+ }
+
/**
* @param heldCall is the background call want to be swapped
*/