Audio HAL: Factorize Android.bp

Lots of Android.bp content was duplicated per version.

Bug: 118203066
Test: compile
Change-Id: I4072314f1e1278c6d876fc681ba20363728f151b
Signed-off-by: Kevin Rocard <krocard@google.com>
diff --git a/audio/common/all-versions/default/Android.bp b/audio/common/all-versions/default/Android.bp
index 6b09d54..e062105 100644
--- a/audio/common/all-versions/default/Android.bp
+++ b/audio/common/all-versions/default/Android.bp
@@ -39,9 +39,10 @@
     ]
 }
 
-cc_library_shared {
-    name: "android.hardware.audio.common@2.0-util",
+cc_defaults {
+    name: "android.hardware.audio.common-util_default",
     defaults: ["hidl_defaults"],
+
     vendor_available: true,
     srcs: [
         "HidlUtils.cpp",
@@ -49,15 +50,11 @@
 
     export_include_dirs: ["."],
 
-    static_libs: [
-    ],
-
     shared_libs: [
         "liblog",
         "libutils",
         "libhidlbase",
         "android.hardware.audio.common-util",
-        "android.hardware.audio.common@2.0",
     ],
     export_shared_lib_headers: [
         "android.hardware.audio.common-util"
@@ -67,6 +64,15 @@
         "libaudio_system_headers",
         "libhardware_headers",
     ],
+}
+
+cc_library_shared {
+    name: "android.hardware.audio.common@2.0-util",
+    defaults: ["android.hardware.audio.common-util_default"],
+
+    shared_libs: [
+        "android.hardware.audio.common@2.0",
+    ],
     cflags: [
         "-DMAJOR_VERSION=2",
         "-DMINOR_VERSION=0",
@@ -76,32 +82,11 @@
 
 cc_library_shared {
     name: "android.hardware.audio.common@4.0-util",
-    defaults: ["hidl_defaults"],
-    vendor_available: true,
-    srcs: [
-        "HidlUtils.cpp",
-    ],
-
-    export_include_dirs: ["."],
-
-    static_libs: [
-    ],
+    defaults: ["android.hardware.audio.common-util_default"],
 
     shared_libs: [
-        "liblog",
-        "libutils",
-        "libhidlbase",
-        "android.hardware.audio.common-util",
         "android.hardware.audio.common@4.0",
     ],
-    export_shared_lib_headers: [
-        "android.hardware.audio.common-util"
-    ],
-
-    header_libs: [
-        "libaudio_system_headers",
-        "libhardware_headers",
-    ],
     cflags: [
         "-DMAJOR_VERSION=4",
         "-DMINOR_VERSION=0",