From 3b6a233eba04571ea6178d0c49e126b099de1b30 Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Tue, 9 Aug 2022 16:27:46 +0000 Subject: libhidl: check ro.debuggable less We were always checking this when retrieving services, but we don't need to (we can check it only when treble testing override is on). There are a few things we could consider in this codebase: - checking debuggability when the testing override is initially set (and warning then) VS now when it is read - avoiding duplicated calls to isDebuggable in isTrebleTestingOverride and getRawServiceInternal. - removing 'kEnforceVintfManifest' since it is always true now. However, given that we're deprecating HIDL and in the interest of keeping changes simple, focusing on other things instead of these improvements. Ignore-AOSP-First: cherry-pick for tm-qpr-dev Bug: 193912100 Test: boot Change-Id: I6df328dead00c05dcbd8eedf63fc24a8d6141871 Merged-In: I6df328dead00c05dcbd8eedf63fc24a8d6141871 --- transport/ServiceManagement.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/transport/ServiceManagement.cpp b/transport/ServiceManagement.cpp index c638279..0640eef 100644 --- a/transport/ServiceManagement.cpp +++ b/transport/ServiceManagement.cpp @@ -174,12 +174,15 @@ static bool isDebuggable() { } static inline bool isTrebleTestingOverride() { + // return false early so we don't need to check the debuggable property + if (!*getTrebleTestingOverridePtr()) return false; + if (kEnforceVintfManifest && !isDebuggable()) { // don't allow testing override in production return false; } - return *getTrebleTestingOverridePtr(); + return true; } static void onRegistrationImpl(const std::string& descriptor, const std::string& instanceName) { -- cgit v1.2.3