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

Commit 67c5ba84 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Camera: Enable SurfaceView extension output" into udc-dev am: 83ddb864

parents 7638386f 83ddb864
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -541,7 +541,8 @@ public final class CameraExtensionCharacteristics {
    private static <T> boolean isOutputSupportedFor(Class<T> klass) {
        Objects.requireNonNull(klass, "klass must not be null");

        if (klass == android.graphics.SurfaceTexture.class) {
        if ((klass == android.graphics.SurfaceTexture.class) ||
                (klass == android.view.SurfaceView.class)) {
            return true;
        }

@@ -725,6 +726,12 @@ public final class CameraExtensionCharacteristics {
     * backward compatible cameras whereas other output classes are not guaranteed to be supported.
     * </p>
     *
     * <p>Starting with Android {@link android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE}
     * {@link android.view.SurfaceView} classes are also guaranteed to be supported and include
     * the same resolutions as {@link android.graphics.SurfaceTexture}.
     * Clients must set the desired SurfaceView resolution by calling
     * {@link android.view.SurfaceHolder#setFixedSize}.</p>
     *
     * @param extension the extension type
     * @param klass     a non-{@code null} {@link Class} object reference
     * @return non-modifiable list of available sizes or an empty list if the Surface output is not
+4 −2
Original line number Diff line number Diff line
@@ -62,8 +62,6 @@ import android.os.Handler;
import android.os.HandlerThread;
import android.os.RemoteException;
import android.util.Log;
import android.util.Pair;
import android.util.Range;
import android.util.Size;
import android.view.Surface;

@@ -270,6 +268,10 @@ public final class CameraAdvancedExtensionSessionImpl extends CameraExtensionSes
                }
            }

            // The extension processing logic needs to be able to match images to capture results via
            // image and result timestamps.
            cameraOutput.setTimestampBase(OutputConfiguration.TIMESTAMP_BASE_SENSOR);
            cameraOutput.setReadoutTimestampEnabled(false);
            cameraOutput.setPhysicalCameraId(output.physicalCameraId);
            outputList.add(cameraOutput);
            mCameraConfigMap.put(cameraOutput.getSurface(), output);
+10 −3
Original line number Diff line number Diff line
@@ -60,7 +60,6 @@ import android.os.RemoteException;
import android.util.Log;
import android.util.LongSparseArray;
import android.util.Pair;
import android.util.Range;
import android.util.Size;
import android.view.Surface;

@@ -478,13 +477,21 @@ public final class CameraExtensionSessionImpl extends CameraExtensionSession {
        ArrayList<CaptureStageImpl> sessionParamsList = new ArrayList<>();
        ArrayList<OutputConfiguration> outputList = new ArrayList<>();
        initializeRepeatingRequestPipeline();
        outputList.add(new OutputConfiguration(mCameraRepeatingSurface));
        OutputConfiguration previewOutput = new OutputConfiguration(mCameraRepeatingSurface);
        // The extension processing logic needs to be able to match images to capture results via
        // image and result timestamps.
        previewOutput.setTimestampBase(OutputConfiguration.TIMESTAMP_BASE_SENSOR);
        previewOutput.setReadoutTimestampEnabled(false);
        outputList.add(previewOutput);
        CaptureStageImpl previewSessionParams = mPreviewExtender.onPresetSession();
        if (previewSessionParams != null) {
            sessionParamsList.add(previewSessionParams);
        }
        initializeBurstCapturePipeline();
        outputList.add(new OutputConfiguration(mCameraBurstSurface));
        OutputConfiguration captureOutput = new OutputConfiguration(mCameraBurstSurface);
        captureOutput.setTimestampBase(OutputConfiguration.TIMESTAMP_BASE_SENSOR);
        captureOutput.setReadoutTimestampEnabled(false);
        outputList.add(captureOutput);
        CaptureStageImpl stillCaptureSessionParams = mImageExtender.onPresetSession();
        if (stillCaptureSessionParams != null) {
            sessionParamsList.add(stillCaptureSessionParams);
+2 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.graphics.ImageFormat;
import android.graphics.PixelFormat;
import android.hardware.HardwareBuffer;
import android.hardware.camera2.CameraExtensionCharacteristics;
import android.hardware.camera2.params.OutputConfiguration;
import android.hardware.camera2.params.StreamConfigurationMap;
@@ -149,6 +150,7 @@ public final class CameraExtensionUtils {
            SurfaceInfo surfaceInfo = querySurface(config.getSurface());
            if ((surfaceInfo.mFormat ==
                    CameraExtensionCharacteristics.NON_PROCESSING_INPUT_FORMAT) ||
                    ((surfaceInfo.mUsage & HardwareBuffer.USAGE_COMPOSER_OVERLAY) != 0) ||
                    // The default RGBA_8888 is also implicitly supported because camera will
                    // internally override it to
                    // 'CameraExtensionCharacteristics.NON_PROCESSING_INPUT_FORMAT'