diff --git a/common/src/config_reader.cpp b/common/src/config_reader.cpp index bdc3e8afa10139d6227f8e283a36edc86eee1b5f..92d4261bcb76d4d5ed69883676efeab03d19bdbc 100644 --- a/common/src/config_reader.cpp +++ b/common/src/config_reader.cpp @@ -131,9 +131,9 @@ void ConfigReader::ParsePowerMode(const xmlNode* currNode) CONCUR_LOGE("ParsePowerMode:: switch is null!"); continue; } - if (strcmp(switchValue, "1") == 0) { + if (strncmp(switchValue, "1", 1) == 0) { powerModeSchedSwitch_ = true; - } else if (strcmp(switchValue, "0") == 0) { + } else if (strncmp(switchValue, "0", 1) == 0) { powerModeSchedSwitch_ = false; } else { CONCUR_LOGE("ParsePowerMode:: invalid switch value!"); diff --git a/services/src/concurrent_task_controller.cpp b/services/src/concurrent_task_controller.cpp index d1cb67a82a8151836fec4bab77bad931a150791c..1596465125503ab630f423c1cf049334943947fd 100644 --- a/services/src/concurrent_task_controller.cpp +++ b/services/src/concurrent_task_controller.cpp @@ -724,7 +724,7 @@ void TaskController::DeadlinePowerMode() StartTrace(HITRACE_TAG_ACE, "Deadline power mode"); int appRate = uniAppRate_; int rsRate = systemRate_; - if (configReader_) { + if (configEnable_ && configReader_) { appRate = configReader_->GetDegratationFps(appRate); rsRate = configReader_->GetDegratationFps(rsRate); } @@ -800,7 +800,7 @@ int TaskController::GetGamePid(const std::string &gameMsg) const return -1; } int ret = sscanf_s(gameMsg.substr(0, pos).c_str(), "{\"gamePid\":\"%d\"", &gamePid); - if (ret == -1) { + if (ret <= 0) { CONCUR_LOGE("[MSG_GAME]message parsing failed, ret is %{public}d", ret); } else { CONCUR_LOGI("[MSG_GAME]message parsing success"); @@ -848,7 +848,7 @@ void TaskController::SetAppRate(const Json::Value& payload) if (appRate > 0 && appRate != uniAppRate_) { CONCUR_LOGD("set unified app rate %{public}d", appRate); uniAppRate_ = appRate; - if (ddlSceneSchedSwitch_ && ddlPowerModeEnable_ && configReader_) { + if (ddlSceneSchedSwitch_ && ddlPowerModeEnable_ && configEnable_ && configReader_) { appRate = configReader_->GetDegratationFps(appRate); } bool ret = OHOS::system::SetParameter(INTERVAL_APP_RATE, std::to_string(appRate)); @@ -902,7 +902,7 @@ void TaskController::SetRenderServiceRate(const Json::Value& payload) rsRate, renderServiceMainGrpId_, systemRate_); SetFrameRate(renderServiceMainGrpId_, rsRate); systemRate_ = rsRate; - if (ddlSceneSchedSwitch_ && ddlPowerModeEnable_ && configReader_) { + if (ddlSceneSchedSwitch_ && ddlPowerModeEnable_ && configEnable_ && configReader_) { rsRate = configReader_->GetDegratationFps(rsRate); } bool ret = OHOS::system::SetParameter(INTERVAL_RS_RATE, std::to_string(rsRate)); @@ -982,7 +982,7 @@ int TaskController::CreateNewRtgGrp(int prioType, int rtNum) } grp_data.rtg_cmd = CMD_CREATE_RTG_GRP; ret = ioctl(fd, CMD_ID_SET_RTG, &grp_data); - if (ret < 0) { + if (ret <= 0) { CONCUR_LOGE("create rtg grp failed, errno = %{public}d (%{public}s)", errno, strerror(errno)); } else { CONCUR_LOGI("create rtg grp success, get rtg id %{public}d.", ret); diff --git a/services/src/qos_interface.cpp b/services/src/qos_interface.cpp index 4bc270e96e9982f4baa04c6428388b5d0ac419e2..0003b1733418f06c55e316599bc04edfba326562 100644 --- a/services/src/qos_interface.cpp +++ b/services/src/qos_interface.cpp @@ -21,7 +21,6 @@ #include #include #include -#include #include #include "qos_interface.h"