Loading src/java/com/android/internal/telephony/imsphone/ImsExternalCallTracker.java +1 −1 Original line number Diff line number Diff line Loading @@ -170,7 +170,7 @@ public class ImsExternalCallTracker { ImsExternalConnection connection = new ImsExternalConnection(mPhone, state.getCallId(), /* Dialog event package call id */ state.getAddress().getSchemeSpecificPart() /* phone number */, state.getAddress() /* phone number */, state.isCallPullable()); connection.setVideoState(ImsCallProfile.getVideoStateFromCallType(state.getCallType())); connection.addListener(mExternalConnectionListener); Loading src/java/com/android/internal/telephony/imsphone/ImsExternalConnection.java +22 −2 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ import com.android.internal.telephony.Phone; import com.android.internal.telephony.PhoneConstants; import com.android.internal.telephony.UUSInfo; import android.net.Uri; import android.telephony.PhoneNumberUtils; import android.telephony.Rlog; import android.util.Log; Loading Loading @@ -65,16 +67,21 @@ public class ImsExternalConnection extends Connection { */ private ImsExternalCall mCall; /** * The original address as contained in the dialog event package. */ private Uri mOriginalAddress; /** * Determines if the call is pullable. */ private boolean mIsPullable; protected ImsExternalConnection(Phone phone, int callId, String address, boolean isPullable) { protected ImsExternalConnection(Phone phone, int callId, Uri address, boolean isPullable) { super(phone.getPhoneType()); mCall = new ImsExternalCall(phone, this); mCallId = callId; mAddress = address; setExternalConnectionAddress(address); mNumberPresentation = PhoneConstants.PRESENTATION_ALLOWED; mIsPullable = isPullable; Loading Loading @@ -199,6 +206,19 @@ public class ImsExternalConnection extends Connection { rebuildCapabilities(); } /** * Sets the address of this external connection. Ensures that dialog event package SIP * {@link Uri}s are converted to a regular telephone number. * * @param address The address from the dialog event package. */ public void setExternalConnectionAddress(Uri address) { mOriginalAddress = address; Uri telUri = PhoneNumberUtils.convertSipUriToTelUri(address); mAddress = telUri.getSchemeSpecificPart(); } public void addListener(Listener listener) { mListeners.add(listener); } Loading src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java +4 −0 Original line number Diff line number Diff line Loading @@ -1173,6 +1173,10 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall { case ImsReasonInfo.CODE_FDN_BLOCKED: return DisconnectCause.FDN_BLOCKED; case ImsReasonInfo.CODE_ANSWERED_ELSEWHERE: case ImsReasonInfo.CODE_CALL_END_CAUSE_CALL_PULL: return DisconnectCause.CALL_PULLED; default: } Loading tests/telephonytests/src/com/android/internal/telephony/PhoneNumberUtilsTest.java +23 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.internal.telephony; import android.net.Uri; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.SmallTest; import android.text.SpannableStringBuilder; Loading Loading @@ -642,4 +643,26 @@ public class PhoneNumberUtilsTest extends AndroidTestCase { assertEquals("18004664411", PhoneNumberUtils.convertAndStrip("1-800-GOOG-411")); assertEquals("8002223334", PhoneNumberUtils.convertAndStrip("(800) ABC-DEFG")); } @SmallTest public void testConvertSipUriToTelUri1() { // Nominal case, a tel Uri came in, so we expect one out. Uri source = Uri.fromParts("tel", "+16505551212", null); Uri expected = Uri.fromParts("tel", "+16505551212", null); Uri converted = PhoneNumberUtils.convertSipUriToTelUri(source); assertEquals(expected, converted); // Valid cases source = Uri.fromParts("sip", "+16505551212@sipinator.com", null); converted = PhoneNumberUtils.convertSipUriToTelUri(source); assertEquals(expected, converted); source = Uri.fromParts("sip", "+16505551212;phone-context=blah.com@host.com", null); converted = PhoneNumberUtils.convertSipUriToTelUri(source); assertEquals(expected, converted); source = Uri.fromParts("sip", "+16505551212@something.com;user=phone", null); converted = PhoneNumberUtils.convertSipUriToTelUri(source); assertEquals(expected, converted); } } Loading
src/java/com/android/internal/telephony/imsphone/ImsExternalCallTracker.java +1 −1 Original line number Diff line number Diff line Loading @@ -170,7 +170,7 @@ public class ImsExternalCallTracker { ImsExternalConnection connection = new ImsExternalConnection(mPhone, state.getCallId(), /* Dialog event package call id */ state.getAddress().getSchemeSpecificPart() /* phone number */, state.getAddress() /* phone number */, state.isCallPullable()); connection.setVideoState(ImsCallProfile.getVideoStateFromCallType(state.getCallType())); connection.addListener(mExternalConnectionListener); Loading
src/java/com/android/internal/telephony/imsphone/ImsExternalConnection.java +22 −2 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ import com.android.internal.telephony.Phone; import com.android.internal.telephony.PhoneConstants; import com.android.internal.telephony.UUSInfo; import android.net.Uri; import android.telephony.PhoneNumberUtils; import android.telephony.Rlog; import android.util.Log; Loading Loading @@ -65,16 +67,21 @@ public class ImsExternalConnection extends Connection { */ private ImsExternalCall mCall; /** * The original address as contained in the dialog event package. */ private Uri mOriginalAddress; /** * Determines if the call is pullable. */ private boolean mIsPullable; protected ImsExternalConnection(Phone phone, int callId, String address, boolean isPullable) { protected ImsExternalConnection(Phone phone, int callId, Uri address, boolean isPullable) { super(phone.getPhoneType()); mCall = new ImsExternalCall(phone, this); mCallId = callId; mAddress = address; setExternalConnectionAddress(address); mNumberPresentation = PhoneConstants.PRESENTATION_ALLOWED; mIsPullable = isPullable; Loading Loading @@ -199,6 +206,19 @@ public class ImsExternalConnection extends Connection { rebuildCapabilities(); } /** * Sets the address of this external connection. Ensures that dialog event package SIP * {@link Uri}s are converted to a regular telephone number. * * @param address The address from the dialog event package. */ public void setExternalConnectionAddress(Uri address) { mOriginalAddress = address; Uri telUri = PhoneNumberUtils.convertSipUriToTelUri(address); mAddress = telUri.getSchemeSpecificPart(); } public void addListener(Listener listener) { mListeners.add(listener); } Loading
src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java +4 −0 Original line number Diff line number Diff line Loading @@ -1173,6 +1173,10 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall { case ImsReasonInfo.CODE_FDN_BLOCKED: return DisconnectCause.FDN_BLOCKED; case ImsReasonInfo.CODE_ANSWERED_ELSEWHERE: case ImsReasonInfo.CODE_CALL_END_CAUSE_CALL_PULL: return DisconnectCause.CALL_PULLED; default: } Loading
tests/telephonytests/src/com/android/internal/telephony/PhoneNumberUtilsTest.java +23 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.internal.telephony; import android.net.Uri; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.SmallTest; import android.text.SpannableStringBuilder; Loading Loading @@ -642,4 +643,26 @@ public class PhoneNumberUtilsTest extends AndroidTestCase { assertEquals("18004664411", PhoneNumberUtils.convertAndStrip("1-800-GOOG-411")); assertEquals("8002223334", PhoneNumberUtils.convertAndStrip("(800) ABC-DEFG")); } @SmallTest public void testConvertSipUriToTelUri1() { // Nominal case, a tel Uri came in, so we expect one out. Uri source = Uri.fromParts("tel", "+16505551212", null); Uri expected = Uri.fromParts("tel", "+16505551212", null); Uri converted = PhoneNumberUtils.convertSipUriToTelUri(source); assertEquals(expected, converted); // Valid cases source = Uri.fromParts("sip", "+16505551212@sipinator.com", null); converted = PhoneNumberUtils.convertSipUriToTelUri(source); assertEquals(expected, converted); source = Uri.fromParts("sip", "+16505551212;phone-context=blah.com@host.com", null); converted = PhoneNumberUtils.convertSipUriToTelUri(source); assertEquals(expected, converted); source = Uri.fromParts("sip", "+16505551212@something.com;user=phone", null); converted = PhoneNumberUtils.convertSipUriToTelUri(source); assertEquals(expected, converted); } }