Fix 2594148: confirm PIN/Password before resetting device

This fixes a bug where user was allowed to factory reset the device
without entering their PIN/Password.

It also fixes the same issue with MediaFormat (Settings->SD Card->Format).

Change-Id: I0677a50aa771ad8663513fd7ec398a70953dcde2
This commit is contained in:
Jim Miller
2010-04-13 17:43:36 -07:00
parent fc5a02225e
commit 2deec7edc9
6 changed files with 36 additions and 33 deletions

View File

@@ -88,16 +88,11 @@ public class MediaFormat extends Activity {
* Keyguard validation is run using the standard {@link ConfirmLockPattern}
* component as a subactivity
*/
private void runKeyguardConfirmation() {
final Intent intent = new Intent();
intent.setClassName("com.android.settings",
"com.android.settings.ConfirmLockPattern");
// supply header and footer text in the intent
intent.putExtra(ConfirmLockPattern.HEADER_TEXT,
getText(R.string.media_format_gesture_prompt));
intent.putExtra(ConfirmLockPattern.FOOTER_TEXT,
getText(R.string.media_format_gesture_explanation));
startActivityForResult(intent, KEYGUARD_REQUEST);
private boolean runKeyguardConfirmation(int request) {
return new ChooseLockSettingsHelper(this)
.launchConfirmationActivity(request,
getText(R.string.media_format_gesture_prompt),
getText(R.string.media_format_gesture_explanation));
}
@Override
@@ -112,6 +107,8 @@ public class MediaFormat extends Activity {
// confirmation prompt; otherwise, go back to the initial state.
if (resultCode == Activity.RESULT_OK) {
establishFinalConfirmationState();
} else if (resultCode == Activity.RESULT_CANCELED) {
finish();
} else {
establishInitialState();
}
@@ -124,9 +121,7 @@ public class MediaFormat extends Activity {
*/
private Button.OnClickListener mInitiateListener = new Button.OnClickListener() {
public void onClick(View v) {
if (mLockUtils.isLockPatternEnabled()) {
runKeyguardConfirmation();
} else {
if (!runKeyguardConfirmation(KEYGUARD_REQUEST)) {
establishFinalConfirmationState();
}
}