diff options
author | Steven Moreland <smoreland@google.com> | 2021-04-09 17:48:58 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-04-09 17:48:58 +0000 |
commit | 1a8e6a75a4150fc81bea153bfd214b445f252c2e (patch) | |
tree | 769a69fcd8a609c266da80b48d2de307c838b5cc | |
parent | 47b900270cdbf48bcf84a9f634f45a525f15d400 (diff) | |
parent | 2b592d4409822b52b164d4dba065a7eb5d240784 (diff) | |
download | libhidl-1a8e6a75a4150fc81bea153bfd214b445f252c2e.tar.gz |
setTrebleTestingOverride: base on ro.debuggable am: f47cdf7bbb am: 2b592d4409temp_ab_7272582
Original change: https://android-review.googlesource.com/c/platform/system/libhidl/+/1668626
Change-Id: I435e34d50f469e0056eb23a71b1e8872f491e27f
-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) { |