Camera: Fix condition check for min/max zoom ratios
- minZoomRatio can be larger than 1.0f - assert both min and max zoom ratios to be greater than 0. - assert min zoom ratio to be equal or smaller than max zoom ratio. Test: CTS on Cuttlefish camera Bug: 153377715 Change-Id: Ia5d3f2ec7a51d4a35f199abe15a90c72cb7f3456
This commit is contained in:
@@ -16,8 +16,8 @@
|
||||
|
||||
package android.hardware.camera2.params;
|
||||
|
||||
import static com.android.internal.util.Preconditions.checkArgumentInRange;
|
||||
import static com.android.internal.util.Preconditions.checkArgumentNonnegative;
|
||||
import static com.android.internal.util.Preconditions.checkArgumentPositive;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.hardware.camera2.CameraCharacteristics;
|
||||
@@ -64,9 +64,15 @@ public final class Capability {
|
||||
"maxStreamingWidth must be nonnegative");
|
||||
mMaxStreamingHeight = checkArgumentNonnegative(maxStreamingHeight,
|
||||
"maxStreamingHeight must be nonnegative");
|
||||
mMinZoomRatio = checkArgumentInRange(minZoomRatio, 0.0f, 1.0f,
|
||||
"minZoomRatio must be between 0.0f and 1.0f");
|
||||
mMaxZoomRatio = maxZoomRatio;
|
||||
|
||||
if (minZoomRatio > maxZoomRatio) {
|
||||
throw new IllegalArgumentException("minZoomRatio " + minZoomRatio
|
||||
+ " is greater than maxZoomRatio " + maxZoomRatio);
|
||||
}
|
||||
mMinZoomRatio = checkArgumentPositive(minZoomRatio,
|
||||
"minZoomRatio must be positive");
|
||||
mMaxZoomRatio = checkArgumentPositive(maxZoomRatio,
|
||||
"maxZoomRatio must be positive");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user