land: init: Use core init function to read from files
Change-Id: I3fd23490bcdfa4097dad73161ad226337e93cd18 Signed-off-by: Darshan Manjrekar <darshanmanjrekar1205@gmail.com>
This commit is contained in:
parent
bda4d9c090
commit
5c98c9e4f1
2 changed files with 31 additions and 27 deletions
|
@ -18,7 +18,9 @@ LOCAL_PATH := $(call my-dir)
|
|||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_C_INCLUDES := system/core/init
|
||||
LOCAL_C_INCLUDES := \
|
||||
system/core/base/include \
|
||||
system/core/init
|
||||
LOCAL_MODULE := libinit_land
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_SRC_FILES := init_land.cpp
|
||||
|
|
|
@ -35,11 +35,15 @@
|
|||
#include <string.h>
|
||||
#include <sys/sysinfo.h>
|
||||
|
||||
#include <android-base/strings.h>
|
||||
|
||||
#include "vendor_init.h"
|
||||
#include "property_service.h"
|
||||
#include "log.h"
|
||||
#include "util.h"
|
||||
|
||||
using android::base::Trim;
|
||||
|
||||
char const *heapstartsize;
|
||||
char const *heapgrowthlimit;
|
||||
char const *heapsize;
|
||||
|
@ -49,13 +53,10 @@ char const *large_cache_height;
|
|||
|
||||
static void init_alarm_boot_properties()
|
||||
{
|
||||
int boot_reason;
|
||||
FILE *fp;
|
||||
|
||||
fp = fopen("/proc/sys/kernel/boot_reason", "r");
|
||||
fscanf(fp, "%d", &boot_reason);
|
||||
fclose(fp);
|
||||
char const *boot_reason_file = "/proc/sys/kernel/boot_reason";
|
||||
std::string boot_reason;
|
||||
|
||||
if (read_file(boot_reason_file, &boot_reason)) {
|
||||
/*
|
||||
* Setup ro.alarm_boot value to true when it is RTC triggered boot up
|
||||
* For existing PMIC chips, the following mapping applies
|
||||
|
@ -71,12 +72,13 @@ 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) {
|
||||
if (Trim(boot_reason) == "3") {
|
||||
property_set("ro.alarm_boot", "true");
|
||||
} else {
|
||||
property_set("ro.alarm_boot", "false");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void check_device()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue