diff options
author | LuK1337 <priv.luk@gmail.com> | 2016-08-15 15:41:06 +0200 |
---|---|---|
committer | dd3boh <dade.garberi@gmail.com> | 2017-09-06 14:55:55 +0200 |
commit | a0399df8ed081a262de33a6c6c2563c97aea6678 (patch) | |
tree | 7d2dc535b7693c3de1427cfee92584019deec23f | |
parent | 6cfe06207d65a9265f4e8589950c55eba8541ad2 (diff) |
z2_plus: init: Dynamically set Dalvik properties
Change-Id: I656cbed7abf351fea4129e7ff3c930eb9d8914ae
Signed-off-by: dd3boh <dade.garberi@gmail.com>
-rw-r--r-- | device.mk | 3 | ||||
-rw-r--r-- | init/init_z2_plus.cpp | 29 |
2 files changed, 29 insertions, 3 deletions
@@ -73,9 +73,6 @@ TARGET_SCREEN_WIDTH := 1080 # HWUI overrides $(call inherit-product, frameworks/native/build/phone-xxhdpi-3072-hwui-memory.mk) -# Dalvik overrides -$(call inherit-product, frameworks/native/build/phone-xxhdpi-3072-dalvik-heap.mk) - # Haters gonna hate.. PRODUCT_CHARACTERISTICS := nosdcard diff --git a/init/init_z2_plus.cpp b/init/init_z2_plus.cpp index fd30f51..33fe6b4 100644 --- a/init/init_z2_plus.cpp +++ b/init/init_z2_plus.cpp @@ -36,6 +36,9 @@ #include "log.h" #include "util.h" +char const *heapminfree; +char const *heapmaxfree; + static void init_alarm_boot_properties() { int boot_reason; @@ -67,6 +70,23 @@ static void init_alarm_boot_properties() } } +void check_ram() +{ + struct sysinfo sys; + + sysinfo(&sys); + + if (sys.totalram > 3072ull * 1024 * 1024) { + // from - phone-xxxhdpi-4096-dalvik-heap.mk + heapminfree = "4m"; + heapmaxfree = "16m"; + } else { + // from - phone-xxhdpi-3072-dalvik-heap.mk + heapminfree = "512k"; + heapmaxfree = "8m"; + } +} + void vendor_load_properties() { char device[PROP_VALUE_MAX]; char rf_version[PROP_VALUE_MAX]; @@ -77,6 +97,15 @@ void vendor_load_properties() { return; property_set("ro.product.model", "Z2 Plus"); + + check_ram(); + + property_set("dalvik.vm.heapstartsize", "8m"); + property_set("dalvik.vm.heapgrowthlimit", "256m"); + property_set("dalvik.vm.heapsize", "512m"); + property_set("dalvik.vm.heaptargetutilization", "0.75"); + property_set("dalvik.vm.heapminfree", heapminfree); + property_set("dalvik.vm.heapmaxfree", heapmaxfree); init_alarm_boot_properties(); } |