Loading src/java/com/android/internal/telephony/subscription/SubscriptionManagerService.java +6 −0 Original line number Diff line number Diff line Loading @@ -2166,6 +2166,7 @@ public class SubscriptionManagerService extends ISub.Stub { * @return 0 if success, < 0 on error * * @throws SecurityException if the caller does not have required permissions. * @throws IllegalArgumentException if {@code slotIndex} is invalid. */ @Override @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) Loading @@ -2179,6 +2180,11 @@ 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); } // Now that all security checks passes, perform the operation as ourselves. final long identity = Binder.clearCallingIdentity(); try { Loading tests/telephonytests/src/com/android/internal/telephony/subscription/SubscriptionManagerServiceTest.java +5 −0 Original line number Diff line number Diff line Loading @@ -353,6 +353,11 @@ public class SubscriptionManagerServiceTest extends TelephonyTest { assertThat(subInfo.getSimSlotIndex()).isEqualTo(0); assertThat(subInfo.getSubscriptionType()).isEqualTo( SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM); // Invalid slot index should trigger IllegalArgumentException assertThrows(IllegalArgumentException.class, () -> mSubscriptionManagerServiceUT.addSubInfo(FAKE_ICCID1, FAKE_CARRIER_NAME1, 2, SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM)); } @Test Loading Loading
src/java/com/android/internal/telephony/subscription/SubscriptionManagerService.java +6 −0 Original line number Diff line number Diff line Loading @@ -2166,6 +2166,7 @@ public class SubscriptionManagerService extends ISub.Stub { * @return 0 if success, < 0 on error * * @throws SecurityException if the caller does not have required permissions. * @throws IllegalArgumentException if {@code slotIndex} is invalid. */ @Override @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) Loading @@ -2179,6 +2180,11 @@ 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); } // Now that all security checks passes, perform the operation as ourselves. final long identity = Binder.clearCallingIdentity(); try { Loading
tests/telephonytests/src/com/android/internal/telephony/subscription/SubscriptionManagerServiceTest.java +5 −0 Original line number Diff line number Diff line Loading @@ -353,6 +353,11 @@ public class SubscriptionManagerServiceTest extends TelephonyTest { assertThat(subInfo.getSimSlotIndex()).isEqualTo(0); assertThat(subInfo.getSubscriptionType()).isEqualTo( SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM); // Invalid slot index should trigger IllegalArgumentException assertThrows(IllegalArgumentException.class, () -> mSubscriptionManagerServiceUT.addSubInfo(FAKE_ICCID1, FAKE_CARRIER_NAME1, 2, SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM)); } @Test Loading