title: Image Capturing in Camera2 Api after zooming
body: <p>trying to use camera2 api, needs a functionality in which user can tap/untap to zoom in &amp; zoom out.</p>
  
  <p>Used this code for zooming</p>
  
  <pre><code>                CameraManager manager = (CameraManager) activity.getSystemService(Context.CAMERA_SERVICE);
                  CameraCharacteristics characteristics = manager.getCameraCharacteristics(cameraId);
                  float maxzoom = (characteristics.get(CameraCharacteristics.SCALER_AVAILABLE_MAX_DIGITAL_ZOOM)) * 10;
                  Rect m = characteristics.get(CameraCharacteristics.SENSOR_INFO_ACTIVE_ARRAY_SIZE);
  
                  int minW = (int) (m.width() / maxzoom);
                  int minH = (int) (m.height() / maxzoom);
                  int difW = m.width() - minW;
                  int difH = m.height() - minH;
                  int cropW = 0, cropH = 0;
                  if (!touchFlagForZoom) {
                      cropW = difW / 100 * (int) 25;
                      cropH = difH / 100 * (int) 25;
                      touchFlagForZoom = true;
  
                  } else {
                      cropW = difW / 100 * (int) 0;
                      cropH = difH / 100 * (int) 0;
                      touchFlagForZoom = false;
  
                  }
                  cropW -= cropW &amp; 3;
                  cropH -= cropH &amp; 3;
                  Rect zoom = new Rect(cropW, cropH, m.width() - cropW, m.height() - cropH);
                  captureRequestBuilder.set(CaptureRequest.SCALER_CROP_REGION, zoom);
  
  
                  try {
                      cameraCaptureSessions
                              .setRepeatingRequest(captureRequestBuilder.build(), null, null);
                  } catch (CameraAccessException e) {
                      e.printStackTrace();
                  } catch (NullPointerException ex) {
                      ex.printStackTrace();
                  }
  </code></pre>
  
  <p><strong>Problem</strong>
  It works very perfect for preview but when I captured the image after zoom, It get me the un-zoomed bitmap. </p>