Merge "Fix search indexed the item from the invisible sim" into 24D1-dev am: 365cc18c40
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/27341396 Change-Id: Ibecc4037975cc50636daecb18b243a1a5183f3fe Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -709,12 +709,13 @@ public class MobileNetworkUtils {
|
||||
return tm.getNetworkOperatorName();
|
||||
}
|
||||
|
||||
private static int[] getActiveSubscriptionIdList(Context context) {
|
||||
@VisibleForTesting
|
||||
static int[] getActiveSubscriptionIdList(Context context) {
|
||||
final SubscriptionManager subscriptionManager = context.getSystemService(
|
||||
SubscriptionManager.class).createForAllUserProfiles();
|
||||
final List<SubscriptionInfo> subInfoList =
|
||||
subscriptionManager.getActiveSubscriptionInfoList();
|
||||
if (subInfoList == null) {
|
||||
SubscriptionUtil.getActiveSubscriptions(subscriptionManager);
|
||||
if (subInfoList == null || subInfoList.isEmpty()) {
|
||||
return new int[0];
|
||||
}
|
||||
int[] activeSubIds = new int[subInfoList.size()];
|
||||
|
@@ -243,6 +243,33 @@ public class MobileNetworkUtilsTest {
|
||||
.isEqualTo(SubscriptionManager.INVALID_SUBSCRIPTION_ID);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getActiveSubscriptionIdList_nonActive_returnEmptyArray() {
|
||||
int[] expectedList = new int[0];
|
||||
when(mSubscriptionManager.getActiveSubscriptionInfoList()).thenReturn(new ArrayList<>());
|
||||
|
||||
assertThat(MobileNetworkUtils.getActiveSubscriptionIdList(mContext))
|
||||
.isEqualTo(expectedList);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getActiveSubscriptionIdList_normalCaseTwoActiveSims_returnValidSubId() {
|
||||
int[] expectedList = {SUB_ID_1, SUB_ID_2};
|
||||
|
||||
assertThat(MobileNetworkUtils.getActiveSubscriptionIdList(mContext))
|
||||
.isEqualTo(expectedList);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getActiveSubscriptionIdList_TwoActiveSimsAndOneIsNtn_returnOneSubId() {
|
||||
int[] expectedList = {SUB_ID_2};
|
||||
when(mSubscriptionInfo1.isEmbedded()).thenReturn(true);
|
||||
when(mSubscriptionInfo1.isOnlyNonTerrestrialNetwork()).thenReturn(true);
|
||||
|
||||
assertThat(MobileNetworkUtils.getActiveSubscriptionIdList(mContext))
|
||||
.isEqualTo(expectedList);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldDisplayNetworkSelectOptions_HideCarrierNetwork_returnFalse() {
|
||||
mCarrierConfig.putBoolean(CarrierConfigManager.KEY_HIDE_CARRIER_NETWORK_SETTINGS_BOOL,
|
||||
|
Reference in New Issue
Block a user