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

Commit b3f80544 authored by Austin Borger's avatar Austin Borger
Browse files

Camera: Set CONTROL_CAPTURE_INTENT to STILL_CAPTURE for reprocessing

The legacy camera API would do this by default for reprocessing capture
requests, but this behavior was not carried over into Camera2.

Bug: 252869710
Test: Ran new CTS test on cuttlefish.
Change-Id: I6414aef8d5fd6726a53a73568a7eda6e2d88e1c5
parent c0ff8e96
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1310,6 +1310,10 @@ public abstract class CameraDevice implements AutoCloseable {
     * {@link Surface}, submitting a reprocess {@link CaptureRequest} with multiple
     * output targets will result in a {@link CaptureFailure}.
     *
     * From Android 14 onward, {@link CaptureRequest#CONTROL_CAPTURE_INTENT} will be set to
     * {@link CameraMetadata#CONTROL_CAPTURE_INTENT_STILL_CAPTURE} by default. Prior to Android 14,
     * apps will need to explicitly set this key themselves.
     *
     * @param inputResult The capture result of the output image or one of the output images used
     *                       to generate the reprocess input image for this capture request.
     *
+8 −2
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.hardware.camera2.CameraCaptureSession;
import android.hardware.camera2.CameraCharacteristics;
import android.hardware.camera2.CameraDevice;
import android.hardware.camera2.CameraExtensionCharacteristics;
import android.hardware.camera2.CameraMetadata;
import android.hardware.camera2.CameraOfflineSession;
import android.hardware.camera2.CaptureFailure;
import android.hardware.camera2.CaptureRequest;
@@ -861,8 +862,13 @@ public class CameraDeviceImpl extends CameraDevice
            CameraMetadataNative resultMetadata = new
                    CameraMetadataNative(inputResult.getNativeCopy());

            return new CaptureRequest.Builder(resultMetadata, /*reprocess*/true,
                    inputResult.getSessionId(), getId(), /*physicalCameraIdSet*/ null);
            CaptureRequest.Builder builder = new CaptureRequest.Builder(resultMetadata,
                    /*reprocess*/true, inputResult.getSessionId(), getId(),
                    /*physicalCameraIdSet*/ null);
            builder.set(CaptureRequest.CONTROL_CAPTURE_INTENT,
                    CameraMetadata.CONTROL_CAPTURE_INTENT_STILL_CAPTURE);

            return builder;
        }
    }