land: Set dalvik heap & hwui through init
* Also update copyright. Signed-off-by: Darshan Manjrekar <darshanmanjrekar1205@gmail.com>
This commit is contained in:
parent
138edbd53c
commit
f344c7e010
2 changed files with 56 additions and 25 deletions
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2016, The CyanogenMod Project
|
Copyright (c) 2016, The CyanogenMod Project
|
||||||
|
Copyright (c) 2017, The LineageOS Project
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions are
|
modification, are permitted provided that the following conditions are
|
||||||
|
@ -31,13 +32,21 @@
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string>
|
#include <string.h>
|
||||||
|
#include <sys/sysinfo.h>
|
||||||
|
|
||||||
#include "vendor_init.h"
|
#include "vendor_init.h"
|
||||||
#include "property_service.h"
|
#include "property_service.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
char const *heapstartsize;
|
||||||
|
char const *heapgrowthlimit;
|
||||||
|
char const *heapsize;
|
||||||
|
char const *heapminfree;
|
||||||
|
char const *heapmaxfree;
|
||||||
|
char const *large_cache_height;
|
||||||
|
|
||||||
static void init_alarm_boot_properties()
|
static void init_alarm_boot_properties()
|
||||||
{
|
{
|
||||||
int boot_reason;
|
int boot_reason;
|
||||||
|
@ -69,6 +78,31 @@ static void init_alarm_boot_properties()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void check_device()
|
||||||
|
{
|
||||||
|
struct sysinfo sys;
|
||||||
|
|
||||||
|
sysinfo(&sys);
|
||||||
|
|
||||||
|
if (sys.totalram > 2048ull * 1024 * 1024) {
|
||||||
|
// from - phone-xxhdpi-3072-dalvik-heap.mk
|
||||||
|
heapstartsize = "8m";
|
||||||
|
heapgrowthlimit = "288m";
|
||||||
|
heapsize = "768m";
|
||||||
|
heapminfree = "512k";
|
||||||
|
heapmaxfree = "8m";
|
||||||
|
large_cache_height = "1024";
|
||||||
|
} else {
|
||||||
|
// from - phone-xxhdpi-2048-dalvik-heap.mk
|
||||||
|
heapstartsize = "16m";
|
||||||
|
heapgrowthlimit = "192m";
|
||||||
|
heapsize = "512m";
|
||||||
|
heapminfree = "2m";
|
||||||
|
heapmaxfree = "8m";
|
||||||
|
large_cache_height = "1024";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void vendor_load_properties()
|
void vendor_load_properties()
|
||||||
{
|
{
|
||||||
std::ifstream fin;
|
std::ifstream fin;
|
||||||
|
@ -85,6 +119,26 @@ void vendor_load_properties()
|
||||||
fin.close();
|
fin.close();
|
||||||
|
|
||||||
init_alarm_boot_properties();
|
init_alarm_boot_properties();
|
||||||
|
check_device();
|
||||||
|
|
||||||
|
property_set("dalvik.vm.heapstartsize", heapstartsize);
|
||||||
|
property_set("dalvik.vm.heapgrowthlimit", heapgrowthlimit);
|
||||||
|
property_set("dalvik.vm.heapsize", heapsize);
|
||||||
|
property_set("dalvik.vm.heaptargetutilization", "0.75");
|
||||||
|
property_set("dalvik.vm.heapminfree", heapminfree);
|
||||||
|
property_set("dalvik.vm.heapmaxfree", heapmaxfree);
|
||||||
|
|
||||||
|
property_set("ro.hwui.texture_cache_size", "72");
|
||||||
|
property_set("ro.hwui.layer_cache_size", "48");
|
||||||
|
property_set("ro.hwui.r_buffer_cache_size", "8");
|
||||||
|
property_set("ro.hwui.path_cache_size", "32");
|
||||||
|
property_set("ro.hwui.gradient_cache_size", "1");
|
||||||
|
property_set("ro.hwui.drop_shadow_cache_size", "6");
|
||||||
|
property_set("ro.hwui.texture_cache_flushrate", "0.4");
|
||||||
|
property_set("ro.hwui.text_small_cache_width", "1024");
|
||||||
|
property_set("ro.hwui.text_small_cache_height", "1024");
|
||||||
|
property_set("ro.hwui.text_large_cache_width", "2048");
|
||||||
|
property_set("ro.hwui.text_large_cache_height", large_cache_height);
|
||||||
|
|
||||||
if (buf.find("S88537AA1") != std::string::npos) {
|
if (buf.find("S88537AA1") != std::string::npos) {
|
||||||
property_set("ro.build.display.wtid", "SW_S88537AA1_V080_M20_MP_XM");
|
property_set("ro.build.display.wtid", "SW_S88537AA1_V080_M20_MP_XM");
|
||||||
|
|
|
@ -19,29 +19,6 @@ PRODUCT_PACKAGES += \
|
||||||
PRODUCT_PACKAGES += \
|
PRODUCT_PACKAGES += \
|
||||||
libjni_livedisplay
|
libjni_livedisplay
|
||||||
|
|
||||||
# Dalvik
|
|
||||||
PRODUCT_PROPERTY_OVERRIDES += \
|
|
||||||
dalvik.vm.heapgrowthlimit=192m \
|
|
||||||
dalvik.vm.heapmaxfree=8m \
|
|
||||||
dalvik.vm.heapminfree=4m \
|
|
||||||
dalvik.vm.heapsize=384m \
|
|
||||||
dalvik.vm.heapstartsize=16m \
|
|
||||||
dalvik.vm.heaptargetutilization=0.75
|
|
||||||
|
|
||||||
# HWUI
|
|
||||||
PRODUCT_PROPERTY_OVERRIDES += \
|
|
||||||
ro.hwui.drop_shadow_cache_size=6 \
|
|
||||||
ro.hwui.gradient_cache_size=1 \
|
|
||||||
ro.hwui.layer_cache_size=48 \
|
|
||||||
ro.hwui.path_cache_size=32 \
|
|
||||||
ro.hwui.r_buffer_cache_size=8 \
|
|
||||||
ro.hwui.text_large_cache_width=2048 \
|
|
||||||
ro.hwui.text_large_cache_height=2048 \
|
|
||||||
ro.hwui.text_small_cache_width=1024 \
|
|
||||||
ro.hwui.text_small_cache_height=1024 \
|
|
||||||
ro.hwui.texture_cache_flushrate=0.4 \
|
|
||||||
ro.hwui.texture_cache_size=72
|
|
||||||
|
|
||||||
# Permissions
|
# Permissions
|
||||||
PRODUCT_COPY_FILES += \
|
PRODUCT_COPY_FILES += \
|
||||||
frameworks/native/data/etc/android.hardware.opengles.aep.xml:system/etc/permissions/android.hardware.opengles.aep.xml
|
frameworks/native/data/etc/android.hardware.opengles.aep.xml:system/etc/permissions/android.hardware.opengles.aep.xml
|
||||||
|
|
Loading…
Reference in a new issue