Prevent hdrSdrRatio from being <1.f
Bug: 273807650 Test: speculative Change-Id: I5ecc9cafa67212f7ec6bc5eb860caa3143819675
This commit is contained in:
@@ -3896,10 +3896,12 @@ public final class SurfaceControl implements Parcelable {
|
||||
float currentBufferRatio, float desiredRatio) {
|
||||
checkPreconditions(sc);
|
||||
if (!Float.isFinite(currentBufferRatio) || currentBufferRatio < 1.0f) {
|
||||
throw new IllegalArgumentException("currentBufferRatio must be finite && >= 1.0f");
|
||||
throw new IllegalArgumentException(
|
||||
"currentBufferRatio must be finite && >= 1.0f; got " + currentBufferRatio);
|
||||
}
|
||||
if (!Float.isFinite(desiredRatio) || desiredRatio < 1.0f) {
|
||||
throw new IllegalArgumentException("desiredRatio must be finite && >= 1.0f");
|
||||
throw new IllegalArgumentException(
|
||||
"desiredRatio must be finite && >= 1.0f; got " + desiredRatio);
|
||||
}
|
||||
nativeSetExtendedRangeBrightness(mNativeObject, sc.mNativeObject, currentBufferRatio,
|
||||
desiredRatio);
|
||||
|
||||
@@ -911,7 +911,8 @@ final class LocalDisplayAdapter extends DisplayAdapter {
|
||||
final float newHdrSdrRatio;
|
||||
if (displayNits != DisplayDeviceConfig.NITS_INVALID
|
||||
&& sdrNits != DisplayDeviceConfig.NITS_INVALID) {
|
||||
newHdrSdrRatio = displayNits / sdrNits;
|
||||
// Ensure the ratio stays >= 1.0f as values below that are nonsensical
|
||||
newHdrSdrRatio = Math.max(1.f, displayNits / sdrNits);
|
||||
} else {
|
||||
newHdrSdrRatio = Float.NaN;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user