public static Intent createIntent(Context context,
boolean requirePassword, boolean confirmCredentials) {
- Intent intent = new Intent(context, ChooseLockPattern.class);
+ Intent intent = new Intent(context, ChooseLockPatternSize.class);
intent.putExtra("key_lock_method", "pattern");
intent.putExtra(ChooseLockGeneric.CONFIRM_CREDENTIALS, confirmCredentials);
intent.putExtra(EncryptionInterstitial.EXTRA_REQUIRE_PASSWORD, requirePassword);
private TextView mFooterRightButton;
protected List<LockPatternView.Cell> mChosenPattern = null;
+ private byte mPatternSize = LockPatternUtils.PATTERN_SIZE_DEFAULT;
+
/**
* The patten used during the help screen to show how to draw a pattern.
*/
- private final List<LockPatternView.Cell> mAnimatePattern =
- Collections.unmodifiableList(Lists.newArrayList(
- LockPatternView.Cell.of(0, 0),
- LockPatternView.Cell.of(0, 1),
- LockPatternView.Cell.of(1, 1),
- LockPatternView.Cell.of(2, 1)
- ));
+ private List<LockPatternView.Cell> mAnimatePattern;
@Override
public void onActivityResult(int requestCode, int resultCode,
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
+
+ mPatternSize = getActivity().getIntent().getByteExtra("pattern_size",
+ LockPatternUtils.PATTERN_SIZE_DEFAULT);
+ LockPatternView.Cell.updateSize(mPatternSize);
+ mAnimatePattern = Collections.unmodifiableList(Lists.newArrayList(
+ LockPatternView.Cell.of(0, 0, mPatternSize),
+ LockPatternView.Cell.of(0, 1, mPatternSize),
+ LockPatternView.Cell.of(1, 1, mPatternSize),
+ LockPatternView.Cell.of(2, 1, mPatternSize)
+ ));
+
return inflater.inflate(R.layout.choose_lock_pattern, container, false);
}
mLockPatternView.setOnPatternListener(mChooseNewLockPatternListener);
mLockPatternView.setTactileFeedbackEnabled(
mChooseLockSettingsHelper.utils().isTactileFeedbackEnabled());
+ mLockPatternView.setLockPatternUtils(mChooseLockSettingsHelper.utils());
+ mLockPatternView.setLockPatternSize(mPatternSize);
mFooterText = (TextView) view.findViewById(R.id.footerText);
// restore from previous state
final String patternString = savedInstanceState.getString(KEY_PATTERN_CHOICE);
if (patternString != null) {
- mChosenPattern = LockPatternUtils.stringToPattern(patternString);
+ LockPatternUtils utils = mChooseLockSettingsHelper.utils();
+ mChosenPattern = LockPatternUtils.stringToPattern(patternString,
+ utils.getLockPatternSize());
}
if (mCurrentPattern == null) {
outState.putInt(KEY_UI_STAGE, mUiStage.ordinal());
if (mChosenPattern != null) {
+ LockPatternUtils utils = mChooseLockSettingsHelper.utils();
outState.putString(KEY_PATTERN_CHOICE,
- LockPatternUtils.patternToString(mChosenPattern));
+ utils.patternToString(mChosenPattern));
}
if (mCurrentPattern != null) {
final boolean required = getActivity().getIntent().getBooleanExtra(
EncryptionInterstitial.EXTRA_REQUIRE_PASSWORD, true);
mSaveAndFinishWorker.start(mChooseLockSettingsHelper.utils(), required,
- mHasChallenge, mChallenge, mChosenPattern, mCurrentPattern);
+ mHasChallenge, mChallenge, mChosenPattern, mCurrentPattern, mPatternSize);
}
@Override
private List<LockPatternView.Cell> mChosenPattern;
private String mCurrentPattern;
private boolean mLockVirgin;
+ private byte mPatternSize;
public void start(LockPatternUtils utils, boolean credentialRequired,
boolean hasChallenge, long challenge,
- List<LockPatternView.Cell> chosenPattern, String currentPattern) {
+ List<LockPatternView.Cell> chosenPattern, String currentPattern, byte patternSize) {
prepare(utils, credentialRequired, hasChallenge, challenge);
mCurrentPattern = currentPattern;
mChosenPattern = chosenPattern;
+ mPatternSize = patternSize;
mLockVirgin = !mUtils.isPatternEverChosen(UserHandle.myUserId());
protected Intent saveAndVerifyInBackground() {
Intent result = null;
final int userId = UserHandle.myUserId();
+ mUtils.setLockPatternSize(mPatternSize);
mUtils.saveLockPattern(mChosenPattern, mCurrentPattern, userId);
if (mHasChallenge) {