diff --git a/common/include/dtbschedmgr_log.h b/common/include/dtbschedmgr_log.h index c405cbdc..2d9e3e58 100644 --- a/common/include/dtbschedmgr_log.h +++ b/common/include/dtbschedmgr_log.h @@ -505,6 +505,14 @@ enum { * Result(29360232) for all connect manager deal connect apply timeout. */ DMS_CONNECT_APPLY_TIMEOUT_FAILED = 29360232, + /** + * Result(29360233) for mission continue state is not active. + */ + MISSION_NOT_CONTINUE_ACTIVE = 29360233, + /** + * Result(29360234) for mission is not focused. + */ + MISSION_NOT_FOCUSED = 29360234, }; } // namespace DistributedSchedule } // namespace OHOS diff --git a/services/dtbschedmgr/src/continue/dsched_continue.cpp b/services/dtbschedmgr/src/continue/dsched_continue.cpp index 9c1cb5ad..b72ae217 100644 --- a/services/dtbschedmgr/src/continue/dsched_continue.cpp +++ b/services/dtbschedmgr/src/continue/dsched_continue.cpp @@ -723,7 +723,7 @@ int32_t DSchedContinue::CheckContinueAbilityPermission() if (missionInfo.continueState != AAFwk::ContinueState::CONTINUESTATE_ACTIVE) { HILOGE("Mission continue state set to INACTIVE. Can't continue. Mission id: %{public}d", continueInfo_.missionId_); - return INVALID_PARAMETERS_ERR; + return MISSION_NOT_CONTINUE_ACTIVE; } return ERR_OK; } diff --git a/services/dtbschedmgr/src/dfx/distributed_radar.cpp b/services/dtbschedmgr/src/dfx/distributed_radar.cpp index c4a5082d..850dc1da 100644 --- a/services/dtbschedmgr/src/dfx/distributed_radar.cpp +++ b/services/dtbschedmgr/src/dfx/distributed_radar.cpp @@ -810,7 +810,8 @@ bool DmsRadar::ClickIconDmsStartAbility(const std::string& func, int32_t errCode bool DmsRadar::ClickIconDmsRecvOver(const std::string& func, int32_t errCode) { int32_t res = ERR_OK; - StageRes stageRes = (errCode == ERR_OK) ? StageRes::STAGE_SUCC : StageRes::STAGE_FAIL; + StageRes stageRes = (errCode == ERR_OK || errCode == MISSION_NOT_FOCUSED || + errCode == MISSION_NOT_CONTINUE_ACTIVE) ? StageRes::STAGE_SUCC : StageRes::STAGE_FAIL; if (stageRes == StageRes::STAGE_SUCC) { res = HiSysEventWrite( APP_CONTINUE_DOMAIN, diff --git a/services/dtbschedmgr/src/mission/dms_continue_send_manager.cpp b/services/dtbschedmgr/src/mission/dms_continue_send_manager.cpp index ba4888bc..749ce4aa 100644 --- a/services/dtbschedmgr/src/mission/dms_continue_send_manager.cpp +++ b/services/dtbschedmgr/src/mission/dms_continue_send_manager.cpp @@ -214,7 +214,7 @@ int32_t DMSContinueSendMgr::GetMissionIdByBundleName(const std::string& bundleNa HILOGI("get missionId end, missionId: %{public}d", missionId); return ERR_OK; } - return INVALID_PARAMETERS_ERR; + return MISSION_NOT_FOCUSED; } void DMSContinueSendMgr::StartEvent() @@ -240,6 +240,10 @@ int32_t DMSContinueSendMgr::SendSoftbusEvent(uint16_t bundleNameId, uint8_t cont HILOGD("SendSoftbusEvent start, bundleNameId: %{public}u, continueTypeId: %{public}u", bundleNameId, continueTypeId); std::shared_ptr buffer = std::make_shared(DMS_SEND_LEN); + if (buffer->Data() == nullptr || buffer->Size() < DMS_SEND_LEN) { + HILOGE("Failed to initialize DSchedDataBuffer"); + return INVALID_PARAMETERS_ERR; + } buffer->Data()[0] = (type << CONTINUE_SHIFT_04) | DMS_DATA_LEN; buffer->Data()[1] = (bundleNameId >> CONTINUE_SHIFT_08) & DMS_0XFF; buffer->Data()[INDEX_2] = bundleNameId & DMS_0XFF;