title: Camera Source (Google Mobile Vision) returns rotated image on some devices
body: <p>I have the open sourced code for the Google Mobile Vision - CameraSource and this is the method I call to click a photo : cameraSource.takePicture();</p>
  
  <p>In the open sourced version of CameraSource.java, the method for determining screen orientation is the stock one: </p>
  
  <pre><code>private void setRotation(Camera camera, Camera.Parameters parameters, int cameraId) {
          WindowManager windowManager =
                  (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
          int degrees = 0;
          int rotation = windowManager.getDefaultDisplay().getRotation();
          switch (rotation) {
              case Surface.ROTATION_0:
                  degrees = 0;
                  break;
              case Surface.ROTATION_90:
                  degrees = 90;
                  break;
              case Surface.ROTATION_180:
                  degrees = 180;
                  break;
              case Surface.ROTATION_270:
                  degrees = 270;
                  break;
              default:
                  Log.e(TAG, "Bad rotation value: " + rotation);
          }
  
          CameraInfo cameraInfo = new CameraInfo();
          Camera.getCameraInfo(cameraId, cameraInfo);
  
          int angle;
          int displayAngle;
          if (cameraInfo.facing == CameraInfo.CAMERA_FACING_FRONT) {
              angle = (cameraInfo.orientation + degrees) % 360;
              displayAngle = (360 - angle) % 360; // compensate for it being mirrored
          } else {  // back-facing
              angle = (cameraInfo.orientation - degrees + 360) % 360;
              displayAngle = angle;
          }
  
          // This corresponds to the rotation constants in {@link Frame}.
          mRotation = angle / 90;
  
          camera.setDisplayOrientation(displayAngle);
          parameters.setRotation(angle);
      }
  </code></pre>
  
  <p>Here, the displayAngle and the angle are the same for Samsung, Lenovo and Yuntab H8. But the bitmap returned for backCamera is rotated differently in each of the device. I have to manually rotate the bitmap for each of the devices (Samsung : 90, Lenovo : 0 and Yuntab : 180)</p>
  
  <p>My requirement is that onPictureTaken should return a bitmap which matches the current display orientation. I am looking into this, since a long time but yet have to figure a way to the solution. Here below is my onPicturetaken() (called after taking picture):</p>
  
  <pre><code>  @Override
          public void onPictureTaken(byte[] bytes) {
              try {
                  BitmapFactory.Options options = new BitmapFactory.Options();
                  options.inSampleSize = 2;
                  bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length, currentCameraId == 0 ? options : null);
              }catch (Exception ex){
                  ex.printStackTrace();
                  Log.e("PictureTaken",ex.toString());
          }
      };
  </code></pre>