Loading src/java/com/android/internal/telephony/imsphone/ImsPhoneConnection.java +16 −3 Original line number Diff line number Diff line Loading @@ -236,6 +236,15 @@ 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); Loading Loading @@ -757,7 +766,10 @@ public class ImsPhoneConnection extends Connection implements boolean changed = false; ImsCallProfile callProfile = imsCall.getCallProfile(); if (callProfile != null) { if (callProfile != null && isIncoming()) { // Only look for changes to the address for incoming calls. The originating identity // can change for outgoing calls due to, for example, a call being forwarded to // voicemail. This address change does not need to be presented to the user. String address = callProfile.getCallExtra(ImsCallProfile.EXTRA_OI); String name = callProfile.getCallExtra(ImsCallProfile.EXTRA_CNA); int nump = ImsCallProfile.OIRToPresentation( Loading @@ -765,8 +777,9 @@ public class ImsPhoneConnection extends Connection implements int namep = ImsCallProfile.OIRToPresentation( callProfile.getCallExtraInt(ImsCallProfile.EXTRA_CNAP)); if (Phone.DEBUG_PHONE) { Rlog.d(LOG_TAG, "callId = " + getTelecomCallId() + " address = " + Rlog.pii(LOG_TAG, address) + " name = " + name + " nump = " + nump + " namep = " + namep); Rlog.d(LOG_TAG, "updateAddressDisplay: callId = " + getTelecomCallId() + " address = " + Rlog.pii(LOG_TAG, address) + " name = " + name + " nump = " + nump + " namep = " + namep); } if (!mIsMergeInProcess) { // Only process changes to the name and address when a merge is not in process. Loading tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsPhoneConnectionTest.java +22 −0 Original line number Diff line number Diff line Loading @@ -265,6 +265,9 @@ public class ImsPhoneConnectionTest extends TelephonyTest { assertTrue(mConnectionUT.isWifi()); } /** * Test updates to address for incoming calls. */ @Test @SmallTest public void testAddressUpdate() { Loading @@ -283,10 +286,29 @@ public class ImsPhoneConnectionTest extends TelephonyTest { for (String[] testAddress : testAddressMappingSet) { mConnectionUT = new ImsPhoneConnection(mImsPhone, testAddress[0], mImsCT, mForeGroundCall, false); mConnectionUT.setIsIncoming(true); doReturn(testAddress[1]).when(mImsCallProfile) .getCallExtra(eq(ImsCallProfile.EXTRA_OI)); mConnectionUT.updateAddressDisplay(mImsCall); assertEquals(testAddress[2], mConnectionUT.getAddress()); } } /** * Ensure updates to the address for outgoing calls are ignored. */ @Test @SmallTest public void testSetAddressOnOutgoing() { String inputAddress = "12345"; String updateAddress = "6789"; mConnectionUT = new ImsPhoneConnection(mImsPhone, inputAddress, mImsCT, mForeGroundCall, false); mConnectionUT.setIsIncoming(false); doReturn(updateAddress).when(mImsCallProfile) .getCallExtra(eq(ImsCallProfile.EXTRA_OI)); mConnectionUT.updateAddressDisplay(mImsCall); assertEquals(inputAddress, mConnectionUT.getAddress()); } } Loading
src/java/com/android/internal/telephony/imsphone/ImsPhoneConnection.java +16 −3 Original line number Diff line number Diff line Loading @@ -236,6 +236,15 @@ 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); Loading Loading @@ -757,7 +766,10 @@ public class ImsPhoneConnection extends Connection implements boolean changed = false; ImsCallProfile callProfile = imsCall.getCallProfile(); if (callProfile != null) { if (callProfile != null && isIncoming()) { // Only look for changes to the address for incoming calls. The originating identity // can change for outgoing calls due to, for example, a call being forwarded to // voicemail. This address change does not need to be presented to the user. String address = callProfile.getCallExtra(ImsCallProfile.EXTRA_OI); String name = callProfile.getCallExtra(ImsCallProfile.EXTRA_CNA); int nump = ImsCallProfile.OIRToPresentation( Loading @@ -765,8 +777,9 @@ public class ImsPhoneConnection extends Connection implements int namep = ImsCallProfile.OIRToPresentation( callProfile.getCallExtraInt(ImsCallProfile.EXTRA_CNAP)); if (Phone.DEBUG_PHONE) { Rlog.d(LOG_TAG, "callId = " + getTelecomCallId() + " address = " + Rlog.pii(LOG_TAG, address) + " name = " + name + " nump = " + nump + " namep = " + namep); Rlog.d(LOG_TAG, "updateAddressDisplay: callId = " + getTelecomCallId() + " address = " + Rlog.pii(LOG_TAG, address) + " name = " + name + " nump = " + nump + " namep = " + namep); } if (!mIsMergeInProcess) { // Only process changes to the name and address when a merge is not in process. Loading
tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsPhoneConnectionTest.java +22 −0 Original line number Diff line number Diff line Loading @@ -265,6 +265,9 @@ public class ImsPhoneConnectionTest extends TelephonyTest { assertTrue(mConnectionUT.isWifi()); } /** * Test updates to address for incoming calls. */ @Test @SmallTest public void testAddressUpdate() { Loading @@ -283,10 +286,29 @@ public class ImsPhoneConnectionTest extends TelephonyTest { for (String[] testAddress : testAddressMappingSet) { mConnectionUT = new ImsPhoneConnection(mImsPhone, testAddress[0], mImsCT, mForeGroundCall, false); mConnectionUT.setIsIncoming(true); doReturn(testAddress[1]).when(mImsCallProfile) .getCallExtra(eq(ImsCallProfile.EXTRA_OI)); mConnectionUT.updateAddressDisplay(mImsCall); assertEquals(testAddress[2], mConnectionUT.getAddress()); } } /** * Ensure updates to the address for outgoing calls are ignored. */ @Test @SmallTest public void testSetAddressOnOutgoing() { String inputAddress = "12345"; String updateAddress = "6789"; mConnectionUT = new ImsPhoneConnection(mImsPhone, inputAddress, mImsCT, mForeGroundCall, false); mConnectionUT.setIsIncoming(false); doReturn(updateAddress).when(mImsCallProfile) .getCallExtra(eq(ImsCallProfile.EXTRA_OI)); mConnectionUT.updateAddressDisplay(mImsCall); assertEquals(inputAddress, mConnectionUT.getAddress()); } }