Update prebuilts for mnc-docs

developers/build: fb039d88ed8e9183cae9ce510bf9c907d23ecc50
developers/samples/android: 7c3c09dcf092593adb8c13f8e15260f4da0a799a

Note: This was previously committed on May 18 2016, but wasn't
automerged. Replaying commit to bring browseable back into sync
downstream.

(cherry picked from commit 8e7e496ae9)
Bug: 29127946
Change-Id: I6275f830532c3c6ce006756aecc3c2ae7e06873d
This commit is contained in:
Trevor Johns
2016-05-18 00:47:32 -07:00
parent 1842261dea
commit 7e9f0673a1
72 changed files with 2033 additions and 680 deletions

View File

@@ -275,6 +275,11 @@ public class Camera2BasicFragment extends Fragment
*/
private boolean mFlashSupported;
/**
* Orientation of the camera sensor
*/
private int mSensorOrientation;
/**
* A {@link CameraCaptureSession.CaptureCallback} that handles events related to JPEG capture.
*/
@@ -515,19 +520,19 @@ public class Camera2BasicFragment extends Fragment
// Find out if we need to swap dimension to get the preview size relative to sensor
// coordinate.
int displayRotation = activity.getWindowManager().getDefaultDisplay().getRotation();
int sensorOrientation =
characteristics.get(CameraCharacteristics.SENSOR_ORIENTATION);
//noinspection ConstantConditions
mSensorOrientation = characteristics.get(CameraCharacteristics.SENSOR_ORIENTATION);
boolean swappedDimensions = false;
switch (displayRotation) {
case Surface.ROTATION_0:
case Surface.ROTATION_180:
if (sensorOrientation == 90 || sensorOrientation == 270) {
if (mSensorOrientation == 90 || mSensorOrientation == 270) {
swappedDimensions = true;
}
break;
case Surface.ROTATION_90:
case Surface.ROTATION_270:
if (sensorOrientation == 0 || sensorOrientation == 180) {
if (mSensorOrientation == 0 || mSensorOrientation == 180) {
swappedDimensions = true;
}
break;
@@ -821,7 +826,7 @@ public class Camera2BasicFragment extends Fragment
// Orientation
int rotation = activity.getWindowManager().getDefaultDisplay().getRotation();
captureBuilder.set(CaptureRequest.JPEG_ORIENTATION, ORIENTATIONS.get(rotation));
captureBuilder.set(CaptureRequest.JPEG_ORIENTATION, getOrientation(rotation));
CameraCaptureSession.CaptureCallback CaptureCallback
= new CameraCaptureSession.CaptureCallback() {
@@ -843,6 +848,20 @@ public class Camera2BasicFragment extends Fragment
}
}
/**
* Retrieves the JPEG orientation from the specified screen rotation.
*
* @param rotation The screen rotation.
* @return The JPEG orientation (one of 0, 90, 270, and 360)
*/
private int getOrientation(int rotation) {
// Sensor orientation is 90 for most devices, or 270 for some devices (eg. Nexus 5X)
// We have to take that into account and rotate JPEG properly.
// For devices with orientation of 90, we simply return our mapping from ORIENTATIONS.
// For devices with orientation of 270, we need to rotate the JPEG 180 degrees.
return (ORIENTATIONS.get(rotation) + mSensorOrientation + 270) % 360;
}
/**
* Unlock the focus. This method should be called when still image capture sequence is
* finished.