IMS conference merge improvements.
Tyler Gunn [Fri, 19 May 2017 22:07:32 +0000 (15:07 -0700)]
1. Re-map ended by conference merge to "IMS_MERGED_SUCCESSFULLY".
This later gets translated to Telecom disconnect cause "OTHER".
This is helpful to ensure the InCall UI is able to recognize that a call
ended because of the fact it is joining a conference.
2. Send connection event when starting to merge two calls; this way the
InCall UI can suppress transient states when merging.
Note: I purposely only send "merge complete" when merge fails; that way
when the calls disconnect naturally at the end of the merge, the incall ui
still knows they're in a "merging" state.

Test: Manual
Bug: 37581781
Change-Id: I22abfbae470c7e67b6e6309f58c958820a697609

src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java

index 828f4eb..83c2649 100644 (file)
@@ -1189,6 +1189,13 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
         ImsPhoneConnection foregroundConnection = mForegroundCall.getFirstConnection();
         if (foregroundConnection != null) {
             foregroundConnection.setConferenceConnectTime(conferenceConnectTime);
+            foregroundConnection.onConnectionEvent(android.telecom.Connection.EVENT_MERGE_START,
+                    null);
+        }
+        ImsPhoneConnection backgroundConnection = findConnection(bgImsCall);
+        if (backgroundConnection != null) {
+            backgroundConnection.onConnectionEvent(android.telecom.Connection.EVENT_MERGE_START,
+                    null);
         }
 
         try {
@@ -1720,9 +1727,11 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
                 return DisconnectCause.BUSY;
 
             case ImsReasonInfo.CODE_USER_TERMINATED:
-            case ImsReasonInfo.CODE_LOCAL_ENDED_BY_CONFERENCE_MERGE:
                 return DisconnectCause.LOCAL;
 
+            case ImsReasonInfo.CODE_LOCAL_ENDED_BY_CONFERENCE_MERGE:
+                return DisconnectCause.IMS_MERGED_SUCCESSFULLY;
+
             case ImsReasonInfo.CODE_LOCAL_CALL_DECLINE:
             case ImsReasonInfo.CODE_REMOTE_CALL_DECLINE:
                 // If the call has been declined locally (on this device), or on remotely (on
@@ -2293,6 +2302,7 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
             ImsPhoneConnection conn = findConnection(call);
             if (conn != null) {
                 conn.onConferenceMergeFailed();
+                conn.onConnectionEvent(android.telecom.Connection.EVENT_MERGE_COMPLETE, null);
             }
         }