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
This commit is contained in:
Fabian Kozynski
2019-05-08 16:06:51 -04:00
parent 41b8270f6f
commit 2fb343af8c
2 changed files with 24 additions and 2 deletions

View File

@@ -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>

View File

@@ -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.
*/