@Override
        public void run() {
          if (!mBarcodeDetected) {
            mBarcodeDetected = true;
            mCameraSourcePreview.stop();
            AudioManager audioService = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
            if (audioService.getRingerMode() == AudioManager.RINGER_MODE_NORMAL) {
              ToneGenerator toneGenerator
                  = new ToneGenerator(AudioManager.STREAM_MUSIC, TONE_VOLUME);
              toneGenerator.startTone(ToneGenerator.TONE_CDMA_PIP, TONE_DURATION);
            }
            onBarcodeDetected(barcode);
          }
        }
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