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

Commit 74c8509a authored by Hanada Masafumi's avatar Hanada Masafumi Committed by Naoyuki Konda
Browse files

Include subaddress information for connection address

In case of outgoing call with subaddress, subaddress information is
neither displayed in InCallUI nor stored in call log. This modifies
to include subaddress information in those cases.

- Override getOrigDialString to get number which can include subaddress

Bug: 29087454
Change-Id: I45884d98a3832542a6991df13de74b80c5806bd6
parent 442a1aa2
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -230,6 +230,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
@@ -243,6 +243,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,
@@ -772,7 +777,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),
@@ -268,4 +268,29 @@ public class ImsPhoneConnectionTest extends TelephonyTest {
        //keep using the wifi state from extra, not update
        assertFalse(mConnectionUT.updateWifiState());
    }

    @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());
        }
    }
}