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

Commit a72b3e92 authored by Emilian Peev's avatar Emilian Peev
Browse files

Camera: Don't override extension surface native format

Avoid overriding the native extension surface format when
retrieving the surface parameters.
The native surface format can later be used to configure
the device extension so the original value must be known.

Bug: 195366395
Test: atest -c
cts/tests/camera/src/android/hardware/camera2/cts/CameraExtensionSessionTest.java

Change-Id: I52d091fd782dc9ca2af60ba42ec1c5bbe080c1ca
parent d9f207c0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -75,7 +75,7 @@ public final class CameraExtensionUtils {
        ImageWriter writer = null;
        Image img = null;
        SurfaceInfo surfaceInfo = new SurfaceInfo();
        int nativeFormat = SurfaceUtils.getSurfaceFormat(s);
        int nativeFormat = SurfaceUtils.detectSurfaceFormat(s);
        int dataspace = SurfaceUtils.getSurfaceDataspace(s);
        Size surfaceSize = SurfaceUtils.getSurfaceSize(s);
        surfaceInfo.mFormat = nativeFormat;
+17 −0
Original line number Diff line number Diff line
@@ -159,6 +159,23 @@ public class SurfaceUtils {
        return surfaceType;
    }

    /**
     * Detect and retrieve the Surface format without any
     * additional overrides.
     *
     * @param surface The surface to be queried for format.
     * @return format of the surface.
     *
     * @throws IllegalArgumentException if the surface is already abandoned.
     */
    public static int detectSurfaceFormat(Surface surface) {
        checkNotNull(surface);
        int surfaceType = nativeDetectSurfaceType(surface);
        if (surfaceType == BAD_VALUE) throw new IllegalArgumentException("Surface was abandoned");

        return surfaceType;
    }

    /**
     * Get the Surface dataspace.
     *