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

Commit 005d0cc7 authored by Brad Ebinger's avatar Brad Ebinger Committed by Gerrit Code Review
Browse files

Merge "Include subaddress information for connection address"

parents 6cfb61b2 74c8509a
Loading
Loading
Loading
Loading
+7 −2
Original line number Original line Diff line number Diff line
@@ -229,6 +229,11 @@ public class GsmCdmaConnection extends Connection {
        return (a == null) ? (b == null) : a.equals (b);
        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
    //CDMA
    /**
    /**
     * format original dial string
     * format original dial string
@@ -610,8 +615,8 @@ public class GsmCdmaConnection extends Connection {
            if (Phone.DEBUG_PHONE) log("update: mOrigConnection is not null");
            if (Phone.DEBUG_PHONE) log("update: mOrigConnection is not null");
        } else {
        } else {
            log(" mNumberConverted " + mNumberConverted);
            log(" mNumberConverted " + mNumberConverted);
            if (!equalsHandlesNulls(mAddress, dc.number) && (!mNumberConverted
            if (!equalsBaseDialString(mAddress, dc.number) && (!mNumberConverted
                    || !equalsHandlesNulls(mConvertedNumber, dc.number))) {
                    || !equalsBaseDialString(mConvertedNumber, dc.number))) {
                if (Phone.DEBUG_PHONE) log("update: phone # changed!");
                if (Phone.DEBUG_PHONE) log("update: phone # changed!");
                mAddress = dc.number;
                mAddress = dc.number;
                changed = true;
                changed = true;
+6 −1
Original line number Original line Diff line number Diff line
@@ -244,6 +244,11 @@ public class ImsPhoneConnection extends Connection implements
        return (a == null) ? (b == null) : a.equals (b);
        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) {
    private static int applyLocalCallCapabilities(ImsCallProfile localProfile, int capabilities) {
        Rlog.w(LOG_TAG, "applyLocalCallCapabilities - localProfile = "+localProfile);
        Rlog.w(LOG_TAG, "applyLocalCallCapabilities - localProfile = "+localProfile);
        capabilities = removeCapability(capabilities,
        capabilities = removeCapability(capabilities,
@@ -769,7 +774,7 @@ public class ImsPhoneConnection extends Connection implements
                Rlog.d(LOG_TAG, "address = " + Rlog.pii(LOG_TAG, address) + " name = " + name +
                Rlog.d(LOG_TAG, "address = " + Rlog.pii(LOG_TAG, address) + " name = " + name +
                        " nump = " + nump + " namep = " + namep);
                        " nump = " + nump + " namep = " + namep);
            }
            }
            if(equalsHandlesNulls(mAddress, address)) {
            if(!equalsBaseDialString(mAddress, address)) {
                mAddress = address;
                mAddress = address;
                changed = true;
                changed = true;
            }
            }
+22 −0
Original line number Original line Diff line number Diff line
@@ -190,4 +190,26 @@ public class GsmCdmaConnectionTest extends TelephonyTest {
        assertEquals(DisconnectCause.LOCAL, connection.getDisconnectCause());
        assertEquals(DisconnectCause.LOCAL, connection.getDisconnectCause());
        assertTrue(connection.getDisconnectTime() <= System.currentTimeMillis());
        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 Original line Diff line number Diff line
@@ -133,7 +133,7 @@ public class ImsPhoneConnectionTest extends TelephonyTest {
        // MT background Connection dialing -> active
        // MT background Connection dialing -> active
        mConnectionUT = new ImsPhoneConnection(mImsPhone, mImsCall, mImsCT, mBackGroundCall, false);
        mConnectionUT = new ImsPhoneConnection(mImsPhone, mImsCall, mImsCT, mBackGroundCall, false);
        doReturn(Call.State.HOLDING).when(mBackGroundCall).getState();
        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(mBackGroundCall, times(1)).detach(eq(mConnectionUT));
        verify(mForeGroundCall, times(1)).attach(eq(mConnectionUT));
        verify(mForeGroundCall, times(1)).attach(eq(mConnectionUT));
        verify(mForeGroundCall, times(1)).update(eq(mConnectionUT), eq(mImsCall),
        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
        //keep using the wifi state from extra, not update
        assertFalse(mConnectionUT.updateWifiState());
        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());
        }
    }
}
}