title: Android Camera 2 API 1fps using setRepeatingRequest
body: <p>I want to take 1fps still captures using Camera 2 API's <code>setRepeatingRequest()</code> mode.</p>
  
  <p>I set the <code>CONTROL_AE_MODE</code> to <code>CONTROL_AE_MODE_OFF</code> and <code>SENSOR_FRAME_DURATION</code> to <code>1</code>. However I still receive a very high frame rate of 20fps with the below code.</p>
  
  <p>I tried changing the capture request template from <code>TEMPLATE_PREVIEW</code> to <code>TEMPLATE_STILL_CAPTURE</code> without any luck. How do I achieve 1fps using setRepeatingRequest()?</p>
  
  <pre><code>CaptureRequest.Builder requestBuilder
              = cameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);
      requestBuilder.addTarget(imageReader.getSurface());
          cameraDevice.createCaptureSession(Collections.singletonList(imageReader.getSurface()),
              new CameraCaptureSession.StateCallback() {
  
                  @Override
                  public void onConfigured(@NonNull CameraCaptureSession cameraCaptureSession) {
                      // The camera is already closed
                      if (cameraDevice == null) {
                          return;
                      }
  
                      captureSession = cameraCaptureSession;
                      try {
                          requestBuilder.set(CaptureRequest.CONTROL_AF_MODE,
                                  CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);
                          requestBuilder.set(CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_OFF);
                          requestBuilder.set(CaptureRequest.SENSOR_FRAME_DURATION, 1L);
  
                          CameraCaptureSession.CaptureCallback captureCallback
                                  = new CameraCaptureSession.CaptureCallback() {
  
                              @Override
                              public void onCaptureCompleted(@NonNull CameraCaptureSession session,
                                      @NonNull CaptureRequest request,
                                      @NonNull TotalCaptureResult result) {
                              }
                          };
  
                          captureSession.setRepeatingRequest(
                                  requestBuilder.build(), captureCallback, callbackHandler);
                      } catch (CameraAccessException e) {
                          e.printStackTrace();
                      }
                  }
  
                  @Override
                  public void onConfigureFailed(
                          @NonNull CameraCaptureSession cameraCaptureSession) {
                  }
              }, null);
  } catch (CameraAccessException e) {
      e.printStackTrace();
  }
  </code></pre>