hw/bluetooth.default.so -> libbluetooth.so (1/2)

Also rename the build goal for both the library and headers.

Bug: 67853426
Test: run Bluetooth
Merged-In: Iaffeebc1d3f2761e13f6d66d4e855dc342603054
Change-Id: Iaffeebc1d3f2761e13f6d66d4e855dc342603054
(cherry picked from commit 842ff8ed7f5b00d5f6da9d975f37e65c41bb8ebc)
diff --git a/bta/Android.bp b/bta/Android.bp
index 6705c30..9c47ecf 100644
--- a/bta/Android.bp
+++ b/bta/Android.bp
@@ -23,7 +23,7 @@
     shared_libs: [
         "libcutils",
     ],
-    header_libs: ["bluetooth.default_headers"],
+    header_libs: ["libbluetooth_headers"],
     cflags: ["-DBUILDCFG"],
 }
 
diff --git a/btcore/Android.bp b/btcore/Android.bp
index f5a76e3..6c6d22e 100644
--- a/btcore/Android.bp
+++ b/btcore/Android.bp
@@ -15,7 +15,7 @@
     shared_libs: [
         "liblog",
     ],
-    header_libs: ["bluetooth.default_headers"],
+    header_libs: ["libbluetooth_headers"],
     host_supported: true,
     target: {
         darwin: {
diff --git a/btcore/include/hal_util.h b/btcore/include/hal_util.h
index 615c960..c8803c2 100644
--- a/btcore/include/hal_util.h
+++ b/btcore/include/hal_util.h
@@ -19,5 +19,5 @@
 #include <hardware/bluetooth.h>
 
 // Loads the Bluetooth library. This function looks explicitly for
-// libbluetooth.default.so and loads it.
+// libbluetooth.so and loads it.
 int hal_util_load_bt_library(const bt_interface_t** interface);
diff --git a/btcore/src/hal_util.cc b/btcore/src/hal_util.cc
index ece06a3..a89e5ea 100644
--- a/btcore/src/hal_util.cc
+++ b/btcore/src/hal_util.cc
@@ -29,33 +29,19 @@
 
 using base::StringPrintf;
 
-#define BLUETOOTH_LIBRARY_NAME "bluetooth.default.so"
-#if defined(__LP64__)
-#define BACKUP_PATH "/system/lib64/hw/" BLUETOOTH_LIBRARY_NAME
-#else
-#define BACKUP_PATH "/system/lib/hw/" BLUETOOTH_LIBRARY_NAME
-#endif
+#define BLUETOOTH_LIBRARY_NAME "libbluetooth.so"
 
 int hal_util_load_bt_library(const bt_interface_t** interface) {
   const char* sym = BLUETOOTH_INTERFACE_STRING;
   bt_interface_t* itf = nullptr;
 
   // Always try to load the default Bluetooth stack on GN builds.
-  const char* path = BLUETOOTH_LIBRARY_NAME;
-  void* handle = dlopen(path, RTLD_NOW);
+  void* handle = dlopen(BLUETOOTH_LIBRARY_NAME, RTLD_NOW);
   if (!handle) {
     const char* err_str = dlerror();
-    LOG(WARNING) << __func__ << ": failed to load Bluetooth library " << path
-                 << ", error=" << (err_str ? err_str : "error unknown");
-    path = BACKUP_PATH;
-    LOG(WARNING) << __func__ << ": loading backup path " << path;
-    handle = dlopen(path, RTLD_NOW);
-    if (!handle) {
-      err_str = dlerror();
-      LOG(ERROR) << __func__ << ": failed to load Bluetooth library " << path
-                 << ", error=" << (err_str ? err_str : "error unknown");
-      goto error;
-    }
+    LOG(ERROR) << __func__ << ": failed to load bluetooth library, error="
+               << (err_str ? err_str : "error unknown");
+    goto error;
   }
 
   // Get the address of the bt_interface_t.
diff --git a/btif/Android.bp b/btif/Android.bp
index 00bf6f9..be85d88 100644
--- a/btif/Android.bp
+++ b/btif/Android.bp
@@ -107,7 +107,7 @@
     defaults: ["fluoride_defaults"],
     include_dirs: btifCommonIncludes,
     srcs: ["test/btif_storage_test.cc"],
-    header_libs: ["bluetooth.default_headers"],
+    header_libs: ["libbluetooth_headers"],
     shared_libs: [
         "liblog",
         "libcutils",
@@ -132,7 +132,7 @@
       "src/btif_profile_queue.cc",
       "test/btif_profile_queue_test.cc"
     ],
-    header_libs: ["bluetooth.default_headers"],
+    header_libs: ["libbluetooth_headers"],
     shared_libs: [
         "liblog",
         "libcutils",
diff --git a/build/Android.bp b/build/Android.bp
index 4077365..53d461d 100644
--- a/build/Android.bp
+++ b/build/Android.bp
@@ -46,7 +46,7 @@
 fluoride_defaults {
     name: "fluoride_defaults",
     defaults: ["fluoride_types_defaults"],
-    header_libs: ["bluetooth.default_headers"],
+    header_libs: ["libbluetooth_headers"],
     static_libs: [
         "libbluetooth-types",
     ],
diff --git a/include/Android.bp b/include/Android.bp
index d358baa..fc7b6ca 100644
--- a/include/Android.bp
+++ b/include/Android.bp
@@ -1,5 +1,5 @@
 cc_library_headers {
-    name: "bluetooth.default_headers",
+    name: "libbluetooth_headers",
     header_libs: [
         "libbluetooth-types-header",
     ],
diff --git a/main/Android.bp b/main/Android.bp
index b37b154..80e6dcf 100644
--- a/main/Android.bp
+++ b/main/Android.bp
@@ -2,11 +2,10 @@
 // Bluetooth main HW module / shared library for target
 // ========================================================
 cc_library_shared {
-    name: "bluetooth.default",
+    name: "libbluetooth",
     defaults: ["fluoride_defaults"],
-    relative_install_path: "hw",
-    header_libs: ["bluetooth.default_headers"],
-    export_header_lib_headers: ["bluetooth.default_headers"],
+    header_libs: ["libbluetooth_headers"],
+    export_header_lib_headers: ["libbluetooth_headers"],
     srcs: [
         // platform specific
         "bte_conf.cc",
diff --git a/service/Android.bp b/service/Android.bp
index 64ffc4a..199a51b 100644
--- a/service/Android.bp
+++ b/service/Android.bp
@@ -8,7 +8,7 @@
     include_dirs: [
         "system/bt",
     ],
-    header_libs: [ "bluetooth.default_headers" ],
+    header_libs: [ "libbluetooth_headers" ],
 }
 
 // Source variables
@@ -71,7 +71,7 @@
     btserviceLinuxSrc +
     btserviceDaemonSrc +
     ["main.cc"],
-    required: ["bluetooth.default"],
+    required: ["libbluetooth-system"],
     static_libs: [
         "libbluetooth-binder-common",
         "libbtcore",
@@ -184,7 +184,7 @@
     name: "libbluetoothtbd_hal",
     defaults: ["fluoride_defaults"],
     include_dirs: ["system/bt"],
-    header_libs: ["bluetooth.default_headers"],
+    header_libs: ["libbluetooth_headers"],
     srcs: [
         "hal/bluetooth_gatt_interface.cc",
         "hal/bluetooth_interface.cc",
diff --git a/service/common/Android.bp b/service/common/Android.bp
index e1060b3..b3fbfc4 100644
--- a/service/common/Android.bp
+++ b/service/common/Android.bp
@@ -7,7 +7,7 @@
         "-fvisibility=default",
     ],
     host_supported: true,
-    header_libs: [ "bluetooth.default_headers" ],
+    header_libs: [ "libbluetooth_headers" ],
     srcs: [
         "bluetooth/adapter_state.cc",
         "bluetooth/advertise_data.cc",
@@ -35,7 +35,7 @@
         /* we export all classes, so change default visibility, instead of having EXPORT_SYMBOL on each class*/
         "-fvisibility=default",
     ],
-    header_libs: [ "bluetooth.default_headers" ],
+    header_libs: [ "libbluetooth_headers" ],
     srcs: [
         "android/bluetooth/IBluetooth.aidl",
         "android/bluetooth/IBluetoothCallback.aidl",
diff --git a/stack/Android.bp b/stack/Android.bp
index 3738d07..11b2e19 100644
--- a/stack/Android.bp
+++ b/stack/Android.bp
@@ -20,7 +20,7 @@
         "srvc",
     ],
     header_libs: [
-        "bluetooth.default_headers",
+        "libbluetooth_headers",
     ],
     include_dirs: [
         "external/aac/libAACenc/include",
diff --git a/test/rootcanal/Android.bp b/test/rootcanal/Android.bp
index 2e17410..e8df9fa 100644
--- a/test/rootcanal/Android.bp
+++ b/test/rootcanal/Android.bp
@@ -22,7 +22,7 @@
         "service.cc",
     ],
 
-    header_libs: ["bluetooth.default_headers"],
+    header_libs: ["libbluetooth_headers"],
     shared_libs: [
         "android.hardware.bluetooth@1.0",
         "libbase",
@@ -64,7 +64,7 @@
         "bluetooth_hci.cc",
     ],
 
-    header_libs: ["bluetooth.default_headers"],
+    header_libs: ["libbluetooth_headers"],
     shared_libs: [
         "android.hardware.bluetooth@1.0",
         "libbase",
diff --git a/vendor_libs/linux/interface/Android.bp b/vendor_libs/linux/interface/Android.bp
index 616de7d..d4bf207 100644
--- a/vendor_libs/linux/interface/Android.bp
+++ b/vendor_libs/linux/interface/Android.bp
@@ -25,7 +25,7 @@
         "service.cc"
     ],
     cflags: ["-Wall", "-Werror"],
-    header_libs: ["bluetooth.default_headers"],
+    header_libs: ["libbluetooth_headers"],
     shared_libs: [
         "android.hardware.bluetooth@1.0",
         "libbase",
diff --git a/vendor_libs/test_vendor_lib/Android.bp b/vendor_libs/test_vendor_lib/Android.bp
index fd8b0fc..c87baf8 100644
--- a/vendor_libs/test_vendor_lib/Android.bp
+++ b/vendor_libs/test_vendor_lib/Android.bp
@@ -38,7 +38,7 @@
     ],
     export_include_dirs: ["include"],
     header_libs: [
-        "bluetooth.default_headers",
+        "libbluetooth_headers",
     ],
     include_dirs: [
         "system/bt",