[ProviderModel] Use category to separate physical SIM and e-SIM
Mock from UX: https://screenshot.googleplex.com/4kscwJvoQE7vwF3.png Implementation UI: https://screenshot.googleplex.com/AEeVzLi364KiPGa.png Bug: 187071119 Test: atest NetworkProviderSimListControllerTest Test: atest NetworkProviderSimsCategoryControllerTest Test: atest NetworkProviderDownloadedSimListControllerTest Test: atest NetworkProviderDownloadedSimsCategoryControllerTest Change-Id: Ia84bebe6ea431cdbae19f3e4b840f7cd56dc2d6f
This commit is contained in:
@@ -36,6 +36,7 @@ import android.util.Log;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.internal.telephony.MccTable;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.network.telephony.DeleteEuiccSubscriptionDialogActivity;
|
||||
import com.android.settings.network.telephony.ToggleSubscriptionDialogActivity;
|
||||
import com.android.settingslib.DeviceInfoUtils;
|
||||
@@ -343,7 +344,6 @@ public class SubscriptionUtil {
|
||||
*
|
||||
* @return map of active subscription ids to diaplay names.
|
||||
*/
|
||||
@VisibleForTesting
|
||||
public static CharSequence getUniqueSubscriptionDisplayName(
|
||||
SubscriptionInfo info, Context context) {
|
||||
if (info == null) {
|
||||
@@ -585,4 +585,56 @@ public class SubscriptionUtil {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static CharSequence getDefaultSimConfig(Context context, int subId) {
|
||||
boolean isDefaultCall = subId == getDefaultVoiceSubscriptionId();
|
||||
boolean isDefaultSms = subId == getDefaultSmsSubscriptionId();
|
||||
boolean isDefaultData = subId == getDefaultDataSubscriptionId();
|
||||
|
||||
if (!isDefaultData && !isDefaultCall && !isDefaultSms) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final StringBuilder defaultConfig = new StringBuilder();
|
||||
if (isDefaultData) {
|
||||
defaultConfig.append(
|
||||
getResForDefaultConfig(context, R.string.default_active_sim_mobile_data))
|
||||
.append(", ");
|
||||
}
|
||||
|
||||
if (isDefaultCall) {
|
||||
defaultConfig.append(getResForDefaultConfig(context, R.string.default_active_sim_calls))
|
||||
.append(", ");
|
||||
}
|
||||
|
||||
if (isDefaultSms) {
|
||||
defaultConfig.append(getResForDefaultConfig(context, R.string.default_active_sim_sms))
|
||||
.append(", ");
|
||||
}
|
||||
|
||||
// Do not add ", " for the last config.
|
||||
defaultConfig.setLength(defaultConfig.length() - 2);
|
||||
|
||||
final String summary = context.getResources().getString(
|
||||
R.string.sim_category_default_active_sim,
|
||||
defaultConfig);
|
||||
|
||||
return summary;
|
||||
}
|
||||
|
||||
private static String getResForDefaultConfig(Context context, int resId) {
|
||||
return context.getResources().getString(resId);
|
||||
}
|
||||
|
||||
private static int getDefaultVoiceSubscriptionId() {
|
||||
return SubscriptionManager.getDefaultVoiceSubscriptionId();
|
||||
}
|
||||
|
||||
private static int getDefaultSmsSubscriptionId() {
|
||||
return SubscriptionManager.getDefaultSmsSubscriptionId();
|
||||
}
|
||||
|
||||
private static int getDefaultDataSubscriptionId() {
|
||||
return SubscriptionManager.getDefaultDataSubscriptionId();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user