codec2 hal: add the AIDL adaptation layer [step 2]

Implement AIDL interfaces. Graphic buffer passing and input surface
are not complete yet.

Bug: 251850069
Test: m libcodec2_aidl && m
Change-Id: I71608e2528794106239ebb487d327eb19b062ee1
diff --git a/media/codec2/hal/aidl/Android.bp b/media/codec2/hal/aidl/Android.bp
index b19f78c..a9a00be 100644
--- a/media/codec2/hal/aidl/Android.bp
+++ b/media/codec2/hal/aidl/Android.bp
@@ -50,100 +50,94 @@
 }
 
 // DO NOT DEPEND ON THIS DIRECTLY
-// use libcodec2-hidl-defaults instead
-//cc_library {
-//    name: "libcodec2_hidl@1.0",
-//    vendor_available: true,
-//    min_sdk_version: "29",
-//    apex_available: [
-//        "//apex_available:platform",
-//        "com.android.media.swcodec",
-//    ],
-//
-//    defaults: ["hidl_defaults"],
-//
-//    srcs: [
-//        "Component.cpp",
-//        "ComponentInterface.cpp",
-//        "ComponentStore.cpp",
-//        "Configurable.cpp",
-//        "InputBufferManager.cpp",
-//        "InputSurface.cpp",
-//        "InputSurfaceConnection.cpp",
-//        "types.cpp",
-//    ],
-//
-//    header_libs: [
-//        "libbinder_headers",
-//        "libcodec2_hal_common",
-//        "libcodec2_internal", // private
-//        "libsystem_headers",
-//    ],
-//
-//    shared_libs: [
-//        "android.hardware.graphics.bufferqueue@1.0",
-//        "android.hardware.graphics.bufferqueue@2.0",
-//        "android.hardware.graphics.common@1.0",
-//        "android.hardware.media@1.0",
-//        "android.hardware.media.bufferpool@2.0",
-//        "android.hardware.media.c2@1.0",
-//        "android.hardware.media.omx@1.0",
-//        "libbase",
-//        "libcodec2",
-//        "libcodec2_vndk",
-//        "libcodec2_hidl_plugin_stub",
-//        "libcutils",
-//        "libhidlbase",
-//        "liblog",
-//        "libstagefright_bufferpool@2.0.1",
-//        "libstagefright_bufferqueue_helper_novndk",
-//        "libui",
-//        "libutils",
-//    ],
-//
-//    target: {
-//        vendor: {
-//            exclude_shared_libs: [
-//                "libstagefright_bufferqueue_helper_novndk",
-//                "libcodec2_hidl_plugin_stub",
-//            ],
-//            shared_libs: [
-//                "libstagefright_bufferqueue_helper",
-//                "libcodec2_hidl_plugin",
-//            ],
-//        },
-//        apex: {
-//            exclude_shared_libs: [
-//                "libcodec2_hidl_plugin",
-//                "libcodec2_hidl_plugin_stub",
-//            ],
-//        },
-//    },
-//
-//    export_include_dirs: [
-//        "include",
-//    ],
-//
-//    export_shared_lib_headers: [
-//        "android.hardware.media.c2@1.0",
-//        "libcodec2",
-//        "libcodec2_vndk",
-//        "libhidlbase",
-//        "libstagefright_bufferpool@2.0.1",
-//        "libui",
-//    ],
-//}
-//
-//// public dependency for Codec 2.0 HAL service implementations
-//cc_defaults {
-//    name: "libcodec2-hidl-defaults@1.0",
-//    defaults: ["libcodec2-impl-defaults"],
-//
-//    shared_libs: [
-//        "android.hardware.media.c2@1.0",
-//        "libcodec2_hidl@1.0",
-//    ],
-//}
+// use libcodec2-aidl-defaults instead
+cc_library {
+    name: "libcodec2_aidl",
+    vendor_available: true,
+    min_sdk_version: "34",
+    apex_available: [
+        "//apex_available:platform",
+        "com.android.media.swcodec",
+        "test_com.android.media.swcodec",
+    ],
+
+    srcs: [
+        "BufferTypes.cpp",
+        "Component.cpp",
+        "ComponentInterface.cpp",
+        "ComponentStore.cpp",
+        "Configurable.cpp",
+        "InputBufferManager.cpp",
+        "ParamTypes.cpp",
+    ],
+
+    header_libs: [
+        "libcodec2_internal", // private
+    ],
+
+    shared_libs: [
+        "android.hardware.common-V2-ndk",
+        "android.hardware.media.bufferpool2-V1-ndk",
+        "android.hardware.media.c2-V1-ndk",
+        "libbase",
+        "libbinder_ndk",
+        "libcodec2",
+        "libcodec2_hal_common",
+        "libcodec2_hidl_plugin_stub",
+        "libcodec2_vndk",
+        "libcutils",
+        "libhidlbase",
+        "liblog",
+        "libstagefright_aidl_bufferpool2",
+        "libstagefright_bufferpool@2.0.1",
+        "libui",
+        "libutils",
+    ],
+
+    static_libs: [
+        "libaidlcommonsupport",
+    ],
+
+    target: {
+        vendor: {
+            exclude_shared_libs: [
+                "libcodec2_hidl_plugin_stub",
+            ],
+            shared_libs: [
+                "libcodec2_hidl_plugin",
+            ],
+        },
+        apex: {
+            exclude_shared_libs: [
+                "libcodec2_hidl_plugin_stub",
+                "libcodec2_hidl_plugin",
+            ],
+        },
+    },
+
+    export_include_dirs: [
+        "include",
+    ],
+
+    export_shared_lib_headers: [
+        "android.hardware.media.c2-V1-ndk",
+        "libcodec2",
+        "libstagefright_bufferpool@2.0.1",
+        "libui",
+    ],
+}
+
+// public dependency for Codec 2.0 HAL service implementations
+cc_defaults {
+    name: "libcodec2-aidl-defaults",
+    min_sdk_version: "34",
+    defaults: ["libcodec2-impl-defaults"],
+
+    shared_libs: [
+        "android.hardware.media.c2-V1-ndk",
+        "libcodec2_aidl",
+    ],
+}
 
 // public dependency for Codec 2.0 HAL client
 cc_defaults {