From 09de0ff8d6205afbe4b3430531a535641c5d05d2 Mon Sep 17 00:00:00 2001 From: Tianjie Xu Date: Fri, 15 Nov 2019 14:05:29 -0800 Subject: [PATCH] Clear the warm_reset flag after boot is successful 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. After the slot has been marked as boot successful, we can drop the warm_reset flag to avoid the performance overhead on the next reboot. Bug: 143489994 Test: check the property is set to 0 by vold Change-Id: If7c922f40bcf9a6f7894af0a334ab23d88d40d17 --- Checkpoint.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Checkpoint.cpp b/Checkpoint.cpp index b2b648f..88f7cad 100644 --- a/Checkpoint.cpp +++ b/Checkpoint.cpp @@ -170,6 +170,10 @@ Status cp_commitChanges() { if (!cr.success) return error(EINVAL, "Error marking booted successfully: " + std::string(cr.errMsg)); LOG(INFO) << "Marked slot as booted successfully."; + // Clears the warm reset flag for next reboot. + if (!SetProperty("ota.warm_reset", "0")) { + LOG(WARNING) << "Failed to reset the warm reset flag"; + } } // Must take action for list of mounted checkpointed things here // To do this, we walk the list of mounted file systems.