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

Commit 0ef22ebd authored by Brad Ebinger's avatar Brad Ebinger Committed by Automerger Merge Worker
Browse files

Merge changes from topic "fix_ims_cs_redial" into sc-dev am: e11d07ac

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/15352250

Change-Id: I510b8b6bb843620f0600e10678126c1a0a8232a9
parents 9adfc0b8 e11d07ac
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -126,6 +126,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.function.Consumer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

@@ -1326,8 +1327,8 @@ public class GsmCdmaPhone extends Phone {
    }

    @Override
    public Connection dial(String dialString, @NonNull DialArgs dialArgs)
            throws CallStateException {
    public Connection dial(String dialString, @NonNull DialArgs dialArgs,
            Consumer<Phone> chosenPhoneConsumer) throws CallStateException {
        if (!isPhoneTypeGsm() && dialArgs.uusInfo != null) {
            throw new CallStateException("Sending UUS information NOT supported in CDMA!");
        }
@@ -1410,6 +1411,7 @@ public class GsmCdmaPhone extends Phone {
                || useImsForEmergency) {
            try {
                if (DBG) logd("Trying IMS PS call");
                chosenPhoneConsumer.accept(imsPhone);
                return imsPhone.dial(dialString, dialArgs);
            } catch (CallStateException e) {
                if (DBG) logd("IMS PS call exception " + e +
@@ -1466,6 +1468,7 @@ public class GsmCdmaPhone extends Phone {
            mCi.testingEmergencyCall();
        }

        chosenPhoneConsumer.accept(this);
        return dialInternal(dialString, dialArgs);
    }

+6 −0
Original line number Diff line number Diff line
@@ -737,6 +737,8 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
                break;

            case EVENT_INITIATE_SILENT_REDIAL:
                // This is an ImsPhone -> GsmCdmaPhone redial
                // See ImsPhone#initiateSilentRedial
                Rlog.d(LOG_TAG, "Event EVENT_INITIATE_SILENT_REDIAL Received");
                ar = (AsyncResult) msg.obj;
                if ((ar.exception == null) && (ar.result != null)) {
@@ -747,6 +749,10 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
                    if (TextUtils.isEmpty(dialString)) return;
                    try {
                        Connection cn = dialInternal(dialString, dialArgs);
                        // The ImsPhoneConnection that is owned by the ImsPhone is currently the
                        // one with a callback registered to TelephonyConnection. Notify the
                        // redial happened over that Phone so that it can be replaced with the
                        // new GSM/CDMA Connection.
                        Rlog.d(LOG_TAG, "Notify redial connection changed cn: " + cn);
                        if (mImsPhone != null) {
                            // Don't care it is null or not.
+23 −1
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import com.android.internal.telephony.PhoneConstants.DataState;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.List;
import java.util.function.Consumer;

/**
 * Internal interface used to control the phone; SDK developers cannot
@@ -489,12 +490,33 @@ public interface PhoneInternalInterface {
     *
     * @param dialString The dial string.
     * @param dialArgs Parameters to perform the dial with.
     * @param chosenPhone The Phone (either GsmCdmaPhone or ImsPhone) that has been chosen to dial
     *                    this number. This is used for any setup that should occur before dial
     *                    actually occurs.
     * @exception CallStateException if a new outgoing call is not currently
     *                possible because no more call slots exist or a call exists
     *                that is dialing, alerting, ringing, or waiting. Other
     *                errors are handled asynchronously.
     */
    Connection dial(String dialString, @NonNull DialArgs dialArgs) throws CallStateException;
    Connection dial(String dialString, @NonNull DialArgs dialArgs,
            Consumer<Phone> chosenPhone) throws CallStateException;

    /**
     * Initiate a new voice connection. This happens asynchronously, so you
     * cannot assume the audio path is connected (or a call index has been
     * assigned) until PhoneStateChanged notification has occurred.
     *
     * @param dialString The dial string.
     * @param dialArgs Parameters to perform the dial with.
     * @exception CallStateException if a new outgoing call is not currently
     *                possible because no more call slots exist or a call exists
     *                that is dialing, alerting, ringing, or waiting. Other
     *                errors are handled asynchronously.
     */
    default Connection dial(String dialString, @NonNull DialArgs dialArgs)
            throws CallStateException {
        return dial(dialString, dialArgs, (phone) -> {});
    }

    /**
     * Initiate a new conference connection. This happens asynchronously, so you
+8 −1
Original line number Diff line number Diff line
@@ -919,7 +919,9 @@ public class ImsPhone extends ImsPhoneBase {
    }

    @Override
    public Connection dial(String dialString, DialArgs dialArgs) throws CallStateException {
    public Connection dial(String dialString, DialArgs dialArgs,
            Consumer<Phone> chosenPhoneConsumer) throws CallStateException {
        chosenPhoneConsumer.accept(this);
        return dialInternal(dialString, dialArgs, null);
    }

@@ -1888,6 +1890,7 @@ public class ImsPhone extends ImsPhoneBase {
                }
                break;
            case EVENT_INITIATE_VOLTE_SILENT_REDIAL: {
                // This is a CS -> IMS redial
                if (VDBG) logd("EVENT_INITIATE_VOLTE_SILENT_REDIAL");
                ar = (AsyncResult) msg.obj;
                if (ar.exception == null && ar.result != null) {
@@ -1900,6 +1903,10 @@ public class ImsPhone extends ImsPhoneBase {
                    try {
                        Connection cn = dial(dialString,
                                updateDialArgsForVolteSilentRedial(dialArgs, causeCode));
                        // The GSM/CDMA Connection that is owned by the GsmCdmaPhone is currently
                        // the one with a callback registered to TelephonyConnection. Notify the
                        // redial happened over that Phone so that it can be replaced with the
                        // new ImsPhoneConnection.
                        Rlog.d(LOG_TAG, "Notify volte redial connection changed cn: " + cn);
                        if (mDefaultPhone != null) {
                            // don't care it is null or not.
+4 −1
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ import com.android.internal.telephony.PhoneNotifier;
import com.android.telephony.Rlog;

import java.text.ParseException;
import java.util.function.Consumer;
import java.util.regex.Pattern;

/**
@@ -192,7 +193,9 @@ public class SipPhone extends SipPhoneBase {
    }

    @Override
    public Connection dial(String dialString, DialArgs dialArgs) throws CallStateException {
    public Connection dial(String dialString, DialArgs dialArgs,
            Consumer<Phone> chosenPhoneConsumer) throws CallStateException {
        chosenPhoneConsumer.accept(this);
        synchronized (SipPhone.class) {
            return dialInternal(dialString, dialArgs.videoState);
        }