Use active instead of available subscriptions in 2 places
In a couple of places we were showing DSDS UI using the list of *available* subscriptions instead of the list of *active* ones. This difference is relevant for instance if you have multiple eSIM profiles - in typical hardware only one of those can be active at one time. This CL fixes that problem in two places: 1) The header at the top of the Network & internet page 2) The ListPreference's on the mobile network detail page for selecting the default subscription for Calls / SMS. Fixes: 129673046 Test: make RunSettingsRoboTests Change-Id: I891c856bdd4516286fcee1067684d9161ceaca80
This commit is contained in:
@@ -27,16 +27,33 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class SubscriptionUtil {
|
||||
private static List<SubscriptionInfo> sResultsForTesting;
|
||||
private static List<SubscriptionInfo> sAvailableResultsForTesting;
|
||||
private static List<SubscriptionInfo> sActiveResultsForTesting;
|
||||
|
||||
@VisibleForTesting
|
||||
public static void setAvailableSubscriptionsForTesting(List<SubscriptionInfo> results) {
|
||||
sResultsForTesting = results;
|
||||
sAvailableResultsForTesting = results;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public static void setActiveSubscriptionsForTesting(List<SubscriptionInfo> results) {
|
||||
sActiveResultsForTesting = results;
|
||||
}
|
||||
|
||||
public static List<SubscriptionInfo> getActiveSubscriptions(SubscriptionManager manager) {
|
||||
if (sActiveResultsForTesting != null) {
|
||||
return sActiveResultsForTesting;
|
||||
}
|
||||
List<SubscriptionInfo> subscriptions = manager.getActiveSubscriptionInfoList(true);
|
||||
if (subscriptions == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return subscriptions;
|
||||
}
|
||||
|
||||
public static List<SubscriptionInfo> getAvailableSubscriptions(SubscriptionManager manager) {
|
||||
if (sResultsForTesting != null) {
|
||||
return sResultsForTesting;
|
||||
if (sAvailableResultsForTesting != null) {
|
||||
return sAvailableResultsForTesting;
|
||||
}
|
||||
List<SubscriptionInfo> subscriptions = manager.getSelectableSubscriptionInfoList();
|
||||
if (subscriptions == null) {
|
||||
|
Reference in New Issue
Block a user