topaz: init: Set dalvik config only to 4GB

Change-Id: I43b6ce3c72bacf81a46d6282a1e8c45c25f63592
Signed-off-by: chrisl7 <wandersonrodriguesf1@gmail.com>
This commit is contained in:
chrisl7
2024-02-02 00:39:30 +00:00
committed by artemscine
parent 90cdb17cb6
commit f1d89ec7e6

View File

@@ -56,6 +56,19 @@ void property_override(string prop, string value)
__system_property_add(prop.c_str(), prop.size(), value.c_str(), value.size());
}
void load_dalvik_properties(void) {
struct sysinfo sys;
sysinfo(&sys);
if (sys.totalram < 4096ull * 1024 * 1024) {
// from - phone-xhdpi-4096-dalvik-heap.mk
property_override("dalvik.vm.heapstartsize", "8m");
property_override("dalvik.vm.heapgrowthlimit", "192m");
property_override("dalvik.vm.heapmaxfree", "16m");
property_override("dalvik.vm.heaptargetutilization", "0.6");
}
}
void load_redmi_topaz() {
property_override("bluetooth.device.default_name", "Redmi Note 12");
property_override("ro.product.brand", "Redmi");
@@ -99,42 +112,5 @@ void vendor_load_properties() {
property_override("ro.boot.hardware.revision", GetProperty("ro.boot.hwversion", "").c_str());
// Set dalvik heap configuration
std::string heapstartsize, heapgrowthlimit, heapsize, heapminfree,
heapmaxfree, heaptargetutilization;
struct sysinfo sys;
sysinfo(&sys);
if (sys.totalram > 5072ull * 1024 * 1024) {
// from - phone-xhdpi-6144-dalvik-heap.mk
heapstartsize = "16m";
heapgrowthlimit = "256m";
heapsize = "512m";
heaptargetutilization = "0.5";
heapminfree = "8m";
heapmaxfree = "32m";
} else if (sys.totalram > 3072ull * 1024 * 1024) {
// from - phone-xhdpi-4096-dalvik-heap.mk
heapstartsize = "8m";
heapgrowthlimit = "192m";
heapsize = "512m";
heaptargetutilization = "0.6";
heapminfree = "8m";
heapmaxfree = "16m";
} else {
// from - phone-xhdpi-2048-dalvik-heap.mk
heapstartsize = "8m";
heapgrowthlimit = "192m";
heapsize = "512m";
heaptargetutilization = "0.75";
heapminfree = "512k";
heapmaxfree = "8m";
}
property_override("dalvik.vm.heapstartsize", heapstartsize);
property_override("dalvik.vm.heapgrowthlimit", heapgrowthlimit);
property_override("dalvik.vm.heapsize", heapsize);
property_override("dalvik.vm.heaptargetutilization", heaptargetutilization);
property_override("dalvik.vm.heapminfree", heapminfree);
property_override("dalvik.vm.heapmaxfree", heapmaxfree);
load_dalvik_properties();
}