Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 933a0768 authored by kaiyiz's avatar kaiyiz Committed by Gerrit - the friendly Code Review server
Browse files

Settings: Prompt wrong header when factory reset.

When enter factory data reset interface, it sent intent with the
string "Draw your unlock pattern" no matter type of screen lock.

Sent intent with right string due to type of screen lock.

CRs-Fixed: 754712

Change-Id: I933ce8577b52b9b577be3a8165809af5f313752e
parent 186789da
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ public final class ChooseLockSettingsHelper {
    private LockPatternUtils mLockPatternUtils;
    private Activity mActivity;
    private Fragment mFragment;
    private CharSequence mConfirmPasswordHeader;

    public ChooseLockSettingsHelper(Activity activity) {
        mActivity = activity;
@@ -79,12 +80,19 @@ public final class ChooseLockSettingsHelper {
            case DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC:
            case DevicePolicyManager.PASSWORD_QUALITY_COMPLEX:
                // TODO: update UI layout for ConfirmPassword to show message and details
                if (mConfirmPasswordHeader != null) {
                    message = mConfirmPasswordHeader;
                }
                launched = confirmPassword(request, message, returnCredentials);
                break;
        }
        return launched;
    }

    void setConfirmPassword(CharSequence message) {
        mConfirmPasswordHeader = message;
    }

    /**
     * Launch screen to confirm the existing lock pattern.
     * @param message shown in header of ConfirmLockPattern if not null
+17 −5
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.accounts.AccountManager;
import android.accounts.AuthenticatorDescription;
import android.app.Activity;
import android.app.Fragment;
import android.app.admin.DevicePolicyManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
@@ -40,6 +41,7 @@ import android.widget.Button;
import android.widget.CheckBox;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.android.internal.widget.LockPatternUtils;

/**
 * Confirm and execute a reset of the device to a clean "just out of the box"
@@ -62,7 +64,6 @@ public class MasterClear extends Fragment {
    private Button mInitiateButton;
    private View mExternalStorageContainer;
    private CheckBox mExternalStorage;

    /**
     * Keyguard validation is run using the standard {@link ConfirmLockPattern}
     * component as a subactivity
@@ -71,8 +72,19 @@ public class MasterClear extends Fragment {
     */
    private boolean runKeyguardConfirmation(int request) {
        Resources res = getActivity().getResources();
        return new ChooseLockSettingsHelper(getActivity(), this)
                .launchConfirmationActivity(request,
        int storedQuality = new LockPatternUtils(getActivity())
                .getKeyguardStoredPasswordQuality();
        boolean isAlpha = DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC == storedQuality
                || DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC == storedQuality
                || DevicePolicyManager.PASSWORD_QUALITY_COMPLEX == storedQuality;
        CharSequence message = isAlpha ?
                res.getText(R.string.lockpassword_confirm_your_password_header)
                : res.getText(R.string.lockpassword_confirm_your_pin_header);

        ChooseLockSettingsHelper chooseLockSettingsHelper = new ChooseLockSettingsHelper(
                getActivity(), this);
        chooseLockSettingsHelper.setConfirmPassword(message);
        return chooseLockSettingsHelper.launchConfirmationActivity(request,
                res.getText(R.string.master_clear_gesture_prompt),
                res.getText(R.string.master_clear_gesture_explanation));
    }