universal7885: format code using clang-format-15

This commit is contained in:
roynatech2544 2022-04-12 17:26:15 +09:00
commit cb072badd5
No known key found for this signature in database
GPG key ID: 50ABF73F0D19445D
55 changed files with 3946 additions and 3783 deletions

View file

@ -40,54 +40,55 @@ using android::base::GetProperty;
using std::string;
std::vector<std::string> ro_props_default_source_order = {
"", "odm.", "product.", "system.", "system_ext.", "vendor.",
"", "odm.", "product.", "system.", "system_ext.", "vendor.",
};
void property_override(char const prop[], char const value[], bool add = true) {
prop_info* pi;
prop_info *pi;
pi = (prop_info*)__system_property_find(prop);
if (pi)
__system_property_update(pi, value, strlen(value));
else if (add)
__system_property_add(prop, strlen(prop), value, strlen(value));
pi = (prop_info *)__system_property_find(prop);
if (pi)
__system_property_update(pi, value, strlen(value));
else if (add)
__system_property_add(prop, strlen(prop), value, strlen(value));
}
void set_ro_build_prop(const std::string& prop, const std::string& value, bool product = true) {
string prop_name;
void set_ro_build_prop(const std::string &prop, const std::string &value,
bool product = true) {
string prop_name;
for (const auto& source : ro_props_default_source_order) {
if (product)
prop_name = "ro.product." + source + prop;
else
prop_name = "ro." + source + "build." + prop;
for (const auto &source : ro_props_default_source_order) {
if (product)
prop_name = "ro.product." + source + prop;
else
prop_name = "ro." + source + "build." + prop;
property_override(prop_name.c_str(), value.c_str());
}
property_override(prop_name.c_str(), value.c_str());
}
}
bool hasEnding(std::string const& fullString, std::string const& ending) {
if (fullString.length() >= ending.length()) {
return (0 ==
fullString.compare(fullString.length() - ending.length(), ending.length(), ending));
} else {
return false;
}
bool hasEnding(std::string const &fullString, std::string const &ending) {
if (fullString.length() >= ending.length()) {
return (0 == fullString.compare(fullString.length() - ending.length(),
ending.length(), ending));
} else {
return false;
}
}
void vendor_load_properties() {
string model;
string model;
model = GetProperty("ro.boot.product.model", "");
if (model.empty()) {
model = GetProperty("ro.boot.em.model", "");
}
model = GetProperty("ro.boot.product.model", "");
if (model.empty()) {
model = GetProperty("ro.boot.em.model", "");
}
if (hasEnding(model, "N") || hasEnding(model, "S") || hasEnding(model, "K") ||
model == "SM-A202F") {
property_override("ro.boot.product.hardware.sku", "NFC");
}
if (hasEnding(model, "N") || hasEnding(model, "S") || hasEnding(model, "K") ||
model == "SM-A202F") {
property_override("ro.boot.product.hardware.sku", "NFC");
}
set_ro_build_prop("model", model);
set_ro_build_prop("product", model, false);
set_ro_build_prop("model", model);
set_ro_build_prop("product", model, false);
}