@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // On API 19+ devices, we make the status bar become transparent. In older devices, we simply
    // remove the status bar.
    if (VERSION.SDK_INT >= VERSION_CODES.KITKAT) {
      getWindow().getDecorView().setSystemUiVisibility(
          View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
      // On API 21+ we need to set the status bar color to transparent color instead of using flag
      // FLAG_TRANSLUCENT_STATUS as in API 19, 20 to make the the status bar transparent.
      if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) {
        getWindow().setStatusBarColor(Color.TRANSPARENT);
      } else {
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
            WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
      }
    } else {
      getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
          WindowManager.LayoutParams.FLAG_FULLSCREEN);
    }

    mStartFromAddAccountActivity = getIntent()
        .getBooleanExtra(INTENT_EXTRA_START_FROM_ADD_ACCOUNT, false);

    setContentView(R.layout.barcode_capture_activity);

    mCameraSourcePreview = (CameraSourcePreview) findViewById(R.id.camera_source_preview);
    mGraphicOverlay = (GraphicOverlay) findViewById(R.id.graphic_overlay);
    mCurrentRotation = getWindowManager().getDefaultDisplay().getRotation();

    mOrientationEventListener = new OrientationEventListener(this, SensorManager.SENSOR_DELAY_UI) {
      @Override
      public void onOrientationChanged(int i) {
        if (i == ORIENTATION_UNKNOWN) {
          return;
        }
        int rotation = getWindowManager().getDefaultDisplay().getRotation();
        if (mCurrentRotation != rotation) {
          // Orientation changed, refresh camera.
          mCurrentRotation = rotation;
          if (mCameraSourcePreview != null) {
            mCameraSourcePreview.stop();
            mCameraSourcePreview.release();
          }
          createCameraSource();
          startCameraSource();
        }
      }
    };
    if (mOrientationEventListener.canDetectOrientation() == true) {
      mOrientationEventListener.enable();
    } else {
      mOrientationEventListener.disable();
    }

    // Check for the camera permission before accessing the camera.  If the
    // permission is not granted yet, request permission.
    if (mPermissionRequestor.checkSelfPermission(this, Manifest.permission.CAMERA)
        == PackageManager.PERMISSION_GRANTED) {
      createCameraSource();
    } else {
      requestCameraPermission();
    }
  }
Activity for managing barcode capture.

The detected barcode value is returned as a result from this activity. If the app doesn't have
the camera permission, it will try to request the permission.
java/com/google/android/apps/authenticator/barcode/BarcodeCaptureActivity.java