From a1bce779735ef2b32608ae749d28b8120969183a Mon Sep 17 00:00:00 2001 From: Mark Salyzyn <salyzyn@google.com> Date: Tue, 5 Jun 2018 09:41:59 -0700 Subject: [PATCH] persist.sys.boot.reason is cleared once read by bootstat To ensure a surprise reboot does not take the last boot reason on face value especially if coming from more than one boot sessions ago. We shift and clear the value from persist.sys.boot.reason to sys.boot.reason.last and establish a correct last reboot reason in the canonical sys.boot.reason property. As a result, the power manager should read the canonical sys.boot.reason for a definitive result rather than relying on the possibly incorrect values in the persistent storage. sys.boot.reason should be a core property as it represents the canonical boot reason API. Test: compile Bug: 86671991 Bug: 63736262 Change-Id: If3742c487d6c0ab69c464f056bf48c786b66a945 --- private/property_contexts | 1 + private/system_server.te | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/private/property_contexts b/private/property_contexts index 32be0b377..8befae52a 100644 --- a/private/property_contexts +++ b/private/property_contexts @@ -70,6 +70,7 @@ ro.bt. u:object_r:bluetooth_prop:s0 ro.boot.bootreason u:object_r:bootloader_boot_reason_prop:s0 persist.sys.boot.reason u:object_r:last_boot_reason_prop:s0 sys.boot.reason u:object_r:system_boot_reason_prop:s0 +sys.boot.reason.last u:object_r:last_boot_reason_prop:s0 pm. u:object_r:pm_prop:s0 test.sys.boot.reason u:object_r:test_boot_reason_prop:s0 diff --git a/private/system_server.te b/private/system_server.te index f74159e96..d3b8bcd33 100644 --- a/private/system_server.te +++ b/private/system_server.te @@ -524,8 +524,8 @@ set_prop(system_server, cppreopt_prop) # BootReceiver to read ro.boot.bootreason get_prop(system_server, bootloader_boot_reason_prop) -# PowerManager to read persist.sys.boot.reason -get_prop(system_server, last_boot_reason_prop) +# PowerManager to read sys.boot.reason +get_prop(system_server, system_boot_reason_prop) # Collect metrics on boot time created by init get_prop(system_server, boottime_prop) -- GitLab