setTrebleTestingOverride: base on ro.debuggable am: f47cdf7bbb am: 2b592d4409 am: 1a8e6a75a4
Original change: https://android-review.googlesource.com/c/platform/system/libhidl/+/1668626
Change-Id: Ic420a00981f2427b09d40efcb6b056a445b09185
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) {