From 2461abca07c9a5486f0d6d481020d04e5724266f Mon Sep 17 00:00:00 2001
From: David Duarte <licorne@google.com>
Date: Thu, 1 Jun 2023 14:25:23 +0000
Subject: [PATCH] Remove libstatssocket from fluoride_defaults

Test: mma
Bug: 279502784
Change-Id: Ic995093174a9563668c669b0dae9f380209c84c6
---
 android/app/Android.bp                   |  1 +
 system/bta/Android.bp                    |  1 +
 system/btif/Android.bp                   |  8 +++++
 system/build/Android.bp                  |  3 --
 system/common/Android.bp                 |  1 +
 system/main/Android.bp                   |  7 ++++
 system/osi/Android.bp                    |  7 ++++
 system/osi/test/fuzzers/alarm/Android.bp |  1 +
 system/stack/Android.bp                  | 46 ++++++++++++++++++++++++
 system/stack/test/fuzzers/Android.bp     |  1 +
 system/test/headless/Android.bp          |  1 +
 11 files changed, 74 insertions(+), 3 deletions(-)

diff --git a/android/app/Android.bp b/android/app/Android.bp
index f5c826f4076..4976e19a429 100644
--- a/android/app/Android.bp
+++ b/android/app/Android.bp
@@ -114,6 +114,7 @@ cc_library_shared {
         "libcrypto",
         "libfmq",
         "libnativehelper",
+        "libstatssocket",
         "libutils",
     ],
     sanitize: {
diff --git a/system/bta/Android.bp b/system/bta/Android.bp
index 8d013ac80c0..47a0999c229 100644
--- a/system/bta/Android.bp
+++ b/system/bta/Android.bp
@@ -272,6 +272,7 @@ cc_test {
         "libcrypto",
         "liblog",
         "libprotobuf-cpp-lite",
+        "libstatssocket",
     ],
     static_libs: [
         "crypto_toolbox_for_tests",
diff --git a/system/btif/Android.bp b/system/btif/Android.bp
index 3b4a003c968..c0ebc63d9c0 100644
--- a/system/btif/Android.bp
+++ b/system/btif/Android.bp
@@ -264,6 +264,7 @@ cc_test {
         "libcrypto",
         "libfmq",
         "libhidlbase",
+        "libstatssocket",
         "libutils",
     ],
     static_libs: [
@@ -412,6 +413,11 @@ cc_test {
         "libosi",
         "libosi-AllocationTestHarness",
     ],
+    target: {
+        android: {
+            shared_libs: ["libstatssocket"],
+        },
+    },
     cflags: ["-DBUILDCFG"],
     sanitize: {
         address: true,
@@ -611,6 +617,7 @@ cc_test {
             ],
             shared_libs: [
                 "libbinder_ndk",
+                "libstatssocket",
             ],
         },
     },
@@ -742,6 +749,7 @@ cc_test {
             ],
             shared_libs: [
                 "libbinder_ndk",
+                "libstatssocket",
             ],
         },
     },
diff --git a/system/build/Android.bp b/system/build/Android.bp
index 311907951d2..45c7dfacaf3 100644
--- a/system/build/Android.bp
+++ b/system/build/Android.bp
@@ -139,9 +139,6 @@ cc_defaults {
             enabled: false,
         },
         android: {
-            shared_libs: [
-                "libstatssocket",
-            ],
             sanitize: {
                 misc_undefined: ["bounds"],
             },
diff --git a/system/common/Android.bp b/system/common/Android.bp
index fb435d95e52..f807554a658 100644
--- a/system/common/Android.bp
+++ b/system/common/Android.bp
@@ -75,6 +75,7 @@ cc_test {
     target: {
         android: {
             srcs: ["metrics_unittest.cc"],
+            shared_libs: ["libstatssocket"],
         },
     },
     shared_libs: [
diff --git a/system/main/Android.bp b/system/main/Android.bp
index 0586310c63e..636069b1246 100644
--- a/system/main/Android.bp
+++ b/system/main/Android.bp
@@ -91,6 +91,13 @@ cc_library {
         "android.hardware.bluetooth@1.0",
         "android.hardware.bluetooth@1.1",
     ],
+    target: {
+        android: {
+            shared_libs: [
+                "libstatssocket",
+            ],
+        },
+    },
     // Shared library link options.
     // References to global symbols and functions should bind to the library
     // itself. This is to avoid issues with some of the unit/system tests
diff --git a/system/osi/Android.bp b/system/osi/Android.bp
index ab19f5c65a0..da4f9cf2e13 100644
--- a/system/osi/Android.bp
+++ b/system/osi/Android.bp
@@ -168,6 +168,13 @@ cc_test {
         "libosi",
         "libprotobuf-cpp-lite",
     ],
+    target: {
+        android: {
+            shared_libs: [
+                "libstatssocket",
+            ],
+        },
+    },
     cflags: [
         "-DLIB_OSI_INTERNAL",
     ],
diff --git a/system/osi/test/fuzzers/alarm/Android.bp b/system/osi/test/fuzzers/alarm/Android.bp
index 15a4710fe9b..4bcef92af90 100644
--- a/system/osi/test/fuzzers/alarm/Android.bp
+++ b/system/osi/test/fuzzers/alarm/Android.bp
@@ -19,6 +19,7 @@ cc_fuzz {
         "libcutils",
         "liblog",
         "libprotobuf-cpp-lite",
+        "libstatssocket",
     ],
     static_libs: [
         "libbt-common",
diff --git a/system/stack/Android.bp b/system/stack/Android.bp
index 2fb36c9d631..e50f936e57a 100644
--- a/system/stack/Android.bp
+++ b/system/stack/Android.bp
@@ -328,6 +328,7 @@ cc_test {
         "libfmq",
         "libhidlbase",
         "liblog",
+        "libstatssocket",
         "libutils",
         "libz",
     ],
@@ -437,6 +438,13 @@ cc_test {
         "libosi",
         "libprotobuf-cpp-lite",
     ],
+    target: {
+        android: {
+            shared_libs: [
+                "libstatssocket",
+            ],
+        },
+    },
     sanitize: {
         cfi: false,
     },
@@ -663,6 +671,13 @@ cc_test {
         "libosi",
         "libosi-AllocationTestHarness",
     ],
+    target: {
+        android: {
+            shared_libs: [
+                "libstatssocket",
+            ],
+        },
+    },
     sanitize: {
         address: true,
         cfi: true,
@@ -721,6 +736,11 @@ cc_test {
         "libosi-AllocationTestHarness",
         "libprotobuf-cpp-lite",
     ],
+    target: {
+        android: {
+            shared_libs: ["libstatssocket"],
+        },
+    },
     sanitize: {
         address: true,
         cfi: true,
@@ -927,6 +947,11 @@ cc_test {
         "liblog",
         "libosi",
     ],
+    target: {
+        android: {
+            shared_libs: ["libstatssocket"],
+        },
+    },
 }
 
 // Iso manager unit tests
@@ -1030,6 +1055,11 @@ cc_test {
         "libosi",
         "libprotobuf-cpp-lite",
     ],
+    target: {
+        android: {
+            shared_libs: ["libstatssocket"],
+        },
+    },
     sanitize: {
         cfi: false,
     },
@@ -1247,6 +1277,11 @@ cc_test {
     shared_libs: [
         "libcrypto",
     ],
+    target: {
+        android: {
+            shared_libs: ["libstatssocket"],
+        },
+    },
     sanitize: {
         address: true,
         all_undefined: true,
@@ -1397,6 +1432,11 @@ cc_test {
         "libbinder_ndk",
         "libcrypto",
     ],
+    target: {
+        android: {
+            shared_libs: ["libstatssocket"],
+        },
+    },
     sanitize: {
         address: true,
         all_undefined: true,
@@ -1477,6 +1517,7 @@ cc_test {
         android: {
             shared_libs: [
                 "libPlatformProperties",
+                "libstatssocket",
             ],
         },
     },
@@ -1556,6 +1597,11 @@ cc_test {
         "libbinder_ndk",
         "libcrypto",
     ],
+    target: {
+        android: {
+            shared_libs: ["libstatssocket"],
+        },
+    },
     sanitize: {
         address: true,
         all_undefined: true,
diff --git a/system/stack/test/fuzzers/Android.bp b/system/stack/test/fuzzers/Android.bp
index 47c68eb3466..e7494bd186d 100644
--- a/system/stack/test/fuzzers/Android.bp
+++ b/system/stack/test/fuzzers/Android.bp
@@ -63,6 +63,7 @@ cc_defaults {
         "libhidlbase",
         "liblog",
         "libprotobuf-cpp-lite",
+        "libstatssocket",
         "libutils",
     ],
 }
diff --git a/system/test/headless/Android.bp b/system/test/headless/Android.bp
index e192c753ef5..aad71a9995c 100644
--- a/system/test/headless/Android.bp
+++ b/system/test/headless/Android.bp
@@ -133,6 +133,7 @@ cc_binary {
         "libhidlbase",
         "libjsoncpp",
         "liblog", // __android_log_print
+        "libstatssocket",
         "libutils",
     ],
     ldflags: ["-rdynamic"],
-- 
GitLab