Merge "IMS: Dismiss ECT dialog on VT upgrade request" into atel.lnx.2.0-dev
diff --git a/InCallUI/src/com/android/incallui/InCallPresenter.java b/InCallUI/src/com/android/incallui/InCallPresenter.java
index 59c39a3..5a5d0cb 100644
--- a/InCallUI/src/com/android/incallui/InCallPresenter.java
+++ b/InCallUI/src/com/android/incallui/InCallPresenter.java
@@ -745,11 +745,7 @@
         maybeShowErrorDialogOnDisconnect(call);
 
         // Send broadcast to dismiss deflect dialog.
-        if (Objects.equals(call.getId(), QtiCallUtils.getDeflectOrTransferCallId())) {
-            Intent intent = new Intent(QtiCallUtils.INTENT_ACTION_DIALOG_DISMISS);
-            mInCallActivity.sendBroadcast(intent);
-            QtiCallUtils.setDeflectOrTransferCallId(null);
-        }
+        dismissDeflectOrTransferDialog(call.getId());
 
         // We need to do the run the same code as onCallListChange.
         onCallListChange(mCallList);
@@ -771,6 +767,8 @@
         if (call == null) {
             return;
         }
+        // Send broadcast to dismiss deflect dialog.
+        dismissDeflectOrTransferDialog(call.getId());
 
         wakeUpScreen();
         call.setRequestedVideoState(videoState);
@@ -782,6 +780,19 @@
     }
 
     /**
+     * Sends broadcast to dismiss Deflection or ECT dialog
+     */
+    private void dismissDeflectOrTransferDialog(String callId) {
+        Log.d(this, "dismissDeflectOrTransferDialog() callId = " + callId);
+        if (Objects.equals(callId, QtiCallUtils.getDeflectOrTransferCallId())) {
+            Intent intent = new Intent(QtiCallUtils.INTENT_ACTION_DIALOG_DISMISS);
+            mInCallActivity.sendBroadcast(intent);
+            QtiCallUtils.setDeflectOrTransferCallId(null);
+        }
+    }
+
+
+    /**
      * Given the call list, return the state in which the in-call screen should be.
      */
     public InCallState getPotentialStateFromCallList(CallList callList) {