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

Commit c5ff71f0 authored by Pawit Pornkitprasan's avatar Pawit Pornkitprasan Committed by Gerrit Code Review
Browse files

Settings: MSim: fix carrier name display

- The existing implementation displays the network name of the
  default SIM for both SIMs, which is simply incorrect
- Pass the subId to the function to get the value for the correct
  SIM
- Use the SIM name (instead of the network name), since the network
  name can be a different network when roaming
- If SIM name is empty (SPN not provided by carrier), display the
  network name if not roaming for better UX

Change-Id: I546dc952d7516579b763399f2d1f6db978163888
parent e1e30110
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -484,7 +484,14 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
            TextView carrierView = (TextView)dialogLayout.findViewById(R.id.carrier);
            TelephonyManager tm = (TelephonyManager)
                    getActivity().getSystemService(Context.TELEPHONY_SERVICE);
            carrierView.setText(tm.getNetworkOperatorName());
            String spn = tm.getSimOperatorName(mSubInfoRecord.subId);
            if (TextUtils.isEmpty(spn) && !tm.isNetworkRoaming(mSubInfoRecord.subId)) {
                // Operator did not write the SPN inside the SIM, so set
                // the current network operator as the SIM name, but only if
                // we're not roaming.
                spn = tm.getNetworkOperatorName(mSubInfoRecord.subId);
            }
            carrierView.setText(spn);

            builder.setTitle(R.string.sim_editor_title);