Merge "Camera: Don't override extension surface native format" into sc-dev am: 4b68ed1fe0

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15456451

Change-Id: Ia0d2943e429632399faef3b485aaa95eff97ef54
This commit is contained in:
Emilian Peev
2021-08-04 01:02:39 +00:00
committed by Automerger Merge Worker
2 changed files with 18 additions and 1 deletions

View File

@@ -75,7 +75,7 @@ public final class CameraExtensionUtils {
ImageWriter writer = null; ImageWriter writer = null;
Image img = null; Image img = null;
SurfaceInfo surfaceInfo = new SurfaceInfo(); SurfaceInfo surfaceInfo = new SurfaceInfo();
int nativeFormat = SurfaceUtils.getSurfaceFormat(s); int nativeFormat = SurfaceUtils.detectSurfaceFormat(s);
int dataspace = SurfaceUtils.getSurfaceDataspace(s); int dataspace = SurfaceUtils.getSurfaceDataspace(s);
Size surfaceSize = SurfaceUtils.getSurfaceSize(s); Size surfaceSize = SurfaceUtils.getSurfaceSize(s);
surfaceInfo.mFormat = nativeFormat; surfaceInfo.mFormat = nativeFormat;

View File

@@ -159,6 +159,23 @@ public class SurfaceUtils {
return surfaceType; 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. * Get the Surface dataspace.
* *