setTrebleTestingOverride: base on ro.debuggable

This was previously based on the build, but this causes hidl_test,
hidl_test_java, and fmq_test to fail on the GSI build. In order to avoid
this problem, checking this property at runtime.

Fixes: 184616522
Test: atest hidl_test hidl_test_java fmq_test
Change-Id: Ifff473fa9530557bbb3fabc3fda1b25a05249f05
diff --git a/transport/ServiceManagement.cpp b/transport/ServiceManagement.cpp
index c4e03c3..c638279 100644
--- a/transport/ServiceManagement.cpp
+++ b/transport/ServiceManagement.cpp
@@ -159,12 +159,6 @@
 static constexpr bool kEnforceVintfManifest = false;
 #endif
 
-#ifdef LIBHIDL_TARGET_DEBUGGABLE
-static constexpr bool kDebuggable = true;
-#else
-static constexpr bool kDebuggable = false;
-#endif
-
 static bool* getTrebleTestingOverridePtr() {
     static bool gTrebleTestingOverride = false;
     return &gTrebleTestingOverride;
@@ -174,8 +168,13 @@
     *getTrebleTestingOverridePtr() = testingOverride;
 }
 
+static bool isDebuggable() {
+    static bool debuggable = base::GetBoolProperty("ro.debuggable", false);
+    return debuggable;
+}
+
 static inline bool isTrebleTestingOverride() {
-    if (kEnforceVintfManifest && !kDebuggable) {
+    if (kEnforceVintfManifest && !isDebuggable()) {
         // don't allow testing override in production
         return false;
     }
@@ -766,7 +765,7 @@
     const bool vintfHwbinder = (transport == Transport::HWBINDER);
     const bool vintfPassthru = (transport == Transport::PASSTHROUGH);
     const bool trebleTestingOverride = isTrebleTestingOverride();
-    const bool allowLegacy = !kEnforceVintfManifest || (trebleTestingOverride && kDebuggable);
+    const bool allowLegacy = !kEnforceVintfManifest || (trebleTestingOverride && isDebuggable());
     const bool vintfLegacy = (transport == Transport::EMPTY) && allowLegacy;
 
     if (!kEnforceVintfManifest) {