forked from luk1337/ih8sn
-
Notifications
You must be signed in to change notification settings - Fork 2
/
properties.cpp
43 lines (36 loc) · 1.12 KB
/
properties.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "properties.h"
#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
#include <sys/_system_properties.h>
void property_override(char const prop[], char const value[], bool add) {
auto pi = (prop_info *) __system_property_find(prop);
if (pi != nullptr) {
__system_property_del(prop);
__system_property_add(prop, strlen(prop), value, strlen(value));
} else if (add) {
__system_property_add(prop, strlen(prop), value, strlen(value));
}
}
void property_override(const std::vector<std::string> &props, char const value[], bool add) {
for (const auto &prop : props) {
property_override(prop.c_str(), value, add);
}
}
std::vector<std::string> property_list(const std::string &prefix, const std::string &suffix) {
std::vector<std::string> props;
for (const std::string &part : {
"",
"bootimage.",
"odm_dlkm.",
"odm.",
"oem.",
"product.",
"system_dlkm.",
"system_ext.",
"system.",
"vendor_dlkm.",
"vendor.",
}) {
props.emplace_back(prefix + part + suffix);
}
return props;
}