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
This commit is contained in:
Nicole Lee
2020-10-14 15:12:39 +08:00
parent f99e80c481
commit a81f071077

View File

@@ -391,22 +391,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");
@@ -418,7 +406,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) {