summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvichal Rakesh <arakesh@google.com>2023-10-02 17:39:41 -0700
committerAvichal Rakesh <arakesh@google.com>2023-11-14 15:55:20 -0800
commitc958161fba9c7da332dfe067d3d8438f8a44b03e (patch)
tree7fc63bd14997a9c6872e1683ef21ffa2927c4dbd
parent5448f87d839c8396fbdd6fd627a832f39f04336a (diff)
downloadinterfaces-c958161fba9c7da332dfe067d3d8438f8a44b03e.tar.gz
cameraservice: Add Surface to OutputConfiguration
The current interface uses NativeHandle to parcel NDK Surface over the stable interface. However, parceling objects as NativeHandle is deprecated as it was dependent on HIDL Token Manager, and interfaces must use Surfaces instead which are now parcelable over stable interface. This CL updates OutputConfiguration to add a `surfaces` field which should be used from here on out. The existing windowHandles field is marked deprecated. Bug: 283283111 Test: Camera vNDK implementation updated to use the new field with updated tests. FaceHAL also now uses the new field. Change-Id: Ia8d428e940689397acab9cb9b494132eb0a5ecdc
-rw-r--r--cameraservice/device/aidl/Android.bp10
-rw-r--r--cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/OutputConfiguration.aidl4
-rw-r--r--cameraservice/device/aidl/android/frameworks/cameraservice/device/OutputConfiguration.aidl19
-rw-r--r--cameraservice/service/aidl/Android.bp9
4 files changed, 37 insertions, 5 deletions
diff --git a/cameraservice/device/aidl/Android.bp b/cameraservice/device/aidl/Android.bp
index f22ad83..d43d81e 100644
--- a/cameraservice/device/aidl/Android.bp
+++ b/cameraservice/device/aidl/Android.bp
@@ -12,7 +12,10 @@ aidl_interface {
"android.hardware.common.fmq-V1",
"android.hardware.common-V2",
],
- frozen: true,
+ include_dirs: [
+ "frameworks/native/aidl/gui",
+ ],
+ frozen: false,
backend: {
cpp: {
enabled: false,
@@ -21,12 +24,15 @@ aidl_interface {
enabled: false,
},
ndk: {
+ additional_shared_libraries: [
+ "libnativewindow",
+ ],
vndk: {
enabled: true,
},
},
},
- vndk_use_version: "1",
+ vndk_use_version: "2",
versions_with_info: [
{
version: "1",
diff --git a/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/OutputConfiguration.aidl b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/OutputConfiguration.aidl
index 8943815..9546948 100644
--- a/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/OutputConfiguration.aidl
+++ b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/OutputConfiguration.aidl
@@ -34,6 +34,9 @@
package android.frameworks.cameraservice.device;
@VintfStability
parcelable OutputConfiguration {
+ /**
+ * @deprecated Use surfaces instead.
+ */
android.hardware.common.NativeHandle[] windowHandles;
android.frameworks.cameraservice.device.OutputConfiguration.Rotation rotation;
int windowGroupId;
@@ -41,6 +44,7 @@ parcelable OutputConfiguration {
int width;
int height;
boolean isDeferred;
+ android.view.Surface[] surfaces = {};
@Backing(type="int") @VintfStability
enum Rotation {
R0 = 0,
diff --git a/cameraservice/device/aidl/android/frameworks/cameraservice/device/OutputConfiguration.aidl b/cameraservice/device/aidl/android/frameworks/cameraservice/device/OutputConfiguration.aidl
index 449b80d..1057f78 100644
--- a/cameraservice/device/aidl/android/frameworks/cameraservice/device/OutputConfiguration.aidl
+++ b/cameraservice/device/aidl/android/frameworks/cameraservice/device/OutputConfiguration.aidl
@@ -17,6 +17,7 @@
package android.frameworks.cameraservice.device;
import android.hardware.common.NativeHandle;
+import android.view.Surface;
/**
* This describes camera output. It has configurations specific to a
@@ -54,6 +55,8 @@ parcelable OutputConfiguration {
* modify their input data. If such cases exist, client must have additional
* mechanisms to synchronize read and write accesses between consumers.
* [1]: Ref : frameworks/av/camera/ndk/include/camera/NdkCameraDevice.h
+ *
+ * @deprecated Use surfaces instead.
*/
NativeHandle[] windowHandles;
/**
@@ -97,4 +100,20 @@ parcelable OutputConfiguration {
* Ref:frameworks/base/core/java/android/hardware/camera2/params/OutputConfiguration.java
*/
boolean isDeferred;
+ /**
+ * These must be Surfaces owned by AImageReader, acquired using AImageReader_getWindow()[1].
+ *
+ * When this vector has more than one entry, surface sharing is enabled. Clients may take
+ * advantage of this in advanced use cases when they would require create more streams
+ * than the limits the camera device imposes [2]. In this case, more than one window
+ * must be attached to an OutputConfiguration so that they map to one camera stream.
+ * The outputs will share memory buffers whenever possible. Due to buffer
+ * sharing, client should be careful while adding Surface outputs that
+ * modify their input data. If such cases exist, client must have additional
+ * mechanisms to synchronize read and write accesses between consumers.
+ *
+ * [1]: Ref: frameworks/av/media/ndk/include/media/NdkImageReader.h
+ * [2]: Ref: frameworks/av/camera/ndk/include/camera/NdkCameraDevice.h
+ */
+ Surface[] surfaces = {};
}
diff --git a/cameraservice/service/aidl/Android.bp b/cameraservice/service/aidl/Android.bp
index 7b9cb3c..94629b2 100644
--- a/cameraservice/service/aidl/Android.bp
+++ b/cameraservice/service/aidl/Android.bp
@@ -9,9 +9,9 @@ aidl_interface {
stability: "vintf",
imports: [
"android.frameworks.cameraservice.common-V1",
- "android.frameworks.cameraservice.device-V1",
+ "android.frameworks.cameraservice.device-V2",
],
- frozen: true,
+ frozen: false,
backend: {
cpp: {
enabled: false,
@@ -20,12 +20,15 @@ aidl_interface {
enabled: false,
},
ndk: {
+ additional_shared_libraries: [
+ "libnativewindow",
+ ],
vndk: {
enabled: true,
},
},
},
- vndk_use_version: "1",
+ vndk_use_version: "2",
versions_with_info: [
{
version: "1",