@SuppressWarnings("deprecation") // TODO: refactor to use DialogFrament
  private void scanBarcode(boolean startFromAddAccountActivity) {
    // Check if the device has no camera. This check is for case when user click the Scan Barcode
    // option in the {@link AddAccountActivity}.
    if (!barcodeConditionChecker.isCameraAvailableOnDevice(this)) {
      showDialog(DIALOG_ID_CAMERA_NOT_AVAILABLE);
      return;
    }

    // Check that the device has google play services installed and
    // no earlier than the required version.
    if (!barcodeConditionChecker.isGooglePlayServicesAvailable(this)) {
      showDialog(DIALOG_ID_INSTALL_GOOGLE_PLAY_SERVICES);
      return;
    }

    // Note: The first time that an app using the barcode or face API is installed on a
    // device, GMS will download a native libraries to the device in order to do detection.
    // Usually this completes before the app is run for the first time.
    if (!barcodeConditionChecker.getIsBarcodeDetectorOperational(this)) {
      // Check for low storage.  If there is low storage, the native library will not be
      // downloaded, so detection will not become operational.
      if (barcodeConditionChecker.isLowStorage(this)) {
        showDialog(DIALOG_ID_LOW_STORAGE_FOR_BARCODE_SCANNER);
      } else {
        showDialog(DIALOG_ID_BARCODE_SCANNER_NOT_AVAILABLE);
      }
      return;
    }

    Intent intentScan = new Intent(this, BarcodeCaptureActivity.class);
    intentScan.putExtra(
        BarcodeCaptureActivity.INTENT_EXTRA_START_FROM_ADD_ACCOUNT, startFromAddAccountActivity);
    startActivityForResult(intentScan, SCAN_REQUEST);
  }
Invoked when a context menu/action bar item is clicked/tapped.

@return {@code true} if the event was consumed, {@code false} otherwise.
java/com/google/android/apps/authenticator/AuthenticatorActivity.java