diff options
author | Luca Stefani <luca020400@lineageos.org> | 2017-08-18 11:39:28 +0200 |
---|---|---|
committer | dd3boh <dade.garberi@gmail.com> | 2017-09-07 13:41:55 +0200 |
commit | 51fac3d46c0bba7a64f85bc9b202dcf4acb33198 (patch) | |
tree | 350614426fc887f57f7f42d5ceb473d76afbd5e8 /init | |
parent | 6e2a6cfe8c41d32f97152f5f9eebb0662855bc6a (diff) |
z2_plus: init: Update for O
Signed-off-by: dd3boh <dade.garberi@gmail.com>
Diffstat (limited to 'init')
-rw-r--r-- | init/Android.mk | 2 | ||||
-rw-r--r-- | init/init_z2_plus.cpp | 41 |
2 files changed, 20 insertions, 23 deletions
diff --git a/init/Android.mk b/init/Android.mk index f4b442b..04ff837 100644 --- a/init/Android.mk +++ b/init/Android.mk @@ -23,5 +23,7 @@ LOCAL_C_INCLUDES := system/core/init LOCAL_CFLAGS := -Wall -DANDROID_TARGET=\"$(TARGET_BOARD_PLATFORM)\" LOCAL_SRC_FILES := init_z2_plus.cpp LOCAL_MODULE := libinit_z2_plus +LOCAL_STATIC_LIBRARIES := \ + libbase include $(BUILD_STATIC_LIBRARY) diff --git a/init/init_z2_plus.cpp b/init/init_z2_plus.cpp index 9ccc198..04f02a7 100644 --- a/init/init_z2_plus.cpp +++ b/init/init_z2_plus.cpp @@ -32,12 +32,15 @@ #include <stdlib.h> #include <sys/sysinfo.h> #include <cutils/properties.h> +#include <android-base/properties.h> +#include "property_service.h" #include "vendor_init.h" -#include "log.h" -#include "util.h" -char const *heapminfree; -char const *heapmaxfree; +using android::base::GetProperty; +using android::base::SetProperty; + +std::string heapminfree; +std::string heapmaxfree; static void init_alarm_boot_properties() { @@ -63,11 +66,7 @@ static void init_alarm_boot_properties() * 7 -> CBLPWR_N pin toggled (for external power supply) * 8 -> KPDPWR_N pin toggled (power key pressed) */ - if (boot_reason == 3) { - property_set("ro.alarm_boot", "true"); - } else { - property_set("ro.alarm_boot", "false"); - } + SetProperty("ro.alarm_boot", boot_reason == 3 ? "true" : "false"); } void check_ram() @@ -88,24 +87,20 @@ void check_ram() } void vendor_load_properties() { - char device[PROP_VALUE_MAX]; - char rf_version[PROP_VALUE_MAX]; - int rc; - - rc = property_get("ro.product.device", device, NULL); - if (!rc || strncmp(device, "z2_plus", PROP_VALUE_MAX)) + std::string platform; + + platform = GetProperty("ro.board.platform", ""); + if (platform != ANDROID_TARGET) return; - - property_set("ro.product.model", "Zuk 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); + SetProperty("dalvik.vm.heapstartsize", "8m"); + SetProperty("dalvik.vm.heapgrowthlimit", "256m"); + SetProperty("dalvik.vm.heapsize", "512m"); + SetProperty("dalvik.vm.heaptargetutilization", "0.75"); + SetProperty("dalvik.vm.heapminfree", heapminfree); + SetProperty("dalvik.vm.heapmaxfree", heapmaxfree); init_alarm_boot_properties(); } |