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

Commit 302cf59b authored by Tyler Gunn's avatar Tyler Gunn Committed by android-build-merger
Browse files

Merge "Ignore phone number changes for outgoing calls." into oc-dr1-dev

am: adcd5e55

Change-Id: Ifda47a24937736ac1b78c14d0179146e0d85e247
parents feb433ad adcd5e55
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -387,6 +387,15 @@ public abstract class Connection {
        return mIsIncoming;
    }

    /**
     * Sets whether this call is an incoming call or not.
     * @param isIncoming {@code true} if the call is an incoming call, {@code false} if it is an
     *                               outgoing call.
     */
    public void setIsIncoming(boolean isIncoming) {
        mIsIncoming = isIncoming;
    }

    /**
     * If this Connection is connected, then it is associated with
     * a Call.
+1 −2
Original line number Diff line number Diff line
@@ -614,8 +614,7 @@ public class GsmCdmaConnection extends Connection {
        //Ignore dc.number and dc.name in case of a handover connection
        if (isPhoneTypeGsm() && mOrigConnection != null) {
            if (Phone.DEBUG_PHONE) log("update: mOrigConnection is not null");
        } else {
            log(" mNumberConverted " + mNumberConverted);
        } else if (isIncoming()) {
            if (!equalsBaseDialString(mAddress, dc.number) && (!mNumberConverted
                    || !equalsBaseDialString(mConvertedNumber, dc.number))) {
                if (Phone.DEBUG_PHONE) log("update: phone # changed!");
+0 −9
Original line number Diff line number Diff line
@@ -236,15 +236,6 @@ public class ImsPhoneConnection extends Connection implements
    public void dispose() {
    }

    /**
     * Sets whether this call is an incoming call or not.
     * @param isIncoming {@code true} if the call is an incoming call, {@code false} if it is an
     *                               outgoing call.
     */
    public void setIsIncoming(boolean isIncoming) {
        mIsIncoming = isIncoming;
    }

    static boolean
    equalsHandlesNulls (Object a, Object b) {
        return (a == null) ? (b == null) : a.equals (b);
+14 −0
Original line number Diff line number Diff line
@@ -207,9 +207,23 @@ public class GsmCdmaConnectionTest extends TelephonyTest {
        mDC.state = DriverCall.State.ALERTING;
        for (String[] testAddress : testAddressMappingSet) {
            connection = new GsmCdmaConnection(mPhone, testAddress[0], mCT, null, false);
            connection.setIsIncoming(true);
            mDC.number = testAddress[1];
            connection.update(mDC);
            assertEquals(testAddress[2], connection.getAddress());
        }
    }

    /**
     * Ensures outgoing calls do not apply address changes.
     */
    @Test @SmallTest
    public void testAddressUpdateOutgoing() {
        mDC.state = DriverCall.State.ALERTING;
        connection = new GsmCdmaConnection(mPhone, "12345", mCT, null, false);
        connection.setIsIncoming(false);
        mDC.number = "678";
        connection.update(mDC);
        assertEquals("12345", connection.getAddress());
    }
}