code: public synchronized void setTorch(boolean newSetting) {
      if (newSetting != configManager.getTorchState(camera)) {
        if (camera != null) {
          if (autoFocusManager != null) {
            autoFocusManager.stop();
          }
          configManager.setTorch(camera, newSetting);
          if (autoFocusManager != null) {
            autoFocusManager.start();
          }
        }
      }
    }
docs: Convenience method for {@link info.vividcode.android.zxing.CaptureActivity}