Merge "Support for third-party emergency calls." into lmp-dev
diff --git a/src/com/android/telecomm/CreateConnectionProcessor.java b/src/com/android/telecomm/CreateConnectionProcessor.java
index aacb80b..9e3b5ee 100644
--- a/src/com/android/telecomm/CreateConnectionProcessor.java
+++ b/src/com/android/telecomm/CreateConnectionProcessor.java
@@ -57,6 +57,24 @@
+ Objects.toString(connectionManagerPhoneAccount) + ","
+ Objects.toString(targetPhoneAccount) + ")";
}
+
+ /**
+ * Determines if this instance of {@code CallAttemptRecord} has the same underlying
+ * {@code PhoneAccountHandle}s as another instance.
+ *
+ * @param obj The other instance to compare against.
+ * @return {@code True} if the {@code CallAttemptRecord}s are equal.
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof CallAttemptRecord) {
+ CallAttemptRecord other = (CallAttemptRecord) obj;
+ return Objects.equals(connectionManagerPhoneAccount,
+ other.connectionManagerPhoneAccount) &&
+ Objects.equals(targetPhoneAccount, other.targetPhoneAccount);
+ }
+ return false;
+ }
}
private final Call mCall;
@@ -212,6 +230,7 @@
mAttemptRecords.clear();
List<PhoneAccountHandle> allAccountHandles = TelecommApp.getInstance()
.getPhoneAccountRegistrar().getOutgoingPhoneAccounts();
+ // First, add the PSTN phone account
for (int i = 0; i < allAccountHandles.size(); i++) {
if (TelephonyUtil.isPstnComponentName(
allAccountHandles.get(i).getComponentName())) {
@@ -222,6 +241,19 @@
allAccountHandles.get(i)));
}
}
+
+ // Next, add the connection manager account as a backup.
+ PhoneAccountHandle callManager = TelecommApp.getInstance()
+ .getPhoneAccountRegistrar().getSimCallManager();
+ CallAttemptRecord callAttemptRecord = new CallAttemptRecord(callManager,
+ TelecommApp.getInstance().getPhoneAccountRegistrar().
+ getDefaultOutgoingPhoneAccount());
+
+ if (callManager != null && !mAttemptRecords.contains(callAttemptRecord)) {
+ Log.i(this, "Will try Connection Manager account %s for emergency",
+ callManager);
+ mAttemptRecords.add(callAttemptRecord);
+ }
}
}