Allow libhidl to be used in recovery

Test: Compiles
Bug: 78793464
Change-Id: Ib6b8e781b8dfe3fad49ae4bb9e7725e07bd5b9b4
diff --git a/transport/Android.bp b/transport/Android.bp
index 27aa952..92fbc94 100644
--- a/transport/Android.bp
+++ b/transport/Android.bp
@@ -19,6 +19,7 @@
 
 cc_library {
     name: "libhidltransport",
+    recovery_available: true,
     vendor_available: true,
     vndk: {
         enabled: true,
@@ -80,6 +81,12 @@
             cflags: ["-DENFORCE_VINTF_MANIFEST"]
         },
     },
+
+    target: {
+        recovery: {
+            exclude_shared_libs: ["libvndksupport"],
+        },
+    },
 }
 
 // deprecated/legacy (already removed in mainline Android)
diff --git a/transport/ServiceManagement.cpp b/transport/ServiceManagement.cpp
index 50a527a..5f75098 100644
--- a/transport/ServiceManagement.cpp
+++ b/transport/ServiceManagement.cpp
@@ -39,7 +39,9 @@
 #include <android-base/stringprintf.h>
 #include <hwbinder/IPCThreadState.h>
 #include <hwbinder/Parcel.h>
+#if !defined(__ANDROID_RECOVERY__)
 #include <vndksupport/linker.h>
+#endif
 
 #include <android/hidl/manager/1.2/BnHwServiceManager.h>
 #include <android/hidl/manager/1.2/BpHwServiceManager.h>
@@ -321,7 +323,9 @@
                 if (path == HAL_LIBRARY_PATH_SYSTEM) {
                     handle = dlopen(fullPath.c_str(), dlMode);
                 } else {
+#if !defined(__ANDROID_RECOVERY__)
                     handle = android_load_sphal_library(fullPath.c_str(), dlMode);
+#endif
                 }
 
                 if (handle == nullptr) {