Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cac5b2ca authored by Tyler Gunn's avatar Tyler Gunn Committed by Android (Google) Code Review
Browse files

Merge "Support for third-party emergency calls." into lmp-dev

parents 64ac4b79 6e6f6d1f
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
@@ -57,6 +57,24 @@ final class CreateConnectionProcessor {
                    + 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 @@ final class CreateConnectionProcessor {
            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 @@ final class CreateConnectionProcessor {
                                    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);
            }
        }
    }