mirror of
https://github.com/chararomandroid/android_device_samsung_a20
synced 2026-08-21 11:55:31 -04:00
universal7885: libinit: Set low_ram prop if less than 4GB RAM
This commit is contained in:
parent
701d40f0cd
commit
81dc83dd0c
1 changed files with 14 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue