Standardize page property.
ro.boot.hardware.cpu.pagesize is used on some devices to
report the page size. However, we also know what value this
should be from the CPU. Rather than create a separate property
for this, standardize around this property.
This also allows us to test the value of this property on all
devices.
Bug: 358696947
Test: Vts16KPageSizeTest
Change-Id: I7f6260c68e17e7df8a789e9066a7171f3a56f4b0
diff --git a/init/property_service.cpp b/init/property_service.cpp
index 0d6eb15..208d76f 100644
--- a/init/property_service.cpp
+++ b/init/property_service.cpp
@@ -1255,6 +1255,16 @@
update_sys_usb_config();
}
+void PropertyLoadDerivedDefaults() {
+ const char* PAGE_PROP = "ro.boot.hardware.cpu.pagesize";
+ if (GetProperty(PAGE_PROP, "").empty()) {
+ std::string error;
+ if (PropertySetNoSocket(PAGE_PROP, std::to_string(getpagesize()), &error) != PROP_SUCCESS) {
+ LOG(ERROR) << "Could not set '" << PAGE_PROP << "' because: " << error;
+ }
+ }
+}
+
bool LoadPropertyInfoFromFile(const std::string& filename,
std::vector<PropertyInfoEntry>* property_infos) {
auto file_contents = std::string();
@@ -1425,6 +1435,7 @@
ExportKernelBootProps();
PropertyLoadBootDefaults();
+ PropertyLoadDerivedDefaults();
}
static void HandleInitSocket() {