Sort the selectable subscription by id
To make sure users always see a fixed order. Bug: 318310357 Test: manual - on SIMs and turn on / off SIM Change-Id: I2910d83f5b1d04287afca0e3ba91dedbeb588c14
This commit is contained in:
@@ -50,12 +50,12 @@ import com.android.settings.network.helper.SelectableSubscriptions;
|
||||
import com.android.settings.network.helper.SubscriptionAnnotation;
|
||||
import com.android.settings.network.telephony.DeleteEuiccSubscriptionDialogActivity;
|
||||
import com.android.settings.network.telephony.EuiccRacConnectivityDialogActivity;
|
||||
import com.android.settings.network.telephony.SubscriptionRepositoryKt;
|
||||
import com.android.settings.network.telephony.ToggleSubscriptionDialogActivity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@@ -499,40 +499,7 @@ public class SubscriptionUtil {
|
||||
* @return list of user selectable subscriptions.
|
||||
*/
|
||||
public static List<SubscriptionInfo> getSelectableSubscriptionInfoList(Context context) {
|
||||
SubscriptionManager subManager = context.getSystemService(SubscriptionManager.class);
|
||||
List<SubscriptionInfo> availableList = subManager.getAvailableSubscriptionInfoList();
|
||||
if (availableList == null) {
|
||||
return null;
|
||||
} else {
|
||||
// Multiple subscriptions in a group should only have one representative.
|
||||
// It should be the current active primary subscription if any, or any
|
||||
// primary subscription.
|
||||
List<SubscriptionInfo> selectableList = new ArrayList<>();
|
||||
Map<ParcelUuid, SubscriptionInfo> groupMap = new HashMap<>();
|
||||
|
||||
for (SubscriptionInfo info : availableList) {
|
||||
// Opportunistic subscriptions are considered invisible
|
||||
// to users so they should never be returned.
|
||||
if (!isSubscriptionVisible(subManager, context, info)) continue;
|
||||
|
||||
ParcelUuid groupUuid = info.getGroupUuid();
|
||||
if (groupUuid == null) {
|
||||
// Doesn't belong to any group. Add in the list.
|
||||
selectableList.add(info);
|
||||
} else if (!groupMap.containsKey(groupUuid)
|
||||
|| (groupMap.get(groupUuid).getSimSlotIndex() == INVALID_SIM_SLOT_INDEX
|
||||
&& info.getSimSlotIndex() != INVALID_SIM_SLOT_INDEX)) {
|
||||
// If it belongs to a group that has never been recorded or it's the current
|
||||
// active subscription, add it in the list.
|
||||
selectableList.remove(groupMap.get(groupUuid));
|
||||
selectableList.add(info);
|
||||
groupMap.put(groupUuid, info);
|
||||
}
|
||||
|
||||
}
|
||||
Log.d(TAG, "getSelectableSubscriptionInfoList: " + selectableList);
|
||||
return selectableList;
|
||||
}
|
||||
return SubscriptionRepositoryKt.getSelectableSubscriptionInfoList(context);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user