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

Commit edd41a1d authored by Brad Ebinger's avatar Brad Ebinger Committed by android-build-merger
Browse files

Merge "Include subaddress information for connection address"

am: 005d0cc7

Change-Id: I79a4626cea57291bf18ee4e7058aeab9807e8d16
parents ab92257b 005d0cc7
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -229,6 +229,11 @@ public class GsmCdmaConnection extends Connection {
        return (a == null) ? (b == null) : a.equals (b);
    }

    static boolean
    equalsBaseDialString (String a, String b) {
        return (a == null) ? (b == null) : (b != null && a.startsWith (b));
    }

    //CDMA
    /**
     * format original dial string
@@ -611,8 +616,8 @@ public class GsmCdmaConnection extends Connection {
            if (Phone.DEBUG_PHONE) log("update: mOrigConnection is not null");
        } else {
            log(" mNumberConverted " + mNumberConverted);
            if (!equalsHandlesNulls(mAddress, dc.number) && (!mNumberConverted
                    || !equalsHandlesNulls(mConvertedNumber, dc.number))) {
            if (!equalsBaseDialString(mAddress, dc.number) && (!mNumberConverted
                    || !equalsBaseDialString(mConvertedNumber, dc.number))) {
                if (Phone.DEBUG_PHONE) log("update: phone # changed!");
                mAddress = dc.number;
                changed = true;
+6 −1
Original line number Diff line number Diff line
@@ -234,6 +234,11 @@ public class ImsPhoneConnection extends Connection implements
        return (a == null) ? (b == null) : a.equals (b);
    }

    static boolean
    equalsBaseDialString (String a, String b) {
        return (a == null) ? (b == null) : (b != null && a.startsWith (b));
    }

    private static int applyLocalCallCapabilities(ImsCallProfile localProfile, int capabilities) {
        Rlog.w(LOG_TAG, "applyLocalCallCapabilities - localProfile = "+localProfile);
        capabilities = removeCapability(capabilities,
@@ -757,7 +762,7 @@ public class ImsPhoneConnection extends Connection implements
                Rlog.d(LOG_TAG, "address = " + Rlog.pii(LOG_TAG, address) + " name = " + name +
                        " nump = " + nump + " namep = " + namep);
            }
            if(equalsHandlesNulls(mAddress, address)) {
            if(!equalsBaseDialString(mAddress, address)) {
                mAddress = address;
                changed = true;
            }
+22 −0
Original line number Diff line number Diff line
@@ -190,4 +190,26 @@ public class GsmCdmaConnectionTest extends TelephonyTest {
        assertEquals(DisconnectCause.LOCAL, connection.getDisconnectCause());
        assertTrue(connection.getDisconnectTime() <= System.currentTimeMillis());
    }

    @Test @SmallTest
    public void testAddressUpdate() {
        String[] testAddressMappingSet[] = {
                /* {"0:inputAddress", "1:updateAddress", "2:ExpectResult"} */
                {"12345", "12345", "12345"},
                {"12345", "67890", "67890"},
                {"12345*00000", "12345", "12345*00000"},
                {"12345*00000", "67890", "67890"},
                {"12345*00000", "12345*00000", "12345*00000"},
                {"12345;11111*00000", "12345", "12345"},
                {"12345*00000;11111", "12345", "12345*00000"},
                {"18412345*00000", "18412345", "18412345*00000"},
                {"+8112345*00000", "+8112345", "+8112345*00000"}};
        mDC.state = DriverCall.State.ALERTING;
        for (String[] testAddress : testAddressMappingSet) {
            connection = new GsmCdmaConnection(mPhone, testAddress[0], mCT, null, false);
            mDC.number = testAddress[1];
            connection.update(mDC);
            assertEquals(testAddress[2], connection.getAddress());
        }
    }
}
+26 −1
Original line number Diff line number Diff line
@@ -133,7 +133,7 @@ public class ImsPhoneConnectionTest extends TelephonyTest {
        // MT background Connection dialing -> active
        mConnectionUT = new ImsPhoneConnection(mImsPhone, mImsCall, mImsCT, mBackGroundCall, false);
        doReturn(Call.State.HOLDING).when(mBackGroundCall).getState();
        assertTrue(mConnectionUT.update(mImsCall, Call.State.ACTIVE));
        assertFalse(mConnectionUT.update(mImsCall, Call.State.ACTIVE));
        verify(mBackGroundCall, times(1)).detach(eq(mConnectionUT));
        verify(mForeGroundCall, times(1)).attach(eq(mConnectionUT));
        verify(mForeGroundCall, times(1)).update(eq(mConnectionUT), eq(mImsCall),
@@ -264,4 +264,29 @@ public class ImsPhoneConnectionTest extends TelephonyTest {
        assertTrue(mConnectionUT.update(mImsCall, Call.State.ACTIVE));
        assertTrue(mConnectionUT.isWifi());
    }

    @Test
    @SmallTest
    public void testAddressUpdate() {
        String[] testAddressMappingSet[] = {
                /* {"inputAddress", "updateAddress", "ExpectResult"} */
                {"12345", "12345", "12345"},
                {"12345", "67890", "67890"},
                {"12345*00000", "12345", "12345*00000"},
                {"12345*00000", "67890", "67890"},
                {"12345*00000", "12345*00000", "12345*00000"},
                {"12345;11111*00000", "12345", "12345"},
                {"12345*00000;11111", "12345", "12345*00000"},
                {"18412345*00000", "18412345", "18412345*00000"},
                {"+8112345*00000", "+8112345", "+8112345*00000"},
                {"12345*00000", "12346", "12346"}};
        for (String[] testAddress : testAddressMappingSet) {
            mConnectionUT = new ImsPhoneConnection(mImsPhone, testAddress[0], mImsCT,
                    mForeGroundCall, false);
            doReturn(testAddress[1]).when(mImsCallProfile)
                    .getCallExtra(eq(ImsCallProfile.EXTRA_OI));
            mConnectionUT.updateAddressDisplay(mImsCall);
            assertEquals(testAddress[2], mConnectionUT.getAddress());
        }
    }
}