diff options
author | dianlujitao <dianlujitao@lineageos.org> | 2018-10-15 16:06:26 +0800 |
---|---|---|
committer | TingyiChen <tingyi364@gmail.com> | 2019-08-13 11:53:57 +0200 |
commit | 274b9fbae1c9d055a054dec57927023b838b0669 (patch) | |
tree | 867fb126426c579709bbad24f619e86b9e008c56 | |
parent | 547d45cce30dc75976d805e86c3af88069ba5998 (diff) |
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
-rw-r--r-- | init/init_wayne.cpp | 43 |
1 files changed, 2 insertions, 41 deletions
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 <cstdlib> #include <fstream> -#include <stdlib.h> -#include <stdio.h> #include <string.h> #include <sys/sysinfo.h> #include <unistd.h> -#include <android-base/file.h> #include <android-base/properties.h> -#include <android-base/strings.h> +#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_ +#include <sys/_system_properties.h> #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(); |