private final void initLockPatternView() {
    LockPatternView.DisplayMode lastDisplayMode =
        lockPatternView != null ? lockPatternView.getDisplayMode() : null;
    List<LockPatternView.Cell> lastPattern =
        lockPatternView != null ? lockPatternView.getPattern() : null;

    switch (getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) {
      case Configuration.SCREENLAYOUT_SIZE_LARGE:
      case Configuration.SCREENLAYOUT_SIZE_XLARGE:
        {
          final int size = getResources().getDimensionPixelSize(R.dimen.lock_pattern_view_size);
          ViewGroup.LayoutParams lp = lockPatternView.getLayoutParams();
          lp.width = size;
          lp.height = size;
          lockPatternView.setLayoutParams(lp);

          break;
        } // LARGE / XLARGE
    }

    boolean hapticFeedbackEnabled = false;
    try {
      hapticFeedbackEnabled =
          Settings.System.getInt(getContentResolver(), Settings.System.HAPTIC_FEEDBACK_ENABLED, 0)
              != 0;
    } catch (Throwable t) {
      /** Ignore it. */
    }
    lockPatternView.setTactileFeedbackEnabled(hapticFeedbackEnabled);
    lockPatternView.setOnPatternListener(this);
    lockPatternView.setInStealthMode(
        stealthMode && lockPatternType != LockPatternType.VERIFY_CAPTCHA);

    if (lastPattern != null
        && lastDisplayMode != null
        && lockPatternType != LockPatternType.VERIFY_CAPTCHA) {
      lockPatternView.setPattern(lastDisplayMode, lastPattern);
    }
  }