The text on toast should be changed when remains 1 time for SIM lock input

This cl was cherry-picked from aosp/585306

The behavior of getQuantityString() is different according to language, it gets
both "other" and "one" string if English is system language. But it always gets
"other" string if non-English, then the "other" string of wrong_pin_code is
shown even if remains 1 time of SIM lock input.

In order to change the string in any language, we add new string for
remains 1 time.

Test: Rebuild rom
Fix: 71783850
Change-Id: If4b53bbbc6b51582bc0837abf4497d9a75ebbaad
This commit is contained in:
Tsung-Mao Fang
2020-04-07 15:40:02 +08:00
parent 76b55e0b0a
commit 9c69ded434
2 changed files with 7 additions and 1 deletions

View File

@@ -3017,6 +3017,10 @@
<item quantity="one">Incorrect SIM PIN code, you have <xliff:g id="number">%d</xliff:g> remaining attempt before you must contact your carrier to unlock your device.</item> <item quantity="one">Incorrect SIM PIN code, you have <xliff:g id="number">%d</xliff:g> remaining attempt before you must contact your carrier to unlock your device.</item>
<item quantity="other">Incorrect SIM PIN code, you have <xliff:g id="number">%d</xliff:g> remaining attempts.</item> <item quantity="other">Incorrect SIM PIN code, you have <xliff:g id="number">%d</xliff:g> remaining attempts.</item>
</plurals> </plurals>
<!-- This is instruction text to inform the user that they have entered the wrong SIM PIN while trying to unlock the keyguard.
The variable will be replaced with a number. [CHAR LIMIT=NONE] -->
<string name="wrong_pin_code_one">Incorrect SIM PIN code, you have 1 remaining attempt before you must contact your carrier to unlock your device.</string>
<!-- Instructions telling the user that the operation to unlock the keyguard with SIM PIN failed. Displayed in one line in a large font. [CHAR LIMIT=40] --> <!-- Instructions telling the user that the operation to unlock the keyguard with SIM PIN failed. Displayed in one line in a large font. [CHAR LIMIT=40] -->
<string name="pin_failed">SIM PIN operation failed!</string> <string name="pin_failed">SIM PIN operation failed!</string>

View File

@@ -639,7 +639,9 @@ public class IccLockSettings extends SettingsPreferenceFragment
if (attemptsRemaining == 0) { if (attemptsRemaining == 0) {
displayMessage = mRes.getString(R.string.wrong_pin_code_pukked); displayMessage = mRes.getString(R.string.wrong_pin_code_pukked);
} else if (attemptsRemaining > 0) { } else if (attemptsRemaining == 1) {
displayMessage = mRes.getString(R.string.wrong_pin_code_one, attemptsRemaining);
} else if (attemptsRemaining > 1) {
displayMessage = mRes displayMessage = mRes
.getQuantityString(R.plurals.wrong_pin_code, attemptsRemaining, .getQuantityString(R.plurals.wrong_pin_code, attemptsRemaining,
attemptsRemaining); attemptsRemaining);