Loading src/java/com/android/internal/telephony/subscription/SubscriptionManagerService.java +11 −3 Original line number Diff line number Diff line Loading @@ -2308,9 +2308,17 @@ public class SubscriptionManagerService extends ISub.Stub { enforceTelephonyFeatureWithException(getCurrentPackageName(), "addSubInfo"); if (!SubscriptionManager.isValidSlotIndex(slotIndex) && slotIndex != SubscriptionManager.INVALID_SIM_SLOT_INDEX) { throw new IllegalArgumentException("Invalid slotIndex " + slotIndex); if (subscriptionType == SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM) { if (!SubscriptionManager.isValidSlotIndex(slotIndex)) { throw new IllegalArgumentException("Invalid slot index " + slotIndex + " for local SIM"); } } else if (subscriptionType == SubscriptionManager.SUBSCRIPTION_TYPE_REMOTE_SIM) { // We only support one remote SIM at this point, so use -1. This needs to be revisited // if we plan to support multiple remote SIMs in the future. slotIndex = SubscriptionManager.INVALID_SIM_SLOT_INDEX; } else { throw new IllegalArgumentException("Invalid subscription type " + subscriptionType); } // Now that all security checks passes, perform the operation as ourselves. Loading tests/telephonytests/src/com/android/internal/telephony/subscription/SubscriptionManagerServiceTest.java +2 −1 Original line number Diff line number Diff line Loading @@ -2884,7 +2884,8 @@ public class SubscriptionManagerServiceTest extends TelephonyTest { .getSubscriptionInfoInternal(1); assertThat(subInfo.getIccId()).isEqualTo(FAKE_MAC_ADDRESS1); assertThat(subInfo.getDisplayName()).isEqualTo(FAKE_CARRIER_NAME1); assertThat(subInfo.getSimSlotIndex()).isEqualTo(0); assertThat(subInfo.getSimSlotIndex()).isEqualTo( SubscriptionManager.INVALID_SIM_SLOT_INDEX); assertThat(subInfo.getSubscriptionType()).isEqualTo( SubscriptionManager.SUBSCRIPTION_TYPE_REMOTE_SIM); Loading Loading
src/java/com/android/internal/telephony/subscription/SubscriptionManagerService.java +11 −3 Original line number Diff line number Diff line Loading @@ -2308,9 +2308,17 @@ public class SubscriptionManagerService extends ISub.Stub { enforceTelephonyFeatureWithException(getCurrentPackageName(), "addSubInfo"); if (!SubscriptionManager.isValidSlotIndex(slotIndex) && slotIndex != SubscriptionManager.INVALID_SIM_SLOT_INDEX) { throw new IllegalArgumentException("Invalid slotIndex " + slotIndex); if (subscriptionType == SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM) { if (!SubscriptionManager.isValidSlotIndex(slotIndex)) { throw new IllegalArgumentException("Invalid slot index " + slotIndex + " for local SIM"); } } else if (subscriptionType == SubscriptionManager.SUBSCRIPTION_TYPE_REMOTE_SIM) { // We only support one remote SIM at this point, so use -1. This needs to be revisited // if we plan to support multiple remote SIMs in the future. slotIndex = SubscriptionManager.INVALID_SIM_SLOT_INDEX; } else { throw new IllegalArgumentException("Invalid subscription type " + subscriptionType); } // Now that all security checks passes, perform the operation as ourselves. Loading
tests/telephonytests/src/com/android/internal/telephony/subscription/SubscriptionManagerServiceTest.java +2 −1 Original line number Diff line number Diff line Loading @@ -2884,7 +2884,8 @@ public class SubscriptionManagerServiceTest extends TelephonyTest { .getSubscriptionInfoInternal(1); assertThat(subInfo.getIccId()).isEqualTo(FAKE_MAC_ADDRESS1); assertThat(subInfo.getDisplayName()).isEqualTo(FAKE_CARRIER_NAME1); assertThat(subInfo.getSimSlotIndex()).isEqualTo(0); assertThat(subInfo.getSimSlotIndex()).isEqualTo( SubscriptionManager.INVALID_SIM_SLOT_INDEX); assertThat(subInfo.getSubscriptionType()).isEqualTo( SubscriptionManager.SUBSCRIPTION_TYPE_REMOTE_SIM); Loading