From 4cd901c6e2851ecc8c6945d70efe567cb4cdbbad Mon Sep 17 00:00:00 2001 From: Nicole Lee Date: Wed, 14 Oct 2020 15:12:39 +0800 Subject: dumpstate: adjust timing of disable and enable mdlog Bug: 169662280 The timing of dumpstate to enable diag_mdlog is too marginal to diag_mdlog process exiting. The starting of diag_mdlog would fail if diag_mdlog process still exists. Change is to leave some time for diag_mdlog process to exit before it is enabled again by modifying the system property vendor.sys.modem.diag.mdlog to true. Change-Id: I825cd77e3f6e8fe6ce395cbe2c21974f1cb29d02 --- dumpstate/DumpstateDevice.cpp | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/dumpstate/DumpstateDevice.cpp b/dumpstate/DumpstateDevice.cpp index 74afb8a..105132a 100755 --- a/dumpstate/DumpstateDevice.cpp +++ b/dumpstate/DumpstateDevice.cpp @@ -392,22 +392,10 @@ static void *dumpModemThread(void *data) return NULL; } - sleep(1); - ALOGD("Waited modem for 1 second to flush logs"); - - const std::string modemLogCombined = modemLogDir + "/" + filePrefix + "all.tar"; - const std::string modemLogAllDir = modemLogDir + "/modem_log"; - - RunCommandToFd(STDOUT_FILENO, "MKDIR MODEM LOG", {"/vendor/bin/mkdir", "-p", modemLogAllDir.c_str()}, CommandOptions::WithTimeout(2).Build()); - - const std::string diagLogDir = "/data/vendor/radio/diag_logs/logs"; - const std::string diagPoweronLogPath = "/data/vendor/radio/diag_logs/logs/diag_poweron_log.qmdl"; - bool diagLogEnabled = android::base::GetBoolProperty(DIAG_MDLOG_PERSIST_PROPERTY, false); + bool diagLogStarted = android::base::GetBoolProperty(DIAG_MDLOG_STATUS_PROPERTY, false); if (diagLogEnabled) { - bool diagLogStarted = android::base::GetBoolProperty( DIAG_MDLOG_STATUS_PROPERTY, false); - if (diagLogStarted) { android::base::SetProperty(DIAG_MDLOG_PROPERTY, "false"); ALOGD("Stopping diag_mdlog...\n"); @@ -419,7 +407,20 @@ static void *dumpModemThread(void *data) } else { ALOGD("diag_mdlog is not running"); } + } + sleep(1); + ALOGD("Waited modem for 1 second to flush logs"); + + const std::string modemLogCombined = modemLogDir + "/" + filePrefix + "all.tar"; + const std::string modemLogAllDir = modemLogDir + "/modem_log"; + + RunCommandToFd(STDOUT_FILENO, "MKDIR MODEM LOG", {"/vendor/bin/mkdir", "-p", modemLogAllDir.c_str()}, CommandOptions::WithTimeout(2).Build()); + + const std::string diagLogDir = "/data/vendor/radio/diag_logs/logs"; + const std::string diagPoweronLogPath = "/data/vendor/radio/diag_logs/logs/diag_poweron_log.qmdl"; + + if (diagLogEnabled) { dumpLogs(STDOUT_FILENO, diagLogDir, modemLogAllDir, android::base::GetIntProperty(DIAG_MDLOG_NUMBER_BUGREPORT, 100), DIAG_LOG_PREFIX); if (diagLogStarted) { -- cgit v1.2.3