Fix sublist bug (#501)

pull/513/head
Mattia Iavarone 5 years ago committed by GitHub
parent 8d3013ff53
commit 389da0467f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      cameraview/src/main/java/com/otaliastudios/cameraview/engine/Camera2Engine.java

@ -1173,16 +1173,19 @@ public class Camera2Engine extends CameraEngine implements ImageReader.OnImageAv
int maxReagionsAe = readCharacteristic(CameraCharacteristics.CONTROL_MAX_REGIONS_AE, 0); int maxReagionsAe = readCharacteristic(CameraCharacteristics.CONTROL_MAX_REGIONS_AE, 0);
int maxReagionsAwb = readCharacteristic(CameraCharacteristics.CONTROL_MAX_REGIONS_AWB, 0); int maxReagionsAwb = readCharacteristic(CameraCharacteristics.CONTROL_MAX_REGIONS_AWB, 0);
if (maxReagionsAf > 0) { if (maxReagionsAf > 0) {
int max = Math.min(maxReagionsAf, areas.size());
mRepeatingRequestBuilder.set(CaptureRequest.CONTROL_AF_REGIONS, mRepeatingRequestBuilder.set(CaptureRequest.CONTROL_AF_REGIONS,
areas.subList(0, maxReagionsAf).toArray(new MeteringRectangle[]{})); areas.subList(0, max).toArray(new MeteringRectangle[]{}));
} }
if (maxReagionsAe > 0) { if (maxReagionsAe > 0) {
int max = Math.min(maxReagionsAe, areas.size());
mRepeatingRequestBuilder.set(CaptureRequest.CONTROL_AE_REGIONS, mRepeatingRequestBuilder.set(CaptureRequest.CONTROL_AE_REGIONS,
areas.subList(0, maxReagionsAe).toArray(new MeteringRectangle[]{})); areas.subList(0, max).toArray(new MeteringRectangle[]{}));
} }
if (maxReagionsAwb > 0) { if (maxReagionsAwb > 0) {
int max = Math.min(maxReagionsAwb, areas.size());
mRepeatingRequestBuilder.set(CaptureRequest.CONTROL_AWB_REGIONS, mRepeatingRequestBuilder.set(CaptureRequest.CONTROL_AWB_REGIONS,
areas.subList(0, maxReagionsAwb).toArray(new MeteringRectangle[]{})); areas.subList(0, max).toArray(new MeteringRectangle[]{}));
} }
// 8. Set AF mode to AUTO so it doesn't use the CONTINUOUS schedule. // 8. Set AF mode to AUTO so it doesn't use the CONTINUOUS schedule.

Loading…
Cancel
Save