The 2G enable's summary shows the sim card name

The 2G enable's summary should show the sim card name, not the name of service provider.

Bug: 293715485
Test: build pass

Change-Id: Iead9c4e82cd4bf26451e38ded7cbcd276e9fa5f2
This commit is contained in:
SongFerng Wang
2023-08-08 08:30:27 +00:00
parent 25a1f8429c
commit 06a37cda0b

View File

@@ -119,20 +119,21 @@ public class Enable2gPreferenceController extends TelephonyTogglePreferenceContr
String summary; String summary;
if (isDisabledByCarrier) { if (isDisabledByCarrier) {
summary = mContext.getString(R.string.enable_2g_summary_disabled_carrier, summary = mContext.getString(R.string.enable_2g_summary_disabled_carrier,
getCarrierName()); getSimCardName());
} else { } else {
summary = mContext.getString(R.string.enable_2g_summary); summary = mContext.getString(R.string.enable_2g_summary);
} }
preference.setSummary(summary); preference.setSummary(summary);
} }
private String getCarrierName() { private String getSimCardName() {
SubscriptionInfo subInfo = SubscriptionUtil.getSubById(mSubscriptionManager, mSubId); SubscriptionInfo subInfo = SubscriptionUtil.getSubById(mSubscriptionManager, mSubId);
if (subInfo == null) { if (subInfo == null) {
return ""; return "";
} }
CharSequence carrierName = subInfo.getCarrierName(); // It is the sim card name, and it should be the same name as the sim page.
return TextUtils.isEmpty(carrierName) ? "" : carrierName.toString(); CharSequence simCardName = subInfo.getDisplayName();
return TextUtils.isEmpty(simCardName) ? "" : simCardName.toString();
} }
/** /**