Loading packages/Keyguard/res/values-zh-rCN/strings.xml +4 −0 Original line number Original line Diff line number Diff line Loading @@ -161,4 +161,8 @@ <item quantity="other" msgid="2215723361575359486">"输入 SIM PIN,您还有<xliff:g id="NUMBER">%d</xliff:g>次尝试机会。"</item> <item quantity="other" msgid="2215723361575359486">"输入 SIM PIN,您还有<xliff:g id="NUMBER">%d</xliff:g>次尝试机会。"</item> </plurals> </plurals> <string name="kg_remaining_attempts">剩余次数: <xliff:g id="number">%d</xliff:g></string> <string name="kg_remaining_attempts">剩余次数: <xliff:g id="number">%d</xliff:g></string> <string name="kg_failed_pin_attempts_now_wiping">您输入了<xliff:g id="number">%d</xliff:g>次错误的PIN, 是否重启并恢复出厂设置?</string> <string name="kg_failed_password_attempts_now_wiping">您输入了<xliff:g id="number">%d</xliff:g>次错误的密码, 是否重启并恢复出厂设置?</string> <string name="kg_failed_pattern_attempts_now_wiping">您输入了<xliff:g id="number">%d</xliff:g>次错误图案, 是否重启并恢复出厂设置?</string> <string name="kg_failed_attempts_now_wiping_confirm">将要清除您设备上的全部用户数据并且设备恢复成出厂设置。</string> </resources> </resources> packages/Keyguard/res/values/strings.xml +15 −0 Original line number Original line Diff line number Diff line Loading @@ -383,6 +383,21 @@ This is displayed if the phone is not connected to a carrier.--> This is displayed if the phone is not connected to a carrier.--> <string name="keyguard_carrier_default">No service.</string> <string name="keyguard_carrier_default">No service.</string> <string name="kg_remaining_attempts">Remaining attempts: <xliff:g id="number">%d</xliff:g></string> <string name="kg_remaining_attempts">Remaining attempts: <xliff:g id="number">%d</xliff:g></string> <string name="kg_failed_pin_attempts_now_wiping"> You entered the wrong PIN <xliff:g id="number">%d</xliff:g> times, do you want to reset your phone to factory settings? </string> <string name="kg_failed_password_attempts_now_wiping"> You entered the wrong Password <xliff:g id="number">%d</xliff:g> times, do you want to reset your phone to factory settings? </string> <string name="kg_failed_pattern_attempts_now_wiping"> You entered the wrong Pattern <xliff:g id="number">%d</xliff:g> times, do you want to reset your phone to factory settings? </string> <string name="kg_failed_attempts_now_wiping_confirm"> This will erase all data from your device\'s internal storage and your device will be back to factory settings. </string> <!-- Dismiss button text in SIM pin/puk unlock view --> <!-- Dismiss button text in SIM pin/puk unlock view --> <string name="kg_dismiss">Dismiss</string> <string name="kg_dismiss">Dismiss</string> Loading packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -262,7 +262,7 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit private String getWrongPasswordMessage() { private String getWrongPasswordMessage() { String msg = getContext().getString(R.string.kg_wrong_pattern); String msg = getContext().getString(R.string.kg_wrong_pattern); if (getRemainingCount() >= 0) { if ((mMaxCountdownTimes > 0) && (getRemainingCount() >= 0)) { msg += " - " + getContext().getResources().getString(R.string.kg_remaining_attempts, msg += " - " + getContext().getResources().getString(R.string.kg_remaining_attempts, getRemainingCount()); getRemainingCount()); } } Loading packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java +74 −3 Original line number Original line Diff line number Diff line Loading @@ -16,8 +16,11 @@ package com.android.keyguard; package com.android.keyguard; import android.app.Activity; import android.app.Activity; import android.app.ActivityManager; import android.app.AlertDialog; import android.app.AlertDialog; import android.content.Context; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.util.AttributeSet; import android.util.AttributeSet; import android.util.Log; import android.util.Log; import android.util.Slog; import android.util.Slog; Loading @@ -44,6 +47,8 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe private final KeyguardUpdateMonitor mUpdateMonitor; private final KeyguardUpdateMonitor mUpdateMonitor; private WipeConfirmListener mWipeConfirmListener = null; // Used to notify the container when something interesting happens. // Used to notify the container when something interesting happens. public interface SecurityCallback { public interface SecurityCallback { public boolean dismiss(boolean authenticated); public boolean dismiss(boolean authenticated); Loading Loading @@ -218,6 +223,64 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe showDialog(null, message); showDialog(null, message); } } private void showCountdownWipeDialog(int attempts) { int msgId = R.string.kg_failed_attempts_now_wiping; switch (mSecurityModel.getSecurityMode()) { case PIN: msgId = R.string.kg_failed_pin_attempts_now_wiping; break; case Password: msgId = R.string.kg_failed_password_attempts_now_wiping; break; case Pattern: msgId = R.string.kg_failed_pattern_attempts_now_wiping; break; } if (mWipeConfirmListener == null) { mWipeConfirmListener = new WipeConfirmListener(); } final AlertDialog dialog = new AlertDialog.Builder(mContext) .setMessage(mContext.getString(msgId, attempts)) .setNegativeButton(com.android.internal.R.string.gpsVerifYes,// reuse public Yes/No new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { showWipeConfirmDialog(); } }) .setPositiveButton(com.android.internal.R.string.gpsVerifNo, mWipeConfirmListener) .setCancelable(false) .create(); if (!(mContext instanceof Activity)) { dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG); } dialog.show(); } private void showWipeConfirmDialog() { final AlertDialog dialog = new AlertDialog.Builder(mContext) .setMessage(R.string.kg_failed_attempts_now_wiping_confirm) .setNegativeButton(com.android.internal.R.string.gpsVerifYes, mWipeConfirmListener) .setPositiveButton(com.android.internal.R.string.gpsVerifNo, mWipeConfirmListener) .setCancelable(false) .create(); if (!(mContext instanceof Activity)) { dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG); } dialog.show(); } private class WipeConfirmListener implements DialogInterface.OnClickListener { public void onClick(DialogInterface dialog, int which) { if (DialogInterface.BUTTON_POSITIVE == which) { KeyguardUpdateMonitor.getInstance(mContext).clearFailedUnlockAttempts(); } else { if (ActivityManager.isUserAMonkey()) return; Intent wipeIntent = new Intent("android.intent.action.MASTER_CLEAR"); mContext.sendBroadcast(wipeIntent); } } } private void showAlmostAtAccountLoginDialog() { private void showAlmostAtAccountLoginDialog() { final int timeoutInSeconds = (int) LockPatternUtils.FAILED_ATTEMPT_TIMEOUT_MS / 1000; final int timeoutInSeconds = (int) LockPatternUtils.FAILED_ATTEMPT_TIMEOUT_MS / 1000; final int count = LockPatternUtils.FAILED_ATTEMPTS_BEFORE_RESET final int count = LockPatternUtils.FAILED_ATTEMPTS_BEFORE_RESET Loading @@ -235,6 +298,12 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe SecurityMode mode = mSecurityModel.getSecurityMode(); SecurityMode mode = mSecurityModel.getSecurityMode(); final boolean usingPattern = mode == KeyguardSecurityModel.SecurityMode.Pattern; final boolean usingPattern = mode == KeyguardSecurityModel.SecurityMode.Pattern; final boolean usingPIN = mode == KeyguardSecurityModel.SecurityMode.PIN; final boolean usingPassword = mode == KeyguardSecurityModel.SecurityMode.Password; final int maxCountdownTimes = mContext.getResources() .getInteger(R.integer.config_max_unlock_countdown_times); final boolean enableTimesCounter = maxCountdownTimes > 0 && (usingPattern || usingPIN || usingPassword); final int failedAttemptsBeforeWipe = mLockPatternUtils.getDevicePolicyManager() final int failedAttemptsBeforeWipe = mLockPatternUtils.getDevicePolicyManager() .getMaximumFailedPasswordsForWipe(null, mLockPatternUtils.getCurrentUser()); .getMaximumFailedPasswordsForWipe(null, mLockPatternUtils.getCurrentUser()); Loading @@ -247,7 +316,9 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe : Integer.MAX_VALUE; // because DPM returns 0 if no restriction : Integer.MAX_VALUE; // because DPM returns 0 if no restriction boolean showTimeout = false; boolean showTimeout = false; if (remainingBeforeWipe < LockPatternUtils.FAILED_ATTEMPTS_BEFORE_WIPE_GRACE) { if (enableTimesCounter && (failedAttempts >= maxCountdownTimes)) { showCountdownWipeDialog(failedAttempts); } else if (remainingBeforeWipe < LockPatternUtils.FAILED_ATTEMPTS_BEFORE_WIPE_GRACE) { // The user has installed a DevicePolicyManager that requests a user/profile to be wiped // The user has installed a DevicePolicyManager that requests a user/profile to be wiped // N attempts. Once we get below the grace period, we post this dialog every time as a // N attempts. Once we get below the grace period, we post this dialog every time as a // clear warning until the deletion fires. // clear warning until the deletion fires. Loading @@ -263,8 +334,8 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe showWipeDialog(failedAttempts); showWipeDialog(failedAttempts); } } } else { } else { showTimeout = showTimeout = !enableTimesCounter && (failedAttempts % LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT) == 0; ((failedAttempts % LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT) == 0); if (usingPattern && mEnableFallback) { if (usingPattern && mEnableFallback) { if (failedAttempts == failedAttemptWarning) { if (failedAttempts == failedAttemptWarning) { showAlmostAtAccountLoginDialog(); showAlmostAtAccountLoginDialog(); Loading Loading
packages/Keyguard/res/values-zh-rCN/strings.xml +4 −0 Original line number Original line Diff line number Diff line Loading @@ -161,4 +161,8 @@ <item quantity="other" msgid="2215723361575359486">"输入 SIM PIN,您还有<xliff:g id="NUMBER">%d</xliff:g>次尝试机会。"</item> <item quantity="other" msgid="2215723361575359486">"输入 SIM PIN,您还有<xliff:g id="NUMBER">%d</xliff:g>次尝试机会。"</item> </plurals> </plurals> <string name="kg_remaining_attempts">剩余次数: <xliff:g id="number">%d</xliff:g></string> <string name="kg_remaining_attempts">剩余次数: <xliff:g id="number">%d</xliff:g></string> <string name="kg_failed_pin_attempts_now_wiping">您输入了<xliff:g id="number">%d</xliff:g>次错误的PIN, 是否重启并恢复出厂设置?</string> <string name="kg_failed_password_attempts_now_wiping">您输入了<xliff:g id="number">%d</xliff:g>次错误的密码, 是否重启并恢复出厂设置?</string> <string name="kg_failed_pattern_attempts_now_wiping">您输入了<xliff:g id="number">%d</xliff:g>次错误图案, 是否重启并恢复出厂设置?</string> <string name="kg_failed_attempts_now_wiping_confirm">将要清除您设备上的全部用户数据并且设备恢复成出厂设置。</string> </resources> </resources>
packages/Keyguard/res/values/strings.xml +15 −0 Original line number Original line Diff line number Diff line Loading @@ -383,6 +383,21 @@ This is displayed if the phone is not connected to a carrier.--> This is displayed if the phone is not connected to a carrier.--> <string name="keyguard_carrier_default">No service.</string> <string name="keyguard_carrier_default">No service.</string> <string name="kg_remaining_attempts">Remaining attempts: <xliff:g id="number">%d</xliff:g></string> <string name="kg_remaining_attempts">Remaining attempts: <xliff:g id="number">%d</xliff:g></string> <string name="kg_failed_pin_attempts_now_wiping"> You entered the wrong PIN <xliff:g id="number">%d</xliff:g> times, do you want to reset your phone to factory settings? </string> <string name="kg_failed_password_attempts_now_wiping"> You entered the wrong Password <xliff:g id="number">%d</xliff:g> times, do you want to reset your phone to factory settings? </string> <string name="kg_failed_pattern_attempts_now_wiping"> You entered the wrong Pattern <xliff:g id="number">%d</xliff:g> times, do you want to reset your phone to factory settings? </string> <string name="kg_failed_attempts_now_wiping_confirm"> This will erase all data from your device\'s internal storage and your device will be back to factory settings. </string> <!-- Dismiss button text in SIM pin/puk unlock view --> <!-- Dismiss button text in SIM pin/puk unlock view --> <string name="kg_dismiss">Dismiss</string> <string name="kg_dismiss">Dismiss</string> Loading
packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -262,7 +262,7 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit private String getWrongPasswordMessage() { private String getWrongPasswordMessage() { String msg = getContext().getString(R.string.kg_wrong_pattern); String msg = getContext().getString(R.string.kg_wrong_pattern); if (getRemainingCount() >= 0) { if ((mMaxCountdownTimes > 0) && (getRemainingCount() >= 0)) { msg += " - " + getContext().getResources().getString(R.string.kg_remaining_attempts, msg += " - " + getContext().getResources().getString(R.string.kg_remaining_attempts, getRemainingCount()); getRemainingCount()); } } Loading
packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java +74 −3 Original line number Original line Diff line number Diff line Loading @@ -16,8 +16,11 @@ package com.android.keyguard; package com.android.keyguard; import android.app.Activity; import android.app.Activity; import android.app.ActivityManager; import android.app.AlertDialog; import android.app.AlertDialog; import android.content.Context; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.util.AttributeSet; import android.util.AttributeSet; import android.util.Log; import android.util.Log; import android.util.Slog; import android.util.Slog; Loading @@ -44,6 +47,8 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe private final KeyguardUpdateMonitor mUpdateMonitor; private final KeyguardUpdateMonitor mUpdateMonitor; private WipeConfirmListener mWipeConfirmListener = null; // Used to notify the container when something interesting happens. // Used to notify the container when something interesting happens. public interface SecurityCallback { public interface SecurityCallback { public boolean dismiss(boolean authenticated); public boolean dismiss(boolean authenticated); Loading Loading @@ -218,6 +223,64 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe showDialog(null, message); showDialog(null, message); } } private void showCountdownWipeDialog(int attempts) { int msgId = R.string.kg_failed_attempts_now_wiping; switch (mSecurityModel.getSecurityMode()) { case PIN: msgId = R.string.kg_failed_pin_attempts_now_wiping; break; case Password: msgId = R.string.kg_failed_password_attempts_now_wiping; break; case Pattern: msgId = R.string.kg_failed_pattern_attempts_now_wiping; break; } if (mWipeConfirmListener == null) { mWipeConfirmListener = new WipeConfirmListener(); } final AlertDialog dialog = new AlertDialog.Builder(mContext) .setMessage(mContext.getString(msgId, attempts)) .setNegativeButton(com.android.internal.R.string.gpsVerifYes,// reuse public Yes/No new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { showWipeConfirmDialog(); } }) .setPositiveButton(com.android.internal.R.string.gpsVerifNo, mWipeConfirmListener) .setCancelable(false) .create(); if (!(mContext instanceof Activity)) { dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG); } dialog.show(); } private void showWipeConfirmDialog() { final AlertDialog dialog = new AlertDialog.Builder(mContext) .setMessage(R.string.kg_failed_attempts_now_wiping_confirm) .setNegativeButton(com.android.internal.R.string.gpsVerifYes, mWipeConfirmListener) .setPositiveButton(com.android.internal.R.string.gpsVerifNo, mWipeConfirmListener) .setCancelable(false) .create(); if (!(mContext instanceof Activity)) { dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG); } dialog.show(); } private class WipeConfirmListener implements DialogInterface.OnClickListener { public void onClick(DialogInterface dialog, int which) { if (DialogInterface.BUTTON_POSITIVE == which) { KeyguardUpdateMonitor.getInstance(mContext).clearFailedUnlockAttempts(); } else { if (ActivityManager.isUserAMonkey()) return; Intent wipeIntent = new Intent("android.intent.action.MASTER_CLEAR"); mContext.sendBroadcast(wipeIntent); } } } private void showAlmostAtAccountLoginDialog() { private void showAlmostAtAccountLoginDialog() { final int timeoutInSeconds = (int) LockPatternUtils.FAILED_ATTEMPT_TIMEOUT_MS / 1000; final int timeoutInSeconds = (int) LockPatternUtils.FAILED_ATTEMPT_TIMEOUT_MS / 1000; final int count = LockPatternUtils.FAILED_ATTEMPTS_BEFORE_RESET final int count = LockPatternUtils.FAILED_ATTEMPTS_BEFORE_RESET Loading @@ -235,6 +298,12 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe SecurityMode mode = mSecurityModel.getSecurityMode(); SecurityMode mode = mSecurityModel.getSecurityMode(); final boolean usingPattern = mode == KeyguardSecurityModel.SecurityMode.Pattern; final boolean usingPattern = mode == KeyguardSecurityModel.SecurityMode.Pattern; final boolean usingPIN = mode == KeyguardSecurityModel.SecurityMode.PIN; final boolean usingPassword = mode == KeyguardSecurityModel.SecurityMode.Password; final int maxCountdownTimes = mContext.getResources() .getInteger(R.integer.config_max_unlock_countdown_times); final boolean enableTimesCounter = maxCountdownTimes > 0 && (usingPattern || usingPIN || usingPassword); final int failedAttemptsBeforeWipe = mLockPatternUtils.getDevicePolicyManager() final int failedAttemptsBeforeWipe = mLockPatternUtils.getDevicePolicyManager() .getMaximumFailedPasswordsForWipe(null, mLockPatternUtils.getCurrentUser()); .getMaximumFailedPasswordsForWipe(null, mLockPatternUtils.getCurrentUser()); Loading @@ -247,7 +316,9 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe : Integer.MAX_VALUE; // because DPM returns 0 if no restriction : Integer.MAX_VALUE; // because DPM returns 0 if no restriction boolean showTimeout = false; boolean showTimeout = false; if (remainingBeforeWipe < LockPatternUtils.FAILED_ATTEMPTS_BEFORE_WIPE_GRACE) { if (enableTimesCounter && (failedAttempts >= maxCountdownTimes)) { showCountdownWipeDialog(failedAttempts); } else if (remainingBeforeWipe < LockPatternUtils.FAILED_ATTEMPTS_BEFORE_WIPE_GRACE) { // The user has installed a DevicePolicyManager that requests a user/profile to be wiped // The user has installed a DevicePolicyManager that requests a user/profile to be wiped // N attempts. Once we get below the grace period, we post this dialog every time as a // N attempts. Once we get below the grace period, we post this dialog every time as a // clear warning until the deletion fires. // clear warning until the deletion fires. Loading @@ -263,8 +334,8 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe showWipeDialog(failedAttempts); showWipeDialog(failedAttempts); } } } else { } else { showTimeout = showTimeout = !enableTimesCounter && (failedAttempts % LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT) == 0; ((failedAttempts % LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT) == 0); if (usingPattern && mEnableFallback) { if (usingPattern && mEnableFallback) { if (failedAttempts == failedAttemptWarning) { if (failedAttempts == failedAttemptWarning) { showAlmostAtAccountLoginDialog(); showAlmostAtAccountLoginDialog(); Loading