Merge "Show countdown of remaining decrypt attempts before wiping device" into lmp-dev

This commit is contained in:
Paul Lawrence
2014-07-24 21:45:01 +00:00
committed by Android (Google) Code Review
3 changed files with 20 additions and 2 deletions

View File

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

View File

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

View File

@@ -182,7 +182,17 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
cooldown();
} else {
final TextView status = (TextView) findViewById(R.id.status);
status.setText(R.string.try_again);
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);
}