msm8937-common: Adapt libinit for msm8937-common

Signed-off-by: Isaac Chen <isaacchen@isaacchen.cn>
This commit is contained in:
Michael Bestas 2018-03-20 16:24:42 +08:00 committed by Isaac Chen
parent bc63340ec5
commit 53d08d831c
4 changed files with 52 additions and 37 deletions

View file

@ -1,4 +1,4 @@
# Init
TARGET_INIT_VENDOR_LIB := libinit_land
TARGET_INIT_VENDOR_LIB := libinit_msm8937
TARGET_PLATFORM_DEVICE_BASE := /devices/soc/
TARGET_RECOVERY_DEVICE_MODULES := libinit_land
TARGET_RECOVERY_DEVICE_MODULES := libinit_msm8937

View file

@ -21,8 +21,13 @@ include $(CLEAR_VARS)
LOCAL_C_INCLUDES := \
system/core/base/include \
system/core/init
LOCAL_MODULE := libinit_land
LOCAL_CFLAGS := -Wall
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := init_land.cpp
LOCAL_SRC_FILES := init_msm8937.cpp
ifneq ($(TARGET_LIBINIT_MSM8937_DEFINES_FILE),)
LOCAL_SRC_FILES += ../../../../$(TARGET_LIBINIT_MSM8937_DEFINES_FILE)
endif
LOCAL_MODULE := libinit_msm8937
include $(BUILD_STATIC_LIBRARY)

View file

@ -35,13 +35,15 @@
#include <string.h>
#include <sys/sysinfo.h>
#include <android-base/strings.h>
#include <android-base/strings.h>
#include "vendor_init.h"
#include "property_service.h"
#include "log.h"
#include "util.h"
#include "init_msm8937.h"
using android::base::Trim;
char const *heapstartsize;
@ -51,6 +53,9 @@ char const *heapminfree;
char const *heapmaxfree;
char const *large_cache_height;
__attribute__ ((weak))
void init_target_properties() {}
static void init_alarm_boot_properties()
{
char const *boot_reason_file = "/proc/sys/kernel/boot_reason";
@ -112,19 +117,6 @@ void check_device()
void vendor_load_properties()
{
std::ifstream fin;
std::string buf;
std::string product = property_get("ro.product.name");
if (product.find("land") == std::string::npos)
return;
fin.open("/proc/cmdline");
while (std::getline(fin, buf, ' '))
if (buf.find("board_id") != std::string::npos)
break;
fin.close();
init_alarm_boot_properties();
check_device();
@ -147,23 +139,5 @@ void vendor_load_properties()
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) {
property_set("ro.build.display.wtid", "SW_S88537AA1_V080_M20_MP_XM");
} else if (buf.find("S88537AB1") != std::string::npos) {
property_set("ro.build.display.wtid", "SW_S88537AB1_V080_M20_MP_XM");
} else if (buf.find("S88537AC1") != std::string::npos) {
property_set("ro.build.display.wtid", "SW_S88537AC1_V080_M20_MP_XM");
} else if (buf.find("S88537BA1") != std::string::npos) {
property_set("ro.build.display.wtid", "SW_S88537BA1_V080_M20_MP_XM");
} else if (buf.find("S88537CA1") != std::string::npos) {
property_set("ro.build.display.wtid", "SW_S88537CA1_V080_M20_MP_XM");
} else if (buf.find("S88537EC1") != std::string::npos) {
property_set("ro.build.display.wtid", "SW_S88537EC1_V080_M20_MP_XM");
}
if (buf.find("S88537AB1") != std::string::npos) {
property_set("ro.product.model", "Redmi 3X");
} else {
property_set("ro.product.model", "Redmi 3S");
}
init_target_properties();
}

36
init/init_msm8937.h Normal file
View file

@ -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_MSM8937__H__
#define __INIT_MSM8937__H__
void init_target_properties();
#endif /* __INIT_MSM8937__H__ */