From 3b0811b78641fe2ce10da1be8d7481f3080426bf Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Mon, 9 Oct 2023 22:20:04 +0000 Subject: [PATCH] Use libbase properties for a slight simplification. Test: treehugger Change-Id: I78f7fb43665640cd6869bfde217f60f19bf0cfa1 --- bpfloader/Android.bp | 1 - libbpf_android/Android.bp | 1 - libbpf_android/Loader.cpp | 10 ++-------- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/bpfloader/Android.bp b/bpfloader/Android.bp index b8c6514..2ddf463 100644 --- a/bpfloader/Android.bp +++ b/bpfloader/Android.bp @@ -42,7 +42,6 @@ cc_binary { shared_libs: [ "libbase", "libbpf_android", - "libcutils", "liblog", ], srcs: [ diff --git a/libbpf_android/Android.bp b/libbpf_android/Android.bp index d8272cc..52fb043 100644 --- a/libbpf_android/Android.bp +++ b/libbpf_android/Android.bp @@ -39,7 +39,6 @@ cc_library { shared_libs: [ "libbase", - "libcutils", "libutils", "liblog", ], diff --git a/libbpf_android/Loader.cpp b/libbpf_android/Loader.cpp index d817614..e817a59 100644 --- a/libbpf_android/Loader.cpp +++ b/libbpf_android/Loader.cpp @@ -59,9 +59,9 @@ #include #include +#include #include #include -#include #define BPF_FS_PATH "/sys/fs/bpf/" @@ -79,17 +79,11 @@ using std::optional; using std::string; using std::vector; -static std::string getBuildTypeInternal() { - char value[PROPERTY_VALUE_MAX] = {}; - (void)property_get("ro.build.type", value, "unknown"); // ignore length - return value; -} - namespace android { namespace bpf { const std::string& getBuildType() { - static std::string t = getBuildTypeInternal(); + static std::string t = android::base::GetProperty("ro.build.type", "unknown"); return t; }