!1086 锁屏时判断当前应用的接续状态

Merge pull request !1086 from m30043719/master
This commit is contained in:
openharmony_ci 2024-09-14 11:35:22 +00:00 committed by Gitee
commit cf0ecc0b90
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -365,7 +365,7 @@ int32_t DMSContinueSendMgr::CheckContinueState(const int32_t missionId)
int32_t ret = abilityMgr->GetMissionInfo("", missionId, info); int32_t ret = abilityMgr->GetMissionInfo("", missionId, info);
if (ret != ERR_OK) { if (ret != ERR_OK) {
HILOGE("get missionInfo failed, missionId: %{public}d, ret: %{public}d", missionId, ret); HILOGE("get missionInfo failed, missionId: %{public}d, ret: %{public}d", missionId, ret);
return ERR_OK; return INVALID_PARAMETERS_ERR;
} }
if (info.continueState != AAFwk::ContinueState::CONTINUESTATE_ACTIVE) { if (info.continueState != AAFwk::ContinueState::CONTINUESTATE_ACTIVE) {
HILOGE("Mission continue state set to INACTIVE. Broadcast task abort."); HILOGE("Mission continue state set to INACTIVE. Broadcast task abort.");
@ -541,12 +541,16 @@ int32_t DMSContinueSendMgr::DealSetMissionContinueStateBusiness(const int32_t mi
const AAFwk::ContinueState &state) const AAFwk::ContinueState &state)
{ {
HILOGI("DealSetMissionContinueStateBusiness start, missionId: %{public}d, state: %{public}d", missionId, state); HILOGI("DealSetMissionContinueStateBusiness start, missionId: %{public}d, state: %{public}d", missionId, state);
std::string bundleName; if (info_.currentMissionId != missionId) {
if (info_.currentMissionId != missionId && GetBundleNameByMissionId(missionId, bundleName) != ERR_OK) { HILOGE("mission is not focused, broadcast task abort, missionId: %{public}d", missionId);
return INVALID_PARAMETERS_ERR;
}
std::string bundleName;
if (state == AAFwk::ContinueState::CONTINUESTATE_ACTIVE &&
GetBundleNameByMissionId(missionId, bundleName) != ERR_OK) {
HILOGE("mission is not focused, broadcast task abort, missionId: %{public}d", missionId); HILOGE("mission is not focused, broadcast task abort, missionId: %{public}d", missionId);
return INVALID_PARAMETERS_ERR; return INVALID_PARAMETERS_ERR;
} }
if (!info_.currentIsContinuable) { if (!info_.currentIsContinuable) {
HILOGI("mission is not continuable, broadcast task abort, missionId: %{public}d", missionId); HILOGI("mission is not continuable, broadcast task abort, missionId: %{public}d", missionId);
return INVALID_PARAMETERS_ERR; return INVALID_PARAMETERS_ERR;
@ -620,11 +624,11 @@ int32_t DMSContinueSendMgr::NotifyDeviceOnline()
void DMSContinueSendMgr::OnDeviceScreenOff() void DMSContinueSendMgr::OnDeviceScreenOff()
{ {
HILOGI("OnDeviceScreenOff called"); HILOGI("OnDeviceScreenOff called");
if (!info_.currentIsContinuable) { int32_t missionId = info_.currentMissionId;
if (!info_.currentIsContinuable || CheckContinueState(missionId) != ERR_OK) {
HILOGW("current mission is not continuable, ignore"); HILOGW("current mission is not continuable, ignore");
return; return;
} }
int32_t missionId = info_.currentMissionId;
auto feedfunc = [this, missionId]() { auto feedfunc = [this, missionId]() {
if (screenOffHandler_ != nullptr) { if (screenOffHandler_ != nullptr) {
screenOffHandler_->OnDeviceScreenOff(missionId); screenOffHandler_->OnDeviceScreenOff(missionId);