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

Commit 655335f3 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Fix silent redial operation"

parents a391ac33 8548e0a5
Loading
Loading
Loading
Loading
+36 −1
Original line number Diff line number Diff line
@@ -380,6 +380,8 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {

    private final RegistrantList mCellInfoRegistrants = new RegistrantList();

    private final RegistrantList mRedialRegistrants = new RegistrantList();

    protected Registrant mPostDialHandler;

    protected final LocalLog mLocalLog;
@@ -715,9 +717,17 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
                    String dialString = (String) ar.result;
                    if (TextUtils.isEmpty(dialString)) return;
                    try {
                        dialInternal(dialString, new DialArgs.Builder().build());
                        Connection cn = dialInternal(dialString, new DialArgs.Builder().build());
                        Rlog.d(LOG_TAG, "Notify redial connection changed cn: " + cn);
                        if (mImsPhone != null) {
                            // Don't care it is null or not.
                            mImsPhone.notifyRedialConnectionChanged(cn);
                        }
                    } catch (CallStateException e) {
                        Rlog.e(LOG_TAG, "silent redial failed: " + e);
                        if (mImsPhone != null) {
                            mImsPhone.notifyRedialConnectionChanged(null);
                        }
                    }
                }
                break;
@@ -912,6 +922,30 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
       mHandoverRegistrants.notifyRegistrants(ar);
    }

    /**
     * Notifies when a Handover happens due to Silent Redial
     */
    public void registerForRedialConnectionChanged(Handler h, int what, Object obj) {
        checkCorrectThread(h);
        mRedialRegistrants.addUnique(h, what, obj);
    }

    /**
     * Unregisters for redial connection notifications
     */
    public void unregisterForRedialConnectionChanged(Handler h) {
        mRedialRegistrants.remove(h);
    }

    /**
     * Subclasses of Phone probably want to replace this with a
     * version scoped to their packages
     */
    public void notifyRedialConnectionChanged(Connection cn) {
        AsyncResult ar = new AsyncResult(null, cn, null);
        mRedialRegistrants.notifyRegistrants(ar);
    }

    protected void setIsInEmergencyCall() {
    }

@@ -983,6 +1017,7 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        migrate(mUnknownConnectionRegistrants, from.mUnknownConnectionRegistrants);
        migrate(mSuppServiceFailedRegistrants, from.mSuppServiceFailedRegistrants);
        migrate(mCellInfoRegistrants, from.mCellInfoRegistrants);
        migrate(mRedialRegistrants, from.mRedialRegistrants);
        // The emergency state of IMS phone will be cleared in ImsPhone#notifySrvccState after
        // receive SRVCC completed
        if (from.isInEmergencyCall()) {
+2 −0
Original line number Diff line number Diff line
@@ -758,6 +758,8 @@ public class ImsPhone extends ImsPhoneBase {
                                    ResultReceiver wrappedCallback)
            throws CallStateException {

        mLastDialString = dialString;

        // Need to make sure dialString gets parsed properly
        String newDialString = PhoneNumberUtils.stripSeparators(dialString);

+16 −0
Original line number Diff line number Diff line
@@ -112,6 +112,9 @@ public class PhoneMock extends Phone {
    protected final RegistrantList mHandoverRegistrants
             = new RegistrantList();

    protected final RegistrantList mRedialRegistrants
            = new RegistrantList();

    protected final RegistrantList mNewRingingConnectionRegistrants
            = new RegistrantList();

@@ -223,6 +226,19 @@ public class PhoneMock extends Phone {
       mHandoverRegistrants.notifyRegistrants(ar);
    }

    public void registerForRedialConnectionChanged(Handler h, int what, Object obj) {
        mRedialRegistrants.addUnique(h, what, obj);
    }

    public void unregisterForRedialConnectionChanged(Handler h) {
        mRedialRegistrants.remove(h);
    }

    public void notifyRedialConnectionChanged(Connection cn) {
        AsyncResult ar = new AsyncResult(null, cn, null);
        mRedialRegistrants.notifyRegistrants(ar);
    }

    public void migrateFrom(Phone from) {
        throw new RuntimeException("not implemented");
    }