summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Bestas <mkbestas@lineageos.org>2018-03-20 16:24:42 +0800
committerIsaac Chen <isaacchen@isaacchen.cn>2018-12-02 11:02:30 +0800
commitcc472568e1632b58ecd9aef9d0fc6a66a1734a92 (patch)
treec21460850570b65fab38b255167f63813b77d267
parent2664a20ce7cda2103ec75c300a67551b7fcd6f4f (diff)
wayne-common: Adapt libinit for wayne
Signed-off-by: Isaac Chen <isaacchen@isaacchen.cn>
-rw-r--r--init/Android.mk6
-rw-r--r--init/init_wayne.cpp9
-rw-r--r--init/init_wayne.h36
3 files changed, 51 insertions, 0 deletions
diff --git a/init/Android.mk b/init/Android.mk
index 8f04ac1..fc4a5ba 100644
--- a/init/Android.mk
+++ b/init/Android.mk
@@ -27,5 +27,11 @@ LOCAL_SRC_FILES := init_wayne.cpp
LOCAL_STATIC_LIBRARIES := \
libbase \
libselinux
+LOCAL_CFLAGS := -Wall
+
+ifneq ($(TARGET_LIBINIT_WAYNE_DEFINES_FILE),)
+ LOCAL_CFLAGS += -DTARGET_HAVE_LIBINIT
+ LOCAL_SRC_FILES += ../../../../$(TARGET_LIBINIT_WAYNE_DEFINES_FILE)
+endif
include $(BUILD_STATIC_LIBRARY)
diff --git a/init/init_wayne.cpp b/init/init_wayne.cpp
index 7f66f8c..50e039a 100644
--- a/init/init_wayne.cpp
+++ b/init/init_wayne.cpp
@@ -42,6 +42,7 @@
#include "vendor_init.h"
#include "property_service.h"
+#include "init_wayne.h"
using android::base::GetProperty;
using android::init::property_set;
@@ -54,6 +55,11 @@ char const *heapsize;
char const *heapminfree;
char const *heapmaxfree;
+#ifdef TARGET_HAVE_LIBINIT
+__attribute__ ((weak))
+void init_target_properties() {}
+#endif
+
static void init_alarm_boot_properties()
{
char const *boot_reason_file = "/proc/sys/kernel/boot_reason";
@@ -115,6 +121,9 @@ void vendor_load_properties()
{
init_alarm_boot_properties();
check_device();
+#ifdef TARGET_HAVE_LIBINIT
+ init_target_properties();
+#endif
property_set("dalvik.vm.heapstartsize", heapstartsize);
property_set("dalvik.vm.heapgrowthlimit", heapgrowthlimit);
diff --git a/init/init_wayne.h b/init/init_wayne.h
new file mode 100644
index 0000000..9630892
--- /dev/null
+++ b/init/init_wayne.h
@@ -0,0 +1,36 @@
+/*
+ Copyright (c) 2016, The CyanogenMod Project
+ Copyright (c) 2017, The LineageOS Project
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+ * Neither the name of The Linux Foundation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __INIT_WAYNE__H__
+#define __INIT_WAYNE__H__
+#ifdef TARGET_HAVE_LIBINIT
+void init_target_properties();
+#endif
+#endif /* __INIT_WAYNE__H__ */