Merge "Auto downgrade video calls when phone account doesn't support video." into nyc-mr1-dev
diff --git a/src/com/android/server/telecom/CallsManager.java b/src/com/android/server/telecom/CallsManager.java
index a629e62..2367138 100644
--- a/src/com/android/server/telecom/CallsManager.java
+++ b/src/com/android/server/telecom/CallsManager.java
@@ -1398,12 +1398,21 @@
*/
void markCallAsRemoved(Call call) {
removeCall(call);
+ Call foregroundCall = mCallAudioManager.getPossiblyHeldForegroundCall();
if (mLocallyDisconnectingCalls.contains(call)) {
mLocallyDisconnectingCalls.remove(call);
- Call foregroundCall = mCallAudioManager.getPossiblyHeldForegroundCall();
if (foregroundCall != null && foregroundCall.getState() == CallState.ON_HOLD) {
foregroundCall.unhold();
}
+ } else if (foregroundCall != null &&
+ !foregroundCall.can(Connection.CAPABILITY_SUPPORT_HOLD) &&
+ foregroundCall.getState() == CallState.ON_HOLD) {
+
+ // The new foreground call is on hold, however the carrier does not display the hold
+ // button in the UI. Therefore, we need to auto unhold the held call since the user has
+ // no means of unholding it themselves.
+ Log.i(this, "Auto-unholding held foreground call (call doesn't support hold)");
+ foregroundCall.unhold();
}
}
@@ -1460,7 +1469,7 @@
mCallAudioManager.toggleMute();
return true;
} else {
- ringingCall.answer(ringingCall.getVideoState());
+ ringingCall.answer(VideoProfile.STATE_AUDIO_ONLY);
return true;
}
} else if (HeadsetMediaButton.LONG_PRESS == type) {
diff --git a/src/com/android/server/telecom/CreateConnectionProcessor.java b/src/com/android/server/telecom/CreateConnectionProcessor.java
index 91a2c84..22ec3c6 100644
--- a/src/com/android/server/telecom/CreateConnectionProcessor.java
+++ b/src/com/android/server/telecom/CreateConnectionProcessor.java
@@ -287,7 +287,6 @@
mPhoneAccountRegistrar.getSimCallManagerFromCall(mCall),
mAttemptRecords.get(0).targetPhoneAccount);
Log.v(this, "setConnectionManager, changing %s -> %s", mAttemptRecords.get(0), record);
- mAttemptRecords.clear();
mAttemptRecords.add(0, record);
} else {
Log.v(this, "setConnectionManager, not changing");