@Override
    public View onCreateView(
        LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
      View view = inflater.inflate(R.layout.confirm_lock_gesture, null);
      mHeaderTextView = (TextView) view.findViewById(R.id.headerText);
      mLockGestureView = (LockGestureView) view.findViewById(R.id.lockGesture);
      mFooterTextView = (TextView) view.findViewById(R.id.footerText);

      // make it so unhandled touch events within the unlock screen go to the
      // lock gesture view.
      final LinearLayoutWithDefaultTouchRecepient topLayout =
          (LinearLayoutWithDefaultTouchRecepient) view.findViewById(R.id.topLayout);
      topLayout.setDefaultTouchRecepient(mLockGestureView);

      Intent intent = getActivity().getIntent();
      if (intent != null) {
        mHeaderText = intent.getCharSequenceExtra(HEADER_TEXT);
        mFooterText = intent.getCharSequenceExtra(FOOTER_TEXT);
        mHeaderWrongText = intent.getCharSequenceExtra(HEADER_WRONG_TEXT);
        mFooterWrongText = intent.getCharSequenceExtra(FOOTER_WRONG_TEXT);
      }

      mLockGestureView.setOnGestureListener(mConfirmExistingLockGestureListener);
      updateStage(Stage.NeedToUnlock);

      if (savedInstanceState != null) {
        mNumWrongConfirmAttempts = savedInstanceState.getInt(KEY_NUM_WRONG_ATTEMPTS);
      } else {
        // on first launch, if no lock gesture is set, then finish with
        // success (don't want user to get stuck confirming something that
        // doesn't exist).
        if (!mLockPatternUtils.savedGestureExists()) {
          getActivity().setResult(Activity.RESULT_OK);
          getActivity().finish();
        }
      }
      return view;
    }