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

Commit 68613495 authored by sung_jae's avatar sung_jae Committed by android-build-merger
Browse files

Merge "Fix silent redial operation" am: 655335f3 am: b260e89d am: ef8ef136

am: 69cc1342

Change-Id: I2a9c65baf3c44bbf201d8204e7c663813b20b951
parents 2e9f75cd 69cc1342
Loading
Loading
Loading
Loading
+36 −1
Original line number Diff line number Diff line
@@ -378,6 +378,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;
@@ -695,9 +697,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;
@@ -892,6 +902,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() {
    }

@@ -963,6 +997,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
@@ -113,6 +113,9 @@ public class PhoneMock extends Phone {
    protected final RegistrantList mHandoverRegistrants
             = new RegistrantList();

    protected final RegistrantList mRedialRegistrants
            = new RegistrantList();

    protected final RegistrantList mNewRingingConnectionRegistrants
            = new RegistrantList();

@@ -224,6 +227,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");
    }