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

Commit 8544c7da authored by Yin-Chia Yeh's avatar Yin-Chia Yeh Committed by Android (Google) Code Review
Browse files

Merge "camera2: make 3A regions null when not available" into lmp-dev

parents 31913c33 808150f0
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -731,6 +731,8 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
    /**
     * <p>List of areas to use for
     * metering.</p>
     * <p>Optional. Not available if {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AE android.control.maxRegionsAe} is 0.
     * Otherwise will always be present.</p>
     * <p>The coordinate system is based on the active pixel array,
     * with (0,0) being the top-left pixel in the active pixel array, and
     * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1,
@@ -746,7 +748,9 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
     * outside the used {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} returned in capture result metadata,
     * the camera device will ignore the sections outside the region and output the
     * used sections in the result metadata.</p>
     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
     *
     * @see CameraCharacteristics#CONTROL_MAX_REGIONS_AE
     * @see CaptureRequest#SCALER_CROP_REGION
     * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
     */
@@ -820,6 +824,8 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
    /**
     * <p>List of areas to use for focus
     * estimation.</p>
     * <p>Optional. Not available if {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AF android.control.maxRegionsAf} is 0.
     * Otherwise will always be present.</p>
     * <p>The coordinate system is based on the active pixel array,
     * with (0,0) being the top-left pixel in the active pixel array, and
     * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1,
@@ -835,7 +841,9 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
     * outside the used {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} returned in capture result metadata,
     * the camera device will ignore the sections outside the region and output the
     * used sections in the result metadata.</p>
     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
     *
     * @see CameraCharacteristics#CONTROL_MAX_REGIONS_AF
     * @see CaptureRequest#SCALER_CROP_REGION
     * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
     */
@@ -921,6 +929,8 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
    /**
     * <p>List of areas to use for illuminant
     * estimation.</p>
     * <p>Optional. Not available if {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AWB android.control.maxRegionsAwb} is 0.
     * Otherwise will always be present.</p>
     * <p>The coordinate system is based on the active pixel array,
     * with (0,0) being the top-left pixel in the active pixel array, and
     * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1,
@@ -936,7 +946,9 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
     * outside the used {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} returned in capture result metadata,
     * the camera device will ignore the sections outside the region and output the
     * used sections in the result metadata.</p>
     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
     *
     * @see CameraCharacteristics#CONTROL_MAX_REGIONS_AWB
     * @see CaptureRequest#SCALER_CROP_REGION
     * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
     */
+12 −0
Original line number Diff line number Diff line
@@ -582,6 +582,8 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
    /**
     * <p>List of areas to use for
     * metering.</p>
     * <p>Optional. Not available if {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AE android.control.maxRegionsAe} is 0.
     * Otherwise will always be present.</p>
     * <p>The coordinate system is based on the active pixel array,
     * with (0,0) being the top-left pixel in the active pixel array, and
     * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1,
@@ -597,7 +599,9 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
     * outside the used {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} returned in capture result metadata,
     * the camera device will ignore the sections outside the region and output the
     * used sections in the result metadata.</p>
     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
     *
     * @see CameraCharacteristics#CONTROL_MAX_REGIONS_AE
     * @see CaptureRequest#SCALER_CROP_REGION
     * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
     */
@@ -870,6 +874,8 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
    /**
     * <p>List of areas to use for focus
     * estimation.</p>
     * <p>Optional. Not available if {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AF android.control.maxRegionsAf} is 0.
     * Otherwise will always be present.</p>
     * <p>The coordinate system is based on the active pixel array,
     * with (0,0) being the top-left pixel in the active pixel array, and
     * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1,
@@ -885,7 +891,9 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
     * outside the used {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} returned in capture result metadata,
     * the camera device will ignore the sections outside the region and output the
     * used sections in the result metadata.</p>
     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
     *
     * @see CameraCharacteristics#CONTROL_MAX_REGIONS_AF
     * @see CaptureRequest#SCALER_CROP_REGION
     * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
     */
@@ -1369,6 +1377,8 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
    /**
     * <p>List of areas to use for illuminant
     * estimation.</p>
     * <p>Optional. Not available if {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AWB android.control.maxRegionsAwb} is 0.
     * Otherwise will always be present.</p>
     * <p>The coordinate system is based on the active pixel array,
     * with (0,0) being the top-left pixel in the active pixel array, and
     * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1,
@@ -1384,7 +1394,9 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
     * outside the used {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} returned in capture result metadata,
     * the camera device will ignore the sections outside the region and output the
     * used sections in the result metadata.</p>
     * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
     *
     * @see CameraCharacteristics#CONTROL_MAX_REGIONS_AWB
     * @see CaptureRequest#SCALER_CROP_REGION
     * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
     */
+30 −8
Original line number Diff line number Diff line
@@ -675,15 +675,13 @@ public class LegacyMetadataMapper {
         * request.availableRequestKeys
         */
        {
            CaptureRequest.Key<?> availableKeys[] = new CaptureRequest.Key<?>[] {
            CaptureRequest.Key<?> defaultAvailableKeys[] = new CaptureRequest.Key<?>[] {
                    CaptureRequest.CONTROL_AE_ANTIBANDING_MODE,
                    CaptureRequest.CONTROL_AE_EXPOSURE_COMPENSATION,
                    CaptureRequest.CONTROL_AE_LOCK,
                    CaptureRequest.CONTROL_AE_MODE,
                    CaptureRequest.CONTROL_AE_REGIONS,
                    CaptureRequest.CONTROL_AE_TARGET_FPS_RANGE,
                    CaptureRequest.CONTROL_AF_MODE,
                    CaptureRequest.CONTROL_AF_REGIONS,
                    CaptureRequest.CONTROL_AF_TRIGGER,
                    CaptureRequest.CONTROL_AWB_LOCK,
                    CaptureRequest.CONTROL_AWB_MODE,
@@ -704,21 +702,32 @@ public class LegacyMetadataMapper {
                    CaptureRequest.SCALER_CROP_REGION,
                    CaptureRequest.STATISTICS_FACE_DETECT_MODE,
            };
            m.set(REQUEST_AVAILABLE_REQUEST_KEYS, getTagsForKeys(availableKeys));
            ArrayList<CaptureRequest.Key<?>> availableKeys =
                    new ArrayList<CaptureRequest.Key<?>>(Arrays.asList(defaultAvailableKeys));

            if (p.getMaxNumMeteringAreas() > 0) {
                availableKeys.add(CaptureRequest.CONTROL_AE_REGIONS);
            }
            if (p.getMaxNumFocusAreas() > 0) {
                availableKeys.add(CaptureRequest.CONTROL_AF_REGIONS);
            }

            CaptureRequest.Key<?> availableRequestKeys[] =
                    new CaptureRequest.Key<?>[availableKeys.size()];
            availableKeys.toArray(availableRequestKeys);
            m.set(REQUEST_AVAILABLE_REQUEST_KEYS, getTagsForKeys(availableRequestKeys));
        }

        /*
         * request.availableResultKeys
         */
        {
            CaptureResult.Key<?> availableKeys[] = new CaptureResult.Key<?>[] {
            CaptureResult.Key<?> defaultAvailableKeys[] = new CaptureResult.Key<?>[] {
                    CaptureResult.CONTROL_AE_ANTIBANDING_MODE                      ,
                    CaptureResult.CONTROL_AE_EXPOSURE_COMPENSATION                 ,
                    CaptureResult.CONTROL_AE_LOCK                                  ,
                    CaptureResult.CONTROL_AE_MODE                                  ,
                    CaptureResult.CONTROL_AE_REGIONS                               ,
                    CaptureResult.CONTROL_AF_MODE                                  ,
                    CaptureResult.CONTROL_AF_REGIONS                               ,
                    CaptureResult.CONTROL_AF_STATE                                 ,
                    CaptureResult.CONTROL_AWB_MODE                                 ,
                    CaptureResult.CONTROL_AWB_LOCK                                 ,
@@ -737,7 +746,20 @@ public class LegacyMetadataMapper {
                    CaptureResult.STATISTICS_FACE_DETECT_MODE                      ,
//                    CaptureResult.STATISTICS_FACES                                 ,
            };
            m.set(REQUEST_AVAILABLE_RESULT_KEYS, getTagsForKeys(availableKeys));
            List<CaptureResult.Key<?>> availableKeys =
                    new ArrayList<CaptureResult.Key<?>>(Arrays.asList(defaultAvailableKeys));

            if (p.getMaxNumMeteringAreas() > 0) {
                availableKeys.add(CaptureResult.CONTROL_AE_REGIONS);
            }
            if (p.getMaxNumFocusAreas() > 0) {
                availableKeys.add(CaptureResult.CONTROL_AF_REGIONS);
            }

            CaptureResult.Key<?> availableResultKeys[] =
                    new CaptureResult.Key<?>[availableKeys.size()];
            availableKeys.toArray(availableResultKeys);
            m.set(REQUEST_AVAILABLE_RESULT_KEYS, getTagsForKeys(availableResultKeys));
        }

        /*
+2 −2
Original line number Diff line number Diff line
@@ -322,7 +322,7 @@ public class LegacyResultMapper {
        }

        // control.aeRegions
        {
        if (p.getMaxNumMeteringAreas() > 0) {
            if (VERBOSE) {
                String meteringAreas = p.get("metering-areas");
                Log.v(TAG, "mapAe - parameter dump; metering-areas: " + meteringAreas);
@@ -342,7 +342,7 @@ public class LegacyResultMapper {
        m.set(CaptureResult.CONTROL_AF_MODE, convertLegacyAfMode(p.getFocusMode()));

        // control.afRegions
        {
        if (p.getMaxNumFocusAreas() > 0) {
            if (VERBOSE) {
                String focusAreas = p.get("focus-areas");
                Log.v(TAG, "mapAe - parameter dump; focus-areas: " + focusAreas);