// Allocate the image reader to store all images received from the
// camera.
+ if (pictureSize == null) {
+ // If no picture size is specified, use the largest supported size.
+ StreamConfigurationMap configs = characteristics.get(
+ CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
+ android.util.Size[] supportedSizes = configs.getOutputSizes(sCaptureImageFormat);
+
+ // Find the largest supported size.
+ android.util.Size largestSupportedSize = supportedSizes[0];
+ long largestSupportedSizePixels = largestSupportedSize.getWidth()
+ * largestSupportedSize.getHeight();
+ for (int i = 0; i < supportedSizes.length; i++) {
+ long numPixels = supportedSizes[i].getWidth() * supportedSizes[i].getHeight();
+ if (numPixels > largestSupportedSizePixels) {
+ largestSupportedSize = supportedSizes[i];
+ largestSupportedSizePixels = numPixels;
+ }
+ }
+
+ pictureSize = new Size(largestSupportedSize.getWidth(),
+ largestSupportedSize.getHeight());
+ }
mCaptureImageReader = ImageReader.newInstance(pictureSize.getWidth(),
pictureSize.getHeight(),
sCaptureImageFormat, MAX_CAPTURE_IMAGES);
// Waits Settings3A.getFocusHoldMillis() milliseconds before sending
// a request for a regular preview stream to resume.
mCameraHandler.postAtTime(new Runnable() {
- @Override
+ @Override
public void run() {
mAERegions = ZERO_WEIGHT_3A_REGION;
mAFRegions = ZERO_WEIGHT_3A_REGION;