title: How to set android camera2 to ratio 18.5:9
body: <p>I try to implement camera2 to my app on Samsung Note 8, however, the image in preview is deformed.</p>
  
  <p>Preview Size : 2220x1080 (ratio 18.5:9)
  <BR>Camera Size : 1920x1080 (ratio 16:9)</p>
  
  <p>It seem that to fit the size of image from 1920x1080 to 2220x1080</p>
  
  <p>how to preview and capture image with full screen(2220x1080)?</p>
  
  <pre><code>public void createCameraPreviewSession() {
      try {
          SurfaceTexture texture = this.getSurfaceTexture();
          assert texture != null;
          texture.setDefaultBufferSize(previewSize.getWidth(), previewSize.getHeight());
          Surface surface = new Surface(texture);
          previewBuilder = cameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);
          previewBuilder.addTarget(surface);
          cameraDevice.createCaptureSession(Arrays.asList(surface, reader.getSurface()),
                  new CameraCaptureSession.StateCallback() {
                      @Override
                      public void onConfigured(@NonNull CameraCaptureSession cameraCaptureSession) {
                          if (null == cameraDevice) {
                              return;
                          }
                          previewSession = cameraCaptureSession;
                          thread = new HandlerThread("CameraPreview");
                          thread.start();
                          backgroundHandler = new Handler(thread.getLooper());
                          try {
                        previewBuilder.set(CaptureRequest.CONTROL_AF_MODE,CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);
                previewSession.setRepeatingRequest(previewBuilder.build(), null, backgroundHandler);
                          } catch (CameraAccessException e) {
                              e.printStackTrace();
                          }
                      }
                      @Override
                      public void onConfigureFailed(
                              @NonNull CameraCaptureSession cameraCaptureSession) {
                      }
                  }, null
          );
      } catch (CameraAccessException e) {
          e.printStackTrace();
      }
  }
  </code></pre>