|
|
|
@ -177,7 +177,7 @@ public class Camera2RawFragment extends Fragment
|
|
|
|
|
/**
|
|
|
|
|
* Tag for the {@link Log}.
|
|
|
|
|
*/
|
|
|
|
|
private static final String TAG = "Camera2RawFragment";
|
|
|
|
|
private static final String TAG = "MpPreview";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Camera state: Device is closed.
|
|
|
|
@ -626,6 +626,7 @@ public class Camera2RawFragment extends Fragment
|
|
|
|
|
} else {
|
|
|
|
|
mTextureView.setSurfaceTextureListener(mSurfaceTextureListener);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mOrientationListener != null && mOrientationListener.canDetectOrientation()) {
|
|
|
|
|
mOrientationListener.enable();
|
|
|
|
|
}
|
|
|
|
@ -705,9 +706,11 @@ public class Camera2RawFragment extends Fragment
|
|
|
|
|
CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
|
|
|
|
|
|
|
|
|
|
// For still image captures, we use the largest available size.
|
|
|
|
|
Size largestJpeg = Collections.max(
|
|
|
|
|
Arrays.asList(map.getOutputSizes(ImageFormat.JPEG)),
|
|
|
|
|
new CompareSizesByArea());
|
|
|
|
|
Size[] resolutions = map.getHighResolutionOutputSizes(ImageFormat.JPEG);
|
|
|
|
|
if (resolutions == null) {
|
|
|
|
|
resolutions = map.getOutputSizes(ImageFormat.JPEG);
|
|
|
|
|
}
|
|
|
|
|
Size largestJpeg = Collections.max(Arrays.asList(resolutions), new CompareSizesByArea());
|
|
|
|
|
|
|
|
|
|
synchronized (mCameraStateLock) {
|
|
|
|
|
// Set up ImageReaders for JPEG and RAW outputs. Place these in a reference
|
|
|
|
@ -1033,7 +1036,7 @@ public class Camera2RawFragment extends Fragment
|
|
|
|
|
|
|
|
|
|
// Swap the view dimensions for calculation as needed if they are rotated relative to
|
|
|
|
|
// the sensor.
|
|
|
|
|
boolean swappedDimensions = totalRotation == 90 || totalRotation == 270;
|
|
|
|
|
final boolean swappedDimensions = totalRotation == 90 || totalRotation == 270;
|
|
|
|
|
int rotatedViewWidth = viewWidth;
|
|
|
|
|
int rotatedViewHeight = viewHeight;
|
|
|
|
|
int maxPreviewWidth = displaySize.x;
|
|
|
|
@ -1056,7 +1059,8 @@ public class Camera2RawFragment extends Fragment
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Find the best preview size for these view dimensions and configured JPEG size.
|
|
|
|
|
Size previewSize = chooseOptimalSize(map.getOutputSizes(SurfaceTexture.class),
|
|
|
|
|
|
|
|
|
|
final Size previewSize = chooseOptimalSize(map.getOutputSizes(SurfaceTexture.class),
|
|
|
|
|
rotatedViewWidth, rotatedViewHeight, maxPreviewWidth, maxPreviewHeight,
|
|
|
|
|
largestJpeg);
|
|
|
|
|
|
|
|
|
@ -1068,6 +1072,8 @@ public class Camera2RawFragment extends Fragment
|
|
|
|
|
previewSize.getWidth(), previewSize.getHeight());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Find rotation of device in degrees (reverse device orientation for front-facing
|
|
|
|
|
// cameras).
|
|
|
|
|
int rotation = (mCharacteristics.get(CameraCharacteristics.LENS_FACING) ==
|
|
|
|
|