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

Commit 49a1d7b7 authored by Igor Murashkin's avatar Igor Murashkin
Browse files

camera2: (legacy) Fixes for CaptureRequestTest#testAeModeAndLock

Change-Id: I5c1008cf34a9d98f67c36966e7cbf1c312979f97
parent 3e280b4b
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -84,10 +84,11 @@ public class LegacyMetadataMapper {
     * TODO: Remove these constants and strip out any code that previously relied on them
     * being set to true.
     */
    static final boolean LIE_ABOUT_AE_STATE = true;
    static final boolean LIE_ABOUT_AE_STATE = false;
    static final boolean LIE_ABOUT_AE_MAX_REGIONS = false;
    static final boolean LIE_ABOUT_AF = true;
    static final boolean LIE_ABOUT_AF_MAX_REGIONS = true;
    static final boolean LIE_ABOUT_AWB_STATE = false;
    static final boolean LIE_ABOUT_AWB = true;

    /**
@@ -330,16 +331,17 @@ public class LegacyMetadataMapper {
            List<String> flashModes = p.getSupportedFlashModes();

            String[] flashModeStrings = new String[] {
                    Camera.Parameters.FLASH_MODE_OFF,
                    Camera.Parameters.FLASH_MODE_AUTO,
                    Camera.Parameters.FLASH_MODE_ON,
                    Camera.Parameters.FLASH_MODE_RED_EYE,
                    // Map these manually
                    Camera.Parameters.FLASH_MODE_TORCH,
                    Camera.Parameters.FLASH_MODE_OFF,
            };
            int[] flashModeInts = new int[] {
                    CONTROL_AE_MODE_ON,
                    CONTROL_AE_MODE_ON_AUTO_FLASH,
                    CONTROL_AE_MODE_ON_ALWAYS_FLASH,
                    CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE
            };
            int[] aeAvail = ArrayUtils.convertStringListToIntArray(
+4 −0
Original line number Diff line number Diff line
@@ -182,6 +182,10 @@ public class LegacyRequestMapper {
                params.setAutoExposureLock(aeLock);
            }

            if (VERBOSE) {
                Log.v(TAG, "convertRequestToMetadata - control.aeLock set to " + aeLock);
            }

            // TODO: Don't add control.aeLock to availableRequestKeys if it's not supported
        }

+18 −3
Original line number Diff line number Diff line
@@ -80,19 +80,22 @@ public class LegacyResultMapper {
        /*
         * control.ae*
         */
        mapAe(result, activeArraySize, zoomData, /*out*/params);
        mapAe(result, request, activeArraySize, zoomData, /*out*/params);

        // control.awbLock
        result.set(CaptureResult.CONTROL_AWB_LOCK, params.getAutoWhiteBalanceLock());

        // control.awbState
        if (LegacyMetadataMapper.LIE_ABOUT_AWB) {
        if (LegacyMetadataMapper.LIE_ABOUT_AWB_STATE) {
            // Lie to pass CTS temporarily.
            // TODO: CTS needs to be updated not to query this value
            // for LIMITED devices unless its guaranteed to be available.
            result.set(CaptureResult.CONTROL_AWB_STATE,
                    CameraMetadata.CONTROL_AWB_STATE_CONVERGED);
            // TODO: Read the awb mode from parameters instead
        }

        if (LegacyMetadataMapper.LIE_ABOUT_AWB) {
            result.set(CaptureResult.CONTROL_AWB_MODE,
                    request.get(CaptureRequest.CONTROL_AWB_MODE));
        }
@@ -119,7 +122,7 @@ public class LegacyResultMapper {
    }

    private static void mapAe(CameraMetadataNative m,
            Rect activeArray, ZoomData zoomData, /*out*/Parameters p) {
            CaptureRequest request, Rect activeArray, ZoomData zoomData, /*out*/Parameters p) {
        // control.aeAntiBandingMode
        {
            int antiBandingMode = LegacyMetadataMapper.convertAntiBandingModeOrDefault(
@@ -136,6 +139,18 @@ public class LegacyResultMapper {
        {
            boolean lock = p.isAutoExposureLockSupported() ? p.getAutoExposureLock() : false;
            m.set(CONTROL_AE_LOCK, lock);
            if (VERBOSE) {
                Log.v(TAG,
                        "mapAe - android.control.aeLock = " + lock +
                        ", supported = " + p.isAutoExposureLockSupported());
            }

            Boolean requestLock = request.get(CaptureRequest.CONTROL_AE_LOCK);
            if (requestLock != null && requestLock != lock) {
                Log.w(TAG,
                        "mapAe - android.control.aeLock was requested to " + requestLock +
                        " but resulted in " + lock);
            }
        }

        // control.aeMode, flash.mode