Merge "Make ro.product.cpu.abilist* to be fetched dynamically" am: 8e3826b8b1
am: e45bdf9293
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1538764 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I682ffbdbf13c875a6fabad658cf03edca0009c84
This commit is contained in:
commit
1e1836140c
1 changed files with 64 additions and 0 deletions
|
@ -890,6 +890,69 @@ static void property_derive_build_fingerprint() {
|
|||
}
|
||||
}
|
||||
|
||||
// If the ro.product.cpu.abilist* properties have not been explicitly
|
||||
// set, derive them from ro.${partition}.product.cpu.abilist* properties.
|
||||
static void property_initialize_ro_cpu_abilist() {
|
||||
// From high to low priority.
|
||||
const char* kAbilistSources[] = {
|
||||
"product",
|
||||
"odm",
|
||||
"vendor",
|
||||
"system",
|
||||
};
|
||||
const std::string EMPTY = "";
|
||||
const char* kAbilistProp = "ro.product.cpu.abilist";
|
||||
const char* kAbilist32Prop = "ro.product.cpu.abilist32";
|
||||
const char* kAbilist64Prop = "ro.product.cpu.abilist64";
|
||||
|
||||
// If the properties are defined explicitly, just use them.
|
||||
if (GetProperty(kAbilistProp, EMPTY) != EMPTY) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Find the first source defining these properties by order.
|
||||
std::string abilist32_prop_val;
|
||||
std::string abilist64_prop_val;
|
||||
for (const auto& source : kAbilistSources) {
|
||||
const auto abilist32_prop = std::string("ro.") + source + ".product.cpu.abilist32";
|
||||
const auto abilist64_prop = std::string("ro.") + source + ".product.cpu.abilist64";
|
||||
abilist32_prop_val = GetProperty(abilist32_prop, EMPTY);
|
||||
abilist64_prop_val = GetProperty(abilist64_prop, EMPTY);
|
||||
// The properties could be empty on 32-bit-only or 64-bit-only devices,
|
||||
// but we cannot identify a property is empty or undefined by GetProperty().
|
||||
// So, we assume both of these 2 properties are empty as undefined.
|
||||
if (abilist32_prop_val != EMPTY || abilist64_prop_val != EMPTY) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Merge ABI lists for ro.product.cpu.abilist
|
||||
auto abilist_prop_val = abilist64_prop_val;
|
||||
if (abilist32_prop_val != EMPTY) {
|
||||
if (abilist_prop_val != EMPTY) {
|
||||
abilist_prop_val += ",";
|
||||
}
|
||||
abilist_prop_val += abilist32_prop_val;
|
||||
}
|
||||
|
||||
// Set these properties
|
||||
const std::pair<const char*, const std::string&> set_prop_list[] = {
|
||||
{kAbilistProp, abilist_prop_val},
|
||||
{kAbilist32Prop, abilist32_prop_val},
|
||||
{kAbilist64Prop, abilist64_prop_val},
|
||||
};
|
||||
for (const auto& [prop, prop_val] : set_prop_list) {
|
||||
LOG(INFO) << "Setting property '" << prop << "' to '" << prop_val << "'";
|
||||
|
||||
std::string error;
|
||||
uint32_t res = PropertySet(prop, prop_val, &error);
|
||||
if (res != PROP_SUCCESS) {
|
||||
LOG(ERROR) << "Error setting property '" << prop << "': err=" << res << " (" << error
|
||||
<< ")";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PropertyLoadBootDefaults() {
|
||||
// We read the properties and their values into a map, in order to always allow properties
|
||||
// loaded in the later property files to override the properties in loaded in the earlier
|
||||
|
@ -972,6 +1035,7 @@ void PropertyLoadBootDefaults() {
|
|||
|
||||
property_initialize_ro_product_props();
|
||||
property_derive_build_fingerprint();
|
||||
property_initialize_ro_cpu_abilist();
|
||||
|
||||
update_sys_usb_config();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue