Merge "Revert "Introducing IVibratorController and IVibratorControlService"" into main
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 @@
         "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 @@
             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 @@
   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 @@
      * 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 @@
      * 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 @@
     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 @@
             enabled: false,
         },
         ndk: {
+            additional_shared_libraries: [
+                "libnativewindow",
+            ],
             vndk: {
                 enabled: true,
             },
         },
     },
-    vndk_use_version: "1",
+    vndk_use_version: "2",
     versions_with_info: [
         {
             version: "1",