Set CDMA calls as on-hold if there is a dialing CDMA call.
Bug:17699262
Change-Id: I251e59b1f15b5e2d9a6b2929ec1fcaba3d9f4101
diff --git a/src/com/android/services/telephony/CdmaConferenceController.java b/src/com/android/services/telephony/CdmaConferenceController.java
index ab126ca..d0cf6de 100644
--- a/src/com/android/services/telephony/CdmaConferenceController.java
+++ b/src/com/android/services/telephony/CdmaConferenceController.java
@@ -89,15 +89,27 @@
void add(final CdmaConnection connection) {
if (!mCdmaConnections.isEmpty() && connection.isOutgoing()) {
- connection.forceAsDialing(true);
// There already exists a connection, so this will probably result in a conference once
- // it is added. For connections which are added while another connection exists, we
- // mark them as "dialing" for set amount of time to give the user time to see their
- // new call as "Dialing" before it turns into a conference call.
+ // it is added. For outgoing connections which are added while another connection
+ // exists, we mark them as "dialing" for a set amount of time to give the user time to
+ // see their new call as "Dialing" before it turns into a conference call.
+ // During that time, we also mark the other calls as "held" or else it can cause issues
+ // due to having an ACTIVE and a DIALING call simultaneously.
+ connection.forceAsDialing(true);
+ final List<CdmaConnection> connectionsToReset =
+ new ArrayList<>(mCdmaConnections.size());
+ for (CdmaConnection current : mCdmaConnections) {
+ if (current.setHoldingForConference()) {
+ connectionsToReset.add(current);
+ }
+ }
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
connection.forceAsDialing(false);
+ for (CdmaConnection current : connectionsToReset) {
+ current.resetStateForConference();
+ }
addInternal(connection);
}
}, ADD_OUTGOING_CONNECTION_DELAY_MILLIS);
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index 9394b94..20df3e6 100644
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -655,6 +655,22 @@
return mAudioQuality;
}
+ void resetStateForConference() {
+ if (getState() == Connection.STATE_HOLDING) {
+ if (mOriginalConnection.getState() == Call.State.ACTIVE) {
+ setActive();
+ }
+ }
+ }
+
+ boolean setHoldingForConference() {
+ if (getState() == Connection.STATE_ACTIVE) {
+ setOnHold();
+ return true;
+ }
+ return false;
+ }
+
private static Uri getAddressFromNumber(String number) {
// Address can be null for blocked calls.
if (number == null) {