universal7885: libinit: Set low_ram prop if less than 4GB RAM

This commit is contained in:
roynatech2544 2023-11-29 20:04:41 +09:00
commit 81dc83dd0c

View file

@ -27,6 +27,8 @@
#include <vector>
#include <sys/sysinfo.h>
#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
#include <sys/_system_properties.h>
@ -71,6 +73,15 @@ static inline bool hasEnding(const std::string& str, char suffix)
return !str.empty() && str.back() == suffix;
}
static void setLowRamProp(void) {
static constexpr auto GB_3 = 3ull * 1024 * 1024 * 1024;
struct sysinfo sys {};
sysinfo(&sys);
if (sys.totalram <= GB_3)
property_override("ro.config.low_ram", "true");
}
void vendor_load_properties() {
std::string model;
bool isNFC = false;
@ -95,6 +106,9 @@ void vendor_load_properties() {
property_override("ro.boot.product.hardware.sku", "NFC");
}
// Set Low ram prop based on HW ram size
setLowRamProp();
// Set model based on bootloader supplied model
set_ro_build_prop("model", model);
set_ro_build_prop("product", model, false);