Loading src/java/com/android/internal/telephony/subscription/SubscriptionManagerService.java +2 −2 Original line number Diff line number Diff line Loading @@ -1393,7 +1393,7 @@ public class SubscriptionManagerService extends ISub.Stub { loge("updateSubscription: sim country iso is null"); } String msisdn = mTelephonyManager.getLine1Number(subId); String msisdn = PhoneFactory.getPhone(phoneId).getLine1Number(); if (!TextUtils.isEmpty(msisdn)) { setDisplayNumber(msisdn, subId); } Loading Loading @@ -3372,7 +3372,7 @@ public class SubscriptionManagerService extends ISub.Stub { try { switch(source) { case SubscriptionManager.PHONE_NUMBER_SOURCE_UICC: Phone phone = PhoneFactory.getPhone(getPhoneId(subId)); Phone phone = PhoneFactory.getPhone(getSlotIndex(subId)); if (phone != null) { return TextUtils.emptyIfNull(phone.getLine1Number()); } else { Loading tests/telephonytests/src/com/android/internal/telephony/subscription/SubscriptionManagerServiceTest.java +20 −1 Original line number Diff line number Diff line Loading @@ -167,6 +167,7 @@ public class SubscriptionManagerServiceTest extends TelephonyTest { // Dual-SIM configuration mPhones = new Phone[] {mPhone, mPhone2}; replaceInstance(PhoneFactory.class, "sPhones", null, mPhones); doReturn(FAKE_PHONE_NUMBER1).when(mPhone).getLine1Number(); doReturn(2).when(mTelephonyManager).getActiveModemCount(); doReturn(2).when(mTelephonyManager).getSupportedModemCount(); doReturn(mUiccProfile).when(mPhone2).getIccCard(); Loading Loading @@ -1868,7 +1869,6 @@ public class SubscriptionManagerServiceTest extends TelephonyTest { doReturn(FAKE_IMSI1).when(mTelephonyManager).getSubscriberId(); doReturn(FAKE_MCC1 + FAKE_MNC1).when(mTelephonyManager).getSimOperatorNumeric(anyInt()); doReturn(FAKE_PHONE_NUMBER1).when(mTelephonyManager).getLine1Number(anyInt()); doReturn(FAKE_EHPLMNS1.split(",")).when(mSimRecords).getEhplmns(); doReturn(FAKE_HPLMNS1.split(",")).when(mSimRecords).getPlmnsFromHplmnActRecord(); doReturn(0).when(mUiccSlot).getPortIndexFromIccId(anyString()); Loading Loading @@ -1946,6 +1946,24 @@ public class SubscriptionManagerServiceTest extends TelephonyTest { .isEmpty(); } @Test public void testGetPhoneNumberFromInactiveSubscription() { mContextFixture.addCallingOrSelfPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE); testInactiveSimRemoval(); int subId = insertSubscription(FAKE_SUBSCRIPTION_INFO1); assertThat(subId).isEqualTo(2); assertThat(mSubscriptionManagerServiceUT.getActiveSubIdList(false)).hasLength(1); assertThat(mSubscriptionManagerServiceUT.getAllSubInfoList(CALLING_PACKAGE, CALLING_FEATURE)).hasSize(2); assertThat(mSubscriptionManagerServiceUT.getPhoneNumberFromFirstAvailableSource(1, CALLING_PACKAGE, CALLING_FEATURE)).isEqualTo(FAKE_PHONE_NUMBER2); assertThat(mSubscriptionManagerServiceUT.getPhoneNumber(1, SubscriptionManager.PHONE_NUMBER_SOURCE_UICC, CALLING_PACKAGE, CALLING_FEATURE)) .isEqualTo(FAKE_PHONE_NUMBER2); } @Test public void testDeleteEsim() { mContextFixture.addCallingOrSelfPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE); Loading Loading @@ -2034,6 +2052,7 @@ public class SubscriptionManagerServiceTest extends TelephonyTest { 0, TelephonyManager.SIM_STATE_READY, null, null); processAllMessages(); mContextFixture.addCallingOrSelfPermission(Manifest.permission.MODIFY_PHONE_STATE); mSubscriptionManagerServiceUT.updateSimState( 0, TelephonyManager.SIM_STATE_LOADED, null, null); processAllMessages(); Loading Loading
src/java/com/android/internal/telephony/subscription/SubscriptionManagerService.java +2 −2 Original line number Diff line number Diff line Loading @@ -1393,7 +1393,7 @@ public class SubscriptionManagerService extends ISub.Stub { loge("updateSubscription: sim country iso is null"); } String msisdn = mTelephonyManager.getLine1Number(subId); String msisdn = PhoneFactory.getPhone(phoneId).getLine1Number(); if (!TextUtils.isEmpty(msisdn)) { setDisplayNumber(msisdn, subId); } Loading Loading @@ -3372,7 +3372,7 @@ public class SubscriptionManagerService extends ISub.Stub { try { switch(source) { case SubscriptionManager.PHONE_NUMBER_SOURCE_UICC: Phone phone = PhoneFactory.getPhone(getPhoneId(subId)); Phone phone = PhoneFactory.getPhone(getSlotIndex(subId)); if (phone != null) { return TextUtils.emptyIfNull(phone.getLine1Number()); } else { Loading
tests/telephonytests/src/com/android/internal/telephony/subscription/SubscriptionManagerServiceTest.java +20 −1 Original line number Diff line number Diff line Loading @@ -167,6 +167,7 @@ public class SubscriptionManagerServiceTest extends TelephonyTest { // Dual-SIM configuration mPhones = new Phone[] {mPhone, mPhone2}; replaceInstance(PhoneFactory.class, "sPhones", null, mPhones); doReturn(FAKE_PHONE_NUMBER1).when(mPhone).getLine1Number(); doReturn(2).when(mTelephonyManager).getActiveModemCount(); doReturn(2).when(mTelephonyManager).getSupportedModemCount(); doReturn(mUiccProfile).when(mPhone2).getIccCard(); Loading Loading @@ -1868,7 +1869,6 @@ public class SubscriptionManagerServiceTest extends TelephonyTest { doReturn(FAKE_IMSI1).when(mTelephonyManager).getSubscriberId(); doReturn(FAKE_MCC1 + FAKE_MNC1).when(mTelephonyManager).getSimOperatorNumeric(anyInt()); doReturn(FAKE_PHONE_NUMBER1).when(mTelephonyManager).getLine1Number(anyInt()); doReturn(FAKE_EHPLMNS1.split(",")).when(mSimRecords).getEhplmns(); doReturn(FAKE_HPLMNS1.split(",")).when(mSimRecords).getPlmnsFromHplmnActRecord(); doReturn(0).when(mUiccSlot).getPortIndexFromIccId(anyString()); Loading Loading @@ -1946,6 +1946,24 @@ public class SubscriptionManagerServiceTest extends TelephonyTest { .isEmpty(); } @Test public void testGetPhoneNumberFromInactiveSubscription() { mContextFixture.addCallingOrSelfPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE); testInactiveSimRemoval(); int subId = insertSubscription(FAKE_SUBSCRIPTION_INFO1); assertThat(subId).isEqualTo(2); assertThat(mSubscriptionManagerServiceUT.getActiveSubIdList(false)).hasLength(1); assertThat(mSubscriptionManagerServiceUT.getAllSubInfoList(CALLING_PACKAGE, CALLING_FEATURE)).hasSize(2); assertThat(mSubscriptionManagerServiceUT.getPhoneNumberFromFirstAvailableSource(1, CALLING_PACKAGE, CALLING_FEATURE)).isEqualTo(FAKE_PHONE_NUMBER2); assertThat(mSubscriptionManagerServiceUT.getPhoneNumber(1, SubscriptionManager.PHONE_NUMBER_SOURCE_UICC, CALLING_PACKAGE, CALLING_FEATURE)) .isEqualTo(FAKE_PHONE_NUMBER2); } @Test public void testDeleteEsim() { mContextFixture.addCallingOrSelfPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE); Loading Loading @@ -2034,6 +2052,7 @@ public class SubscriptionManagerServiceTest extends TelephonyTest { 0, TelephonyManager.SIM_STATE_READY, null, null); processAllMessages(); mContextFixture.addCallingOrSelfPermission(Manifest.permission.MODIFY_PHONE_STATE); mSubscriptionManagerServiceUT.updateSimState( 0, TelephonyManager.SIM_STATE_LOADED, null, null); processAllMessages(); Loading