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

Commit 2fb343af authored by Fabian Kozynski's avatar Fabian Kozynski
Browse files

Put SIM locked text in parenthesis

Changes how SIM locked text is assembled in CarrierTextController. The
text is put in parenthesis after the carrier name (or replaces it if the
carrier name is blank). This way, the locked text is easily associated
with the corresponding carrier name.

Test: visual
Fixes: 130857483

Change-Id: I86c5156907b2d245855f8be8158459c30c060495
parent 41b8270f
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -112,6 +112,8 @@
         whether it is valid, and to unlock the sim if it is valid.  we display a
         progress dialog in the meantime.  this is the emssage. -->
    <string name="keyguard_sim_unlock_progress_dialog_message">Unlocking SIM card\u2026</string>
    <!-- Composes together the carrier name and the SIM card locked message. Example: CarrierName (SIM LOCKED) -->
    <string name="keyguard_carrier_name_with_sim_locked_template" translatable="false"><xliff:g id="carrier">%s</xliff:g> (<xliff:g id="message">%s</xliff:g>)</string>

    <!-- Time format strings for fall-back clock widget -->
    <string name="keyguard_widget_12_hours_format" translatable="false">h:mm</string>
+22 −2
Original line number Diff line number Diff line
@@ -481,13 +481,13 @@ public class CarrierTextController {
                break;

            case SimLocked:
                carrierText = makeCarrierStringOnEmergencyCapable(
                carrierText = makeCarrierStringOnLocked(
                        getContext().getText(R.string.keyguard_sim_locked_message),
                        text);
                break;

            case SimPukLocked:
                carrierText = makeCarrierStringOnEmergencyCapable(
                carrierText = makeCarrierStringOnLocked(
                        getContext().getText(R.string.keyguard_sim_puk_locked_message),
                        text);
                break;
@@ -515,6 +515,26 @@ public class CarrierTextController {
        return simMessage;
    }

    /*
     * Add "SIM card is locked" in parenthesis after carrier name, so it is easily associated in
     * DSDS
     */
    private CharSequence makeCarrierStringOnLocked(CharSequence simMessage,
            CharSequence carrierName) {
        final boolean simMessageValid = !TextUtils.isEmpty(simMessage);
        final boolean carrierNameValid = !TextUtils.isEmpty(carrierName);
        if (simMessageValid && carrierNameValid) {
            return mContext.getString(R.string.keyguard_carrier_name_with_sim_locked_template,
                    carrierName, simMessage);
        } else if (simMessageValid) {
            return simMessage;
        } else if (carrierNameValid) {
            return carrierName;
        } else {
            return "";
        }
    }

    /**
     * Determine the current status of the lock screen given the SIM state and other stuff.
     */