Only Redial calls in the case of Emergency Calling

Currently, if there are multiple Calling Accounts and a call fails, we
redial the call on another Calling Account. We should only redial if it
is an emergency call being placed and it has failed from Telephony with
an Error.

Bug: 29877938
Change-Id: I2efa9f7f06e9eed03799c1514a027cf73ea5b3ee
diff --git a/src/com/android/server/telecom/Call.java b/src/com/android/server/telecom/Call.java
index 1139cc5..b3e36f9 100644
--- a/src/com/android/server/telecom/Call.java
+++ b/src/com/android/server/telecom/Call.java
@@ -577,6 +577,11 @@
             return false;
         }
 
+        // Only Redial a Call in the case of it being an Emergency Call.
+        if(!isEmergencyCall()) {
+            return false;
+        }
+
         // Make sure that there are additional connection services to process.
         if (mCreateConnectionProcessor == null
             || !mCreateConnectionProcessor.isProcessingComplete()
diff --git a/src/com/android/server/telecom/CreateConnectionProcessor.java b/src/com/android/server/telecom/CreateConnectionProcessor.java
index 22ec3c6..91a2c84 100644
--- a/src/com/android/server/telecom/CreateConnectionProcessor.java
+++ b/src/com/android/server/telecom/CreateConnectionProcessor.java
@@ -287,6 +287,7 @@
                     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");