diff options
author | Steven Moreland <smoreland@google.com> | 2021-04-09 18:37:44 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-04-09 18:37:44 +0000 |
commit | c7cce3d4e5045726d187a7eb17740af5fc04a196 (patch) | |
tree | 769a69fcd8a609c266da80b48d2de307c838b5cc | |
parent | ee47ab21d540f11f6b5ff8abec8872b212429bf7 (diff) | |
parent | 1a8e6a75a4150fc81bea153bfd214b445f252c2e (diff) | |
download | libhidl-c7cce3d4e5045726d187a7eb17740af5fc04a196.tar.gz |
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
-rw-r--r-- | transport/ServiceManagement.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
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 = true; 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 @@ void setTrebleTestingOverride(bool testingOverride) { *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 @@ sp<::android::hidl::base::V1_0::IBase> getRawServiceInternal(const std::string& 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) { |