Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 20a1d7b5 authored by Ravneet Dhanjal's avatar Ravneet Dhanjal
Browse files

Camera: Set dynamic range profile only for valid requests

- In cases where the extension proxy service does not support
dynamic range profile or color space settings, the dynamic
range profile will be set to an invalid request of 0
causing session configuration errors
- Change CameraSessionConfig color space default to -1
in cases where it is not configured since default otherwise
will be 0 even in cases where it is not set, causing errors
since it corresponds to a valid color space

Test: CTS Test on oriole testing PCS
Bug: 329208021
Change-Id: I4730b6ecf8e06eccfbdf5de0debda61d2fd22f37
parent cc024ecd
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -25,5 +25,5 @@ parcelable CameraSessionConfig
    CameraMetadataNative sessionParameter;
    int sessionTemplateId;
    int sessionType;
    int colorSpace;
    int colorSpace = -1;
}
+26 −4
Original line number Diff line number Diff line
@@ -348,7 +348,23 @@ public final class CameraAdvancedExtensionSessionImpl extends CameraExtensionSes
            cameraOutput.setTimestampBase(OutputConfiguration.TIMESTAMP_BASE_SENSOR);
            cameraOutput.setReadoutTimestampEnabled(false);
            cameraOutput.setPhysicalCameraId(output.physicalCameraId);
            if (Flags.extension10Bit()) {
                boolean validDynamicRangeProfile = false;
                for (long profile = DynamicRangeProfiles.STANDARD;
                        profile < DynamicRangeProfiles.PUBLIC_MAX; profile <<= 1) {
                    if (output.dynamicRangeProfile == profile) {
                        validDynamicRangeProfile = true;
                        break;
                    }
                }
                if (validDynamicRangeProfile) {
                    cameraOutput.setDynamicRangeProfile(output.dynamicRangeProfile);
                } else {
                    Log.e(TAG, "Extension configured dynamic range profile "
                            + output.dynamicRangeProfile
                            + " is not valid, using default DynamicRangeProfile.STANDARD");
                }
            }
            outputList.add(cameraOutput);
            mCameraConfigMap.put(cameraOutput.getSurface(), output);
        }
@@ -363,9 +379,15 @@ public final class CameraAdvancedExtensionSessionImpl extends CameraExtensionSes
        SessionConfiguration sessionConfiguration = new SessionConfiguration(sessionType,
                outputList, new CameraExtensionUtils.HandlerExecutor(mHandler),
                new SessionStateHandler());
        if (sessionConfig.colorSpace != ColorSpaceProfiles.UNSPECIFIED) {
        if (Flags.extension10Bit()) {
            if (sessionConfig.colorSpace >= 0
                    && sessionConfig.colorSpace < ColorSpace.Named.values().length) {
                sessionConfiguration.setColorSpace(
                        ColorSpace.Named.values()[sessionConfig.colorSpace]);
            } else {
                Log.e(TAG, "Extension configured color space " + sessionConfig.colorSpace
                        + " is not valid, using default unspecified color space");
            }
        }
        if ((sessionConfig.sessionParameter != null) &&
                (!sessionConfig.sessionParameter.isEmpty())) {