diff options
| author | 2024-01-26 07:31:52 +0000 | |
|---|---|---|
| committer | 2024-01-26 19:57:26 +0000 | |
| commit | 2e10cad84bfe6a73e9e0787d478b5cbdfaa160d6 (patch) | |
| tree | be22ee8d0508f451bbcbcfaef064f02a0da5bc77 | |
| parent | 55432784c48652079b8b85e6be821a8ecca7bd62 (diff) | |
Camera: Add ability to match surface usage bits
- If an imageReader config is requested by the extensions,
allow ability to set the usage bits of the imageReader config
to be that of the client surface to prevent mismatch
between usage bits
Test: Camera CTS test
Bug: 318780113
Change-Id: Ifed71e91e32994ec39edb73353fd466b1bfaeeb6
3 files changed, 17 insertions, 2 deletions
diff --git a/core/java/android/hardware/camera2/extension/CameraOutputConfig.aidl b/core/java/android/hardware/camera2/extension/CameraOutputConfig.aidl index 7c54a9b01dde..509bcb8e3d23 100644 --- a/core/java/android/hardware/camera2/extension/CameraOutputConfig.aidl +++ b/core/java/android/hardware/camera2/extension/CameraOutputConfig.aidl @@ -26,6 +26,7 @@ parcelable CameraOutputConfig Surface surface; int imageFormat; int capacity; + long usage; const int TYPE_SURFACE = 0; const int TYPE_IMAGEREADER = 1; diff --git a/core/java/android/hardware/camera2/impl/CameraAdvancedExtensionSessionImpl.java b/core/java/android/hardware/camera2/impl/CameraAdvancedExtensionSessionImpl.java index 98bc31161591..f6c8f36a1b01 100644 --- a/core/java/android/hardware/camera2/impl/CameraAdvancedExtensionSessionImpl.java +++ b/core/java/android/hardware/camera2/impl/CameraAdvancedExtensionSessionImpl.java @@ -1182,7 +1182,8 @@ public final class CameraAdvancedExtensionSessionImpl extends CameraExtensionSes return null; } ImageReader reader = ImageReader.newInstance(output.size.width, - output.size.height, output.imageFormat, output.capacity); + output.size.height, output.imageFormat, output.capacity, + output.usage); mReaderMap.put(output.outputId.id, reader); return reader.getSurface(); case CameraOutputConfig.TYPE_MULTIRES_IMAGEREADER: diff --git a/packages/services/CameraExtensionsProxy/src/com/android/cameraextensions/CameraExtensionsProxyService.java b/packages/services/CameraExtensionsProxy/src/com/android/cameraextensions/CameraExtensionsProxyService.java index 3aa9cc84e9f6..155c523a96a7 100644 --- a/packages/services/CameraExtensionsProxy/src/com/android/cameraextensions/CameraExtensionsProxyService.java +++ b/packages/services/CameraExtensionsProxy/src/com/android/cameraextensions/CameraExtensionsProxyService.java @@ -132,7 +132,7 @@ public class CameraExtensionsProxyService extends Service { private static final String CAMERA_EXTENSION_VERSION_NAME = "androidx.camera.extensions.impl.ExtensionVersionImpl"; - private static final String LATEST_VERSION = "1.4.0"; + private static final String LATEST_VERSION = "1.5.0"; // No support for the init sequence private static final String NON_INIT_VERSION_PREFIX = "1.0"; // Support advanced API and latency queries @@ -1693,6 +1693,7 @@ public class CameraExtensionsProxyService extends Service { private final Size mSize; private final int mImageFormat; private final int mDataspace; + private final long mUsage; public OutputSurfaceImplStub(OutputSurface outputSurface) { mSurface = outputSurface.surface; @@ -1700,8 +1701,10 @@ public class CameraExtensionsProxyService extends Service { mImageFormat = outputSurface.imageFormat; if (mSurface != null) { mDataspace = SurfaceUtils.getSurfaceDataspace(mSurface); + mUsage = SurfaceUtils.getSurfaceUsage(mSurface); } else { mDataspace = -1; + mUsage = 0; } } @@ -1724,6 +1727,11 @@ public class CameraExtensionsProxyService extends Service { public int getDataspace() { return mDataspace; } + + @Override + public long getUsage() { + return mUsage; + } } private class PreviewExtenderImplStub extends IPreviewExtenderImpl.Stub implements @@ -2471,6 +2479,11 @@ public class CameraExtensionsProxyService extends Service { ret.size.height = imageReaderOutputConfig.getSize().getHeight(); ret.imageFormat = imageReaderOutputConfig.getImageFormat(); ret.capacity = imageReaderOutputConfig.getMaxImages(); + if (EFV_SUPPORTED) { + ret.usage = imageReaderOutputConfig.getUsage(); + } else { + ret.usage = 0; + } } else if (output instanceof MultiResolutionImageReaderOutputConfigImpl) { MultiResolutionImageReaderOutputConfigImpl multiResReaderConfig = (MultiResolutionImageReaderOutputConfigImpl) output; |