Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 06a37cda authored by SongFerng Wang's avatar SongFerng Wang
Browse files

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
parent 25a1f842
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -119,20 +119,21 @@ public class Enable2gPreferenceController extends TelephonyTogglePreferenceContr
        String summary;
        if (isDisabledByCarrier) {
            summary = mContext.getString(R.string.enable_2g_summary_disabled_carrier,
                    getCarrierName());
                    getSimCardName());
        } else {
            summary = mContext.getString(R.string.enable_2g_summary);
        }
        preference.setSummary(summary);
    }

    private String getCarrierName() {
    private String getSimCardName() {
        SubscriptionInfo subInfo = SubscriptionUtil.getSubById(mSubscriptionManager, mSubId);
        if (subInfo == null) {
            return "";
        }
        CharSequence carrierName = subInfo.getCarrierName();
        return TextUtils.isEmpty(carrierName) ? "" : carrierName.toString();
        // It is the sim card name, and it should be the same name as the sim page.
        CharSequence simCardName = subInfo.getDisplayName();
        return TextUtils.isEmpty(simCardName) ? "" : simCardName.toString();
    }

    /**