Merge "Show countdown of remaining decrypt attempts before wiping device" into lmp-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
832ad72062
@@ -25,6 +25,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal">
|
||||
|
||||
<!-- We need android:gravity="center_horizontal" to make multi line
|
||||
status strings look good -->
|
||||
<TextView
|
||||
android:id="@+id/status"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -35,7 +37,8 @@
|
||||
android:textSize="18sp"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:text="@string/enter_password"
|
||||
android:layout_gravity="center_horizontal" />
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:gravity="center_horizontal" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/owner_info"
|
||||
|
@@ -867,6 +867,11 @@
|
||||
<!-- Informational text on the password entry screen when password entry fails-->
|
||||
<string name="crypt_keeper_cooldown">Try again in <xliff:g id="delay" example="15">^1</xliff:g> seconds.</string>
|
||||
|
||||
<!-- Warn user their device will be wiped if they make x more failed attempts -->
|
||||
<string name="crypt_keeper_warn_wipe">Warning: Your device will be wiped after
|
||||
<xliff:g id="count" example="7">^1</xliff:g> more failed attempts to be unlocked!
|
||||
</string>
|
||||
|
||||
<!-- Informational text on the password entry screen prompting the user for their password -->
|
||||
<string name="crypt_keeper_enter_password">Type your password</string>
|
||||
|
||||
|
@@ -182,7 +182,17 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
|
||||
cooldown();
|
||||
} else {
|
||||
final TextView status = (TextView) findViewById(R.id.status);
|
||||
|
||||
int remainingAttempts = MAX_FAILED_ATTEMPTS - failedAttempts;
|
||||
if (remainingAttempts < COOL_DOWN_ATTEMPTS) {
|
||||
CharSequence warningTemplate = getText(R.string.crypt_keeper_warn_wipe);
|
||||
CharSequence warning = TextUtils.expandTemplate(warningTemplate,
|
||||
Integer.toString(remainingAttempts));
|
||||
status.setText(warning);
|
||||
} else {
|
||||
status.setText(R.string.try_again);
|
||||
}
|
||||
|
||||
if (mLockPatternView != null) {
|
||||
mLockPatternView.setDisplayMode(DisplayMode.Wrong);
|
||||
}
|
||||
|
Reference in New Issue
Block a user