diff --git a/services/implementation/src/authentication_v2/auth_stages/auth_acl.cpp b/services/implementation/src/authentication_v2/auth_stages/auth_acl.cpp index 727dfef398fca73269d3c467ce1c894f26266d5b..23ed565e029c67afa7a7c9c30287bdb70471a101 100644 --- a/services/implementation/src/authentication_v2/auth_stages/auth_acl.cpp +++ b/services/implementation/src/authentication_v2/auth_stages/auth_acl.cpp @@ -110,10 +110,10 @@ DmAuthStateType AuthSrcDataSyncState::GetStateType() int32_t AuthSinkFinishState::Action(std::shared_ptr context) { LOGI("AuthSinkFinishState::Action start"); - context->state = static_cast(GetStateType()); int32_t ret = DM_OK; LOGI("reason: %{public}d", context->reason); if (context->reason == DM_OK) { + context->state = static_cast(GetStateType()); ret = FreezeProcess::GetInstance().DeleteFreezeRecord(context->accessee.bundleName, context->accessee.deviceType); LOGI("DeleteFreezeRecord ret: %{public}d", ret); @@ -143,6 +143,8 @@ int32_t AuthSrcFinishState::Action(std::shared_ptr context) LOGI("AuthSrcFinishState::Action start"); if (context->reason != DM_OK) { context->authMessageProcessor->CreateAndSendMsg(MSG_TYPE_AUTH_REQ_FINISH, context); + } else { + context->state = static_cast(GetStateType()); } SourceFinish(context); LOGI("AuthSrcFinishState::Action ok"); diff --git a/services/implementation/src/authentication_v2/dm_auth_state.cpp b/services/implementation/src/authentication_v2/dm_auth_state.cpp index 3476d8563f4de95e73ece17fa2da260fc51a2d2a..7ab8d7a8cda4cca04c3270a42e9d0aef58bf54ed 100644 --- a/services/implementation/src/authentication_v2/dm_auth_state.cpp +++ b/services/implementation/src/authentication_v2/dm_auth_state.cpp @@ -111,7 +111,7 @@ bool DmAuthState::IsScreenLocked() void DmAuthState::SourceFinish(std::shared_ptr context) { - LOGI("SourceFinish reason:%{public}d", context->reason); + LOGI("SourceFinish reason:%{public}d, state:%{public}d", context->reason, context->state); context->listener->OnAuthResult(context->processInfo, context->peerTargetId.deviceId, context->accessee.tokenIdHash, GetOutputState(context->state), context->reason); context->listener->OnBindResult(context->processInfo, context->peerTargetId, @@ -147,7 +147,7 @@ void DmAuthState::SourceFinish(std::shared_ptr context) void DmAuthState::SinkFinish(std::shared_ptr context) { - LOGI("SinkFinish reason:%{public}d", context->reason); + LOGI("SinkFinish reason:%{public}d, state:%{public}d", context->reason, context->state); context->processInfo.pkgName = context->accessee.pkgName; context->listener->OnSinkBindResult(context->processInfo, context->peerTargetId, GetOutputReplay(context->accessee.bundleName, context->reason), diff --git a/services/implementation/src/authentication_v2/dm_auth_state_machine.cpp b/services/implementation/src/authentication_v2/dm_auth_state_machine.cpp index fea4121847bb63a0245eee0c5ca6d1c5c0744134..74bba53bb67a377c515e9edb1541b0eb6a904926 100644 --- a/services/implementation/src/authentication_v2/dm_auth_state_machine.cpp +++ b/services/implementation/src/authentication_v2/dm_auth_state_machine.cpp @@ -311,6 +311,7 @@ void DmAuthStateMachine::NotifyEventFinish(DmEventType eventType) void DmAuthStateMachine::Run(std::shared_ptr context) { while (running_.load()) { + context->state = static_cast(GetCurState()); auto state = FetchAndSetCurState(); if (!state.has_value()) { break; @@ -320,7 +321,6 @@ void DmAuthStateMachine::Run(std::shared_ptr context) } // Obtain the status and execute the status action. DmAuthStateType stateType = state.value()->GetStateType(); - context->state = static_cast(stateType); int32_t ret = state.value()->Action(context); if (ret != DM_OK) { LOGE("DmAuthStateMachine::Run err:%{public}d", ret);