Monitor the property ota.warm_reset

The property is set to inform kernel to do a warm_reset on the next
reboot. This is useful to persist the logs to debug device boot
failures. More details in http://go/rvc-ota-persist-logs.

The property is read by vendor_init. And according to its value,
vendor_init writes a particular sysfs file to schedule a warm reset
on the following reboot.

Bug: 143489994
Test: check the property be read by vendor_init, check the value of the sysfs file
Change-Id: Iaa41cb98c2100d0e061b8ea50555d16d2971e258
diff --git a/init.hardware.rc b/init.hardware.rc
index e66d5a5..b0b6f42 100644
--- a/init.hardware.rc
+++ b/init.hardware.rc
@@ -915,3 +915,14 @@
 
 on property:persist.sys.theme=0
     start vendor.theme_clear
+
+on init && property:ro.boot.slot_successful=no
+    write /sys/module/msm_poweroff/parameters/warm_reset 1
+
+# Set or clear the warm reset flag upon the change of system property. The flag itself is set
+# by writing a sysfs file; and the file will be read by kernel.
+on property:ota.warm_reset=1
+    write /sys/module/msm_poweroff/parameters/warm_reset 1
+
+on property:ota.warm_reset=0
+    write /sys/module/msm_poweroff/parameters/warm_reset 0