Use libbase properties for a slight simplification.

Test: treehugger
Change-Id: If699230d0bf71ce521d7175da707e42b78ae4886
This commit is contained in:
Elliott Hughes
2023-10-09 22:18:08 +00:00
committed by Maciej Żenczykowski
parent fcea70f840
commit 497e3e05a5
2 changed files with 2 additions and 9 deletions

View File

@@ -30,7 +30,6 @@ cc_binary {
header_libs: ["bpf_headers"], header_libs: ["bpf_headers"],
shared_libs: [ shared_libs: [
"libbase", "libbase",
"libcutils",
"liblog", "liblog",
], ],
srcs: [ srcs: [

View File

@@ -59,9 +59,9 @@
#include <android-base/cmsg.h> #include <android-base/cmsg.h>
#include <android-base/file.h> #include <android-base/file.h>
#include <android-base/properties.h>
#include <android-base/strings.h> #include <android-base/strings.h>
#include <android-base/unique_fd.h> #include <android-base/unique_fd.h>
#include <cutils/properties.h>
#define BPF_FS_PATH "/sys/fs/bpf/" #define BPF_FS_PATH "/sys/fs/bpf/"
@@ -79,17 +79,11 @@ using std::optional;
using std::string; using std::string;
using std::vector; 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 android {
namespace bpf { namespace bpf {
const std::string& getBuildType() { const std::string& getBuildType() {
static std::string t = getBuildTypeInternal(); static std::string t = android::base::GetProperty("ro.build.type", "unknown");
return t; return t;
} }