From d042a9f2d3ecd6c2e0867b59f29416e76d2e2b57 Mon Sep 17 00:00:00 2001 From: Tsung-Mao Fang Date: Tue, 7 Apr 2020 15:40:02 +0800 Subject: [PATCH] The text on toast should be changed when remains 1 time for SIM lock input 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 Merged-In: If4b53bbbc6b51582bc0837abf4497d9a75ebbaad Change-Id: I1c069333b19399b727e10ed4a6c9483cc1bc44a6 --- res/values/strings.xml | 4 ++++ src/com/android/settings/IccLockSettings.java | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 3b159026159..1a6e0097687 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -2955,6 +2955,10 @@ Incorrect SIM PIN code, you have %d remaining attempt before you must contact your carrier to unlock your device. Incorrect SIM PIN code, you have %d remaining attempts. + + + Incorrect SIM PIN code, you have 1 remaining attempt before you must contact your carrier to unlock your device. SIM PIN operation failed! diff --git a/src/com/android/settings/IccLockSettings.java b/src/com/android/settings/IccLockSettings.java index a5ce5c9ba16..4bd86b5d9ff 100644 --- a/src/com/android/settings/IccLockSettings.java +++ b/src/com/android/settings/IccLockSettings.java @@ -674,7 +674,9 @@ public class IccLockSettings extends SettingsPreferenceFragment if (attemptsRemaining == 0) { 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 .getQuantityString(R.plurals.wrong_pin_code, attemptsRemaining, attemptsRemaining);