drm_hwcomposer: Fix build failure on Linux-native targets
Commit e11f723f ("drm_hwcomposer: Query property when checking virtual
displays availability") introduced a call to
android::base::GetBoolProperty, which is only available in Android.
This caused the test "hwcomposer.filegroups_build_test" to fail because
the code was no longer compiling for Linux-native targets.
Fix that by replacing "android::base::GetBoolProperty" with a new
function "property_get_bool," and define the function for both Android
and non-Android targets:
For Android, utilize the existing function from <cutils/properties.h>
For other targets, a new implementation is provided in
utils/properties.h.
Fixes: e11f723f ("drm_hwcomposer: Query property when checking virtual
displays availability")
Signed-off-by: Paz Zcharya <pazz@google.com>
diff --git a/drm/DrmHwc.cpp b/drm/DrmHwc.cpp
index 6b62457..aaba506 100644
--- a/drm/DrmHwc.cpp
+++ b/drm/DrmHwc.cpp
@@ -19,12 +19,10 @@
#include "DrmHwc.h"
#include <cinttypes>
-#include <string>
-
-#include <android-base/properties.h>
#include "backend/Backend.h"
#include "utils/log.h"
+#include "utils/properties.h"
namespace android {
@@ -202,9 +200,7 @@
/* Virtual display is an experimental feature.
* Unless explicitly set to true, return 0 for no support.
*/
- if (!base::GetBoolProperty(std::string(
- "vendor.hwc.drm.enable_virtual_display"),
- false)) {
+ if (0 == property_get_bool("vendor.hwc.drm.enable_virtual_display", 0)) {
return 0;
}