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

Commit a242d220 authored by Igor Murashkin's avatar Igor Murashkin Committed by Android (Google) Code Review
Browse files

Merge "camera2: Legacy, lie about AE/AF regions (reported as 0)"

parents 7305b87b d25388c1
Loading
Loading
Loading
Loading
+17 −4
Original line number Diff line number Diff line
@@ -85,7 +85,9 @@ public class LegacyMetadataMapper {
     * being set to true.
     */
    static final boolean LIE_ABOUT_AE_STATE = true;
    static final boolean LIE_ABOUT_AE_MAX_REGIONS = true;
    static final boolean LIE_ABOUT_AF = true;
    static final boolean LIE_ABOUT_AF_MAX_REGIONS = true;
    static final boolean LIE_ABOUT_AWB = true;

    /**
@@ -365,12 +367,23 @@ public class LegacyMetadataMapper {
        /*
         * android.control.maxRegions
         */
        final int AE = 0, AWB = 1, AF = 2;

        int[] maxRegions = new int[3];
        maxRegions[0] = p.getMaxNumMeteringAreas();
        maxRegions[1] = 0; // AWB regions not supported in API1
        maxRegions[2] = p.getMaxNumFocusAreas();
        maxRegions[AE] = p.getMaxNumMeteringAreas();
        maxRegions[AWB] = 0; // AWB regions not supported in API1
        maxRegions[AF] = p.getMaxNumFocusAreas();

        if (LIE_ABOUT_AE_MAX_REGIONS) {
            maxRegions[AE] = 0;
        }
        if (LIE_ABOUT_AF_MAX_REGIONS) {
            maxRegions[AF] = 0;
        }

        m.set(CONTROL_MAX_REGIONS, maxRegions);
        // TODO

        // TODO rest of control fields
    }

    private static void mapLens(CameraMetadataNative m, Camera.Parameters p) {
+11 −0
Original line number Diff line number Diff line
@@ -121,6 +121,17 @@ public class LegacyResultMapper {
            // TODO: Implement precapture trigger, after which we can report CONVERGED ourselves
            m.set(CONTROL_AE_STATE, CONTROL_AE_STATE_CONVERGED);
        }

        // control.aeRegions

        /*
         * TODO: Use the *resulting* crop region to calculate intersection with
         * metering region
         *
         * Report the sensor-relative metering region in the result even
         * if that's not actually the real thing (similar to how we do it
         * for zooming)
         */
    }