Loading src/java/com/android/internal/telephony/imsphone/ImsPhone.java +16 −0 Original line number Diff line number Diff line Loading @@ -2527,6 +2527,10 @@ public class ImsPhone extends ImsPhoneBase { } updateImsRegistrationInfo(REGISTRATION_STATE_NOT_REGISTERED, imsRadioTech, suggestedModemAction); // Clear the phone number from P-Associated-Uri setCurrentSubscriberUris(null); clearPhoneNumberForSourceIms(); } @Override Loading @@ -2537,6 +2541,18 @@ public class ImsPhone extends ImsPhoneBase { } }; /** Clear the IMS phone number from IMS associated Uris when IMS registration is lost. */ @VisibleForTesting public void clearPhoneNumberForSourceIms() { int subId = getSubId(); if (!SubscriptionManager.isValidSubscriptionId(subId)) { return; } if (DBG) logd("clearPhoneNumberForSourceIms"); mSubscriptionManagerService.setNumberFromIms(subId, new String("")); } /** Sets the IMS phone number from IMS associated URIs, if any found. */ @VisibleForTesting public void setPhoneNumberForSourceIms(Uri[] uris) { Loading src/java/com/android/internal/telephony/subscription/SubscriptionManagerService.java +3 −0 Original line number Diff line number Diff line Loading @@ -1424,6 +1424,9 @@ public class SubscriptionManagerService extends ISub.Stub { loge("updateSubscription: ICC card is not available."); } // Clear the cached Ims phone number before proceeding with Ims Registration setNumberFromIms(subId, new String("")); // Attempt to restore SIM specific settings when SIM is loaded. Bundle result = mContext.getContentResolver().call( SubscriptionManager.SIM_INFO_BACKUP_AND_RESTORE_CONTENT_URI, Loading tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsPhoneTest.java +28 −0 Original line number Diff line number Diff line Loading @@ -1111,6 +1111,34 @@ public class ImsPhoneTest extends TelephonyTest { mContextFixture.addCallingOrSelfPermission(""); } @Test @SmallTest public void testClearPhoneNumberForSourceIms() { // In reality the method under test runs in phone process so has MODIFY_PHONE_STATE mContextFixture.addCallingOrSelfPermission(MODIFY_PHONE_STATE); int subId = 1; doReturn(subId).when(mPhone).getSubId(); doReturn(new SubscriptionInfoInternal.Builder().setId(subId).setSimSlotIndex(0) .setCountryIso("gb").build()).when(mSubscriptionManagerService) .getSubscriptionInfoInternal(subId); // 1. Two valid phone number; 1st is set. Uri[] associatedUris = new Uri[] { Uri.parse("sip:+447539447777@ims.x.com"), Uri.parse("tel:+447539446666") }; mImsPhoneUT.setPhoneNumberForSourceIms(associatedUris); verify(mSubscriptionManagerService).setNumberFromIms(subId, "+447539447777"); mImsPhoneUT.clearPhoneNumberForSourceIms(); verify(mSubscriptionManagerService).setNumberFromIms(subId, ""); // Clean up mContextFixture.addCallingOrSelfPermission(""); } /** * Verifies that valid radio technology is passed to RIL * when IMS registration state changes to registered. Loading Loading
src/java/com/android/internal/telephony/imsphone/ImsPhone.java +16 −0 Original line number Diff line number Diff line Loading @@ -2527,6 +2527,10 @@ public class ImsPhone extends ImsPhoneBase { } updateImsRegistrationInfo(REGISTRATION_STATE_NOT_REGISTERED, imsRadioTech, suggestedModemAction); // Clear the phone number from P-Associated-Uri setCurrentSubscriberUris(null); clearPhoneNumberForSourceIms(); } @Override Loading @@ -2537,6 +2541,18 @@ public class ImsPhone extends ImsPhoneBase { } }; /** Clear the IMS phone number from IMS associated Uris when IMS registration is lost. */ @VisibleForTesting public void clearPhoneNumberForSourceIms() { int subId = getSubId(); if (!SubscriptionManager.isValidSubscriptionId(subId)) { return; } if (DBG) logd("clearPhoneNumberForSourceIms"); mSubscriptionManagerService.setNumberFromIms(subId, new String("")); } /** Sets the IMS phone number from IMS associated URIs, if any found. */ @VisibleForTesting public void setPhoneNumberForSourceIms(Uri[] uris) { Loading
src/java/com/android/internal/telephony/subscription/SubscriptionManagerService.java +3 −0 Original line number Diff line number Diff line Loading @@ -1424,6 +1424,9 @@ public class SubscriptionManagerService extends ISub.Stub { loge("updateSubscription: ICC card is not available."); } // Clear the cached Ims phone number before proceeding with Ims Registration setNumberFromIms(subId, new String("")); // Attempt to restore SIM specific settings when SIM is loaded. Bundle result = mContext.getContentResolver().call( SubscriptionManager.SIM_INFO_BACKUP_AND_RESTORE_CONTENT_URI, Loading
tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsPhoneTest.java +28 −0 Original line number Diff line number Diff line Loading @@ -1111,6 +1111,34 @@ public class ImsPhoneTest extends TelephonyTest { mContextFixture.addCallingOrSelfPermission(""); } @Test @SmallTest public void testClearPhoneNumberForSourceIms() { // In reality the method under test runs in phone process so has MODIFY_PHONE_STATE mContextFixture.addCallingOrSelfPermission(MODIFY_PHONE_STATE); int subId = 1; doReturn(subId).when(mPhone).getSubId(); doReturn(new SubscriptionInfoInternal.Builder().setId(subId).setSimSlotIndex(0) .setCountryIso("gb").build()).when(mSubscriptionManagerService) .getSubscriptionInfoInternal(subId); // 1. Two valid phone number; 1st is set. Uri[] associatedUris = new Uri[] { Uri.parse("sip:+447539447777@ims.x.com"), Uri.parse("tel:+447539446666") }; mImsPhoneUT.setPhoneNumberForSourceIms(associatedUris); verify(mSubscriptionManagerService).setNumberFromIms(subId, "+447539447777"); mImsPhoneUT.clearPhoneNumberForSourceIms(); verify(mSubscriptionManagerService).setNumberFromIms(subId, ""); // Clean up mContextFixture.addCallingOrSelfPermission(""); } /** * Verifies that valid radio technology is passed to RIL * when IMS registration state changes to registered. Loading