Merge "Fix null pointer in SubscriptionUtil" into qt-dev

am: 30d0e6c7d7

Change-Id: I0cba2206822450f14610d557f7844e8e1ea08abc
This commit is contained in:
Salvador Martinez
2019-05-01 10:59:11 -07:00
committed by android-build-merger
2 changed files with 10 additions and 1 deletions

View File

@@ -59,7 +59,11 @@ public class SubscriptionUtil {
return subscriptions;
}
private static boolean isInactiveInsertedPSim(UiccSlotInfo slotInfo) {
@VisibleForTesting
static boolean isInactiveInsertedPSim(UiccSlotInfo slotInfo) {
if (slotInfo == null) {
return false;
}
return !slotInfo.getIsEuicc() && !slotInfo.getIsActive() &&
slotInfo.getCardStateInfo() == CARD_STATE_INFO_PRESENT;
}

View File

@@ -187,4 +187,9 @@ public class SubscriptionUtilTest {
assertThat(subs).isNotNull();
assertThat(subs).hasSize(2);
}
@Test
public void isInactiveInsertedPSim_nullSubInfo_doesNotCrash() {
assertThat(SubscriptionUtil.isInactiveInsertedPSim(null)).isFalse();
}
}