From c8e014f8f964d155612b81e35d74233da42c0205 Mon Sep 17 00:00:00 2001
From: dianlujitao <dianlujitao@lineageos.org>
Date: Mon, 15 Oct 2018 16:06:26 +0800
Subject: [PATCH] msm8953-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_msm8953.cpp | 36 ++----------------------------------
 1 file changed, 2 insertions(+), 34 deletions(-)

diff --git a/init/init_msm8953.cpp b/init/init_msm8953.cpp
index 7c9c693..a7c4f44 100644
--- a/init/init_msm8953.cpp
+++ b/init/init_msm8953.cpp
@@ -1,5 +1,7 @@
 /*
    Copyright (c) 2016, The CyanogenMod Project
+   Copyright (C) 2019 The LineageOS Project.
+
    Redistribution and use in source and binary forms, with or without
    modification, are permitted provided that the following conditions are
    met:
@@ -25,8 +27,6 @@
    IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include <fcntl.h>
-#include <stdlib.h>
 #include <sys/sysinfo.h>
 
 #include "vendor_init.h"
@@ -38,37 +38,6 @@ char const *heapminfree;
 
 using android::init::property_set;
 
-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);
-
-    /*
-     * 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 (boot_reason == 3) {
-        property_set("ro.alarm_boot", "true");
-     } else {
-        property_set("ro.alarm_boot", "false");
-     }
-}
-
 void check_device()
 {
     struct sysinfo sys;
@@ -88,7 +57,6 @@ void check_device()
 
 void vendor_load_properties()
 {
-    init_alarm_boot_properties();
     check_device();
 
     property_set("dalvik.vm.heapstartsize", "16m");
-- 
GitLab