From 274b9fbae1c9d055a054dec57927023b838b0669 Mon Sep 17 00:00:00 2001 From: dianlujitao Date: Mon, 15 Oct 2018 16:06:26 +0800 Subject: wayne-common: Remove power-off alarm stuff from init extension * CAF's init.qcom.early_boot.sh checks /persist/alarm/powerOffAlarmSet before setting ro.alarm_boot, but on Oreo nothing writes to that file, thus code is never executed and the prop is never set. * Without ro.alarm_boot=true, the system will boot normally instead of boot to min framework even on rtc, and alarm will ring after boot completed. Change-Id: Ie4d30358314337c229a66a16195f675198ef7d52 --- init/init_wayne.cpp | 43 ++----------------------------------------- 1 file changed, 2 insertions(+), 41 deletions(-) (limited to 'init') diff --git a/init/init_wayne.cpp b/init/init_wayne.cpp index 50e039a..dc6a4a2 100644 --- a/init/init_wayne.cpp +++ b/init/init_wayne.cpp @@ -30,15 +30,13 @@ #include #include -#include -#include #include #include #include -#include #include -#include +#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_ +#include #include "vendor_init.h" #include "property_service.h" @@ -46,8 +44,6 @@ using android::base::GetProperty; using android::init::property_set; -using android::base::ReadFileToString; -using android::base::Trim; char const *heapstartsize; char const *heapgrowthlimit; @@ -60,40 +56,6 @@ __attribute__ ((weak)) void init_target_properties() {} #endif -static void init_alarm_boot_properties() -{ - char const *boot_reason_file = "/proc/sys/kernel/boot_reason"; - char const *power_off_alarm_file = "/persist/alarm/powerOffAlarmSet"; - std::string boot_reason; - std::string power_off_alarm; - std::string reboot_reason = GetProperty("ro.boot.alarmboot", ""); - - if (ReadFileToString(boot_reason_file, &boot_reason) - && ReadFileToString(power_off_alarm_file, &power_off_alarm)) { - /* - * Setup ro.alarm_boot value to true when it is RTC triggered boot up - * For existing PMIC chips, the following mapping applies - * for the value of boot_reason: - * - * 0 -> unknown - * 1 -> hard reset - * 2 -> sudden momentary power loss (SMPL) - * 3 -> real time clock (RTC) - * 4 -> DC charger inserted - * 5 -> USB charger inserted - * 6 -> PON1 pin toggled (for secondary PMICs) - * 7 -> CBLPWR_N pin toggled (for external power supply) - * 8 -> KPDPWR_N pin toggled (power key pressed) - */ - if ((Trim(boot_reason) == "3" || reboot_reason == "true") - && Trim(power_off_alarm) == "1") { - property_set("ro.alarm_boot", "true"); - } else { - property_set("ro.alarm_boot", "false"); - } - } -} - void check_device() { struct sysinfo sys; @@ -119,7 +81,6 @@ void check_device() void vendor_load_properties() { - init_alarm_boot_properties(); check_device(); #ifdef TARGET_HAVE_LIBINIT init_target_properties(); -- cgit v1.2.3