Add top-level default visibility for Bluetooth module

Bug: 215008564
Test: manual
Tag: #feature
Ignore-AOSP-First: Some changes only present in internal
Change-Id: I0c12526bdf833b41e8d1282b29640fa9481b6a04
diff --git a/Android.bp b/Android.bp
index 2b49380..521a562 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,4 +1,5 @@
 package {
+    default_visibility: [":__subpackages__"],
     default_applicable_licenses: ["system_bt_license"],
 }
 
diff --git a/system/binder/Android.bp b/system/binder/Android.bp
index ff18409..f11a001 100644
--- a/system/binder/Android.bp
+++ b/system/binder/Android.bp
@@ -10,6 +10,10 @@
 // AIDL interface between libbluetooth-binder and framework.jar
 filegroup {
     name: "libbluetooth-binder-aidl",
+    visibility: [
+        "//frameworks/base",
+        "//packages/modules/Bluetooth:__subpackages__",
+    ],
     srcs: [
         ":framework-bluetooth-updatable-exported-aidl-sources",
         ":modules-utils-synchronous-result-receiver-aidl",
diff --git a/system/btcore/Android.bp b/system/btcore/Android.bp
index 371af6f..f4b20a7 100644
--- a/system/btcore/Android.bp
+++ b/system/btcore/Android.bp
@@ -41,6 +41,10 @@
 
 cc_library_static {
     name: "libbtcore",
+    visibility:[
+        "//packages/apps/Test/connectivity/sl4n",
+        "//packages/modules/Bluetooth:__subpackages__",
+    ],
     defaults: ["libbtcore_defaults"],
 }
 
diff --git a/system/include/Android.bp b/system/include/Android.bp
index 7dd3db2..8bb2b7c 100644
--- a/system/include/Android.bp
+++ b/system/include/Android.bp
@@ -30,6 +30,11 @@
 cc_library_headers {
     name: "libbluetooth_headers",
     defaults: ["libchrome_support_defaults"],
+    visibility:[
+        "//packages/apps/Test/connectivity/sl4n",
+        "//packages/modules/Bluetooth:__subpackages__",
+        "//vendor:__subpackages__",
+    ],
     header_libs: [
         "avrcp_headers",
         "libbluetooth-types-header",
diff --git a/system/main/Android.bp b/system/main/Android.bp
index 812340d..defe0e0 100644
--- a/system/main/Android.bp
+++ b/system/main/Android.bp
@@ -63,6 +63,11 @@
 
 cc_library_shared {
     name: "libbluetooth",
+    visibility: [
+        "//cts/hostsidetests:__subpackages__",
+        "//packages/modules/Bluetooth:__subpackages__",
+        "//vendor:__subpackages__",
+    ],
     defaults: ["fluoride_defaults"],
     header_libs: ["libbluetooth_headers"],
     export_header_lib_headers: ["libbluetooth_headers"],
diff --git a/system/osi/Android.bp b/system/osi/Android.bp
index 47a2b29..7b175b7 100644
--- a/system/osi/Android.bp
+++ b/system/osi/Android.bp
@@ -55,6 +55,10 @@
 // libosi static library for target
 cc_library_static {
     name: "libosi",
+    visibility:[
+        "//packages/apps/Test/connectivity/sl4n",
+        "//packages/modules/Bluetooth:__subpackages__",
+    ],
     defaults: ["fluoride_osi_defaults"],
     // TODO(mcchou): Remove socket_utils sources after platform specific
     // dependencies are abstracted.
diff --git a/system/service/common/Android.bp b/system/service/common/Android.bp
index 963dcd4..b61e4ff 100644
--- a/system/service/common/Android.bp
+++ b/system/service/common/Android.bp
@@ -44,6 +44,10 @@
 // Bluetooth Binder shared library
 cc_library_static {
     name: "libbluetooth-binder-common",
+    visibility:[
+        "//packages/apps/Test/connectivity/sl4n",
+        "//packages/modules/Bluetooth:__subpackages__",
+    ],
     defaults: ["fluoride_defaults"],
     cflags: [
         /* we export all classes, so change default visibility, instead of having EXPORT_SYMBOL on each class*/
diff --git a/system/test/rootcanal/Android.bp b/system/test/rootcanal/Android.bp
index 5d6700f..a6c41d6 100644
--- a/system/test/rootcanal/Android.bp
+++ b/system/test/rootcanal/Android.bp
@@ -31,7 +31,9 @@
         "bluetooth_hci.cc",
         "service.cc",
     ],
-
+    visibility: [
+        "//platform_testing/libraries/sts-common-util/host-side/rootcanal"
+    ],
     header_libs: ["libbluetooth_headers"],
     shared_libs: [
         "android.hardware.bluetooth@1.0",
@@ -81,7 +83,9 @@
     srcs: [
         "bluetooth_hci.cc",
     ],
-
+    visibility: [
+        "//platform_testing/libraries/sts-common-util/host-side/rootcanal"
+    ],
     header_libs: ["libbluetooth_headers"],
     shared_libs: [
         "android.hardware.bluetooth@1.0",
diff --git a/system/types/Android.bp b/system/types/Android.bp
index 8b9c4ef..827b596 100644
--- a/system/types/Android.bp
+++ b/system/types/Android.bp
@@ -10,6 +10,7 @@
 
 cc_library_headers {
     name: "libbluetooth-types-header",
+    visibility:["//visibility:public"],
     export_include_dirs: ["./"],
     vendor_available: true,
     host_supported: true,
@@ -33,6 +34,7 @@
         /* we export all classes, so change default visibility, instead of having EXPORT_SYMBOL on each class*/
         "-fvisibility=default",
     ],
+    visibility:["//visibility:public"],
     host_supported: true,
     srcs: [
         "class_of_device.cc",
diff --git a/system/vendor_libs/Android.bp b/system/vendor_libs/Android.bp
index 2763e9b..0719cd6 100644
--- a/system/vendor_libs/Android.bp
+++ b/system/vendor_libs/Android.bp
@@ -5,6 +5,10 @@
     // to get the below license kinds:
     //   SPDX-license-identifier-Apache-2.0
     default_applicable_licenses: ["system_bt_license"],
+    default_visibility: [
+        "//device:__subpackages__",
+        "//packages/modules/Bluetooth:__subpackages__",
+    ],
 }
 
 subdirs = [