From 8301e5b26d082d89af63a8d3f10f3a8838ef8e4d Mon Sep 17 00:00:00 2001 From: q30043944 Date: Thu, 5 Jun 2025 22:26:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=BE=93=E5=85=A5=E6=A1=86?= =?UTF-8?q?=E9=94=80=E6=AF=81=E6=85=A2=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: q30043944 --- .../src/authentication_v2/auth_manager.cpp | 1 + .../implementation/src/device_manager_service_impl.cpp | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/services/implementation/src/authentication_v2/auth_manager.cpp b/services/implementation/src/authentication_v2/auth_manager.cpp index cf5a594b2..258ec1cd1 100644 --- a/services/implementation/src/authentication_v2/auth_manager.cpp +++ b/services/implementation/src/authentication_v2/auth_manager.cpp @@ -231,6 +231,7 @@ int32_t AuthManager::StopAuthenticateDevice(const std::string &pkgName) LOGI("AuthManager::StopAuthenticateDevice start"); context_->reason = STOP_BIND; + context_->authStateMachine->NotifyEventFinish(DmEventType::ON_FAIL); if (context_->direction == DM_AUTH_SOURCE) { context_->authStateMachine->TransitionTo(std::make_shared()); } else { diff --git a/services/implementation/src/device_manager_service_impl.cpp b/services/implementation/src/device_manager_service_impl.cpp index 8eb9f4f7a..e641bebb8 100644 --- a/services/implementation/src/device_manager_service_impl.cpp +++ b/services/implementation/src/device_manager_service_impl.cpp @@ -65,6 +65,7 @@ constexpr const char* DM_TAG_PEER_DISPLAY_ID = "peerDisplayId"; constexpr const char* DM_TAG_ACCESSEE_USER_ID = "accesseeUserId"; constexpr const char* DM_TAG_EXTRA_INFO = "extraInfo"; constexpr const char* CHANGE_PINTYPE = "1"; +constexpr const char* BIND_CALLER_USERID = "bindCallerUserId"; // currently, we just support one bind session in one device at same time constexpr size_t MAX_NEW_PROC_SESSION_COUNT_TEMP = 1; const int32_t USLEEP_TIME_US_500000 = 500000; // 500ms @@ -1744,10 +1745,18 @@ void DeviceManagerServiceImpl::BindTargetImpl(uint64_t tokenId, const std::strin return; } } + ProcessInfo processInfo; + processInfo.pkgName = pkgName; + if (bindParam.count(BIND_CALLER_USERID) != 0) { + processInfo.userId = std::atoi(bindParam.at(BIND_CALLER_USERID).c_str()); + } // Created only at the source end. The same target device will not be created repeatedly with the new protocol. std::shared_ptr curSession = GetOrCreateSession(targetIdTmp.deviceId, bindParam); if (curSession == nullptr) { LOGE("Failed to create the session. Target deviceId: %{public}s.", targetIdTmp.deviceId.c_str()); + listener_->OnAuthResult(processInfo, targetIdTmp.deviceId, "", DmAuthStatus::STATUS_DM_AUTH_DEFAULT, + ERR_DM_TIME_OUT); + listener_->OnBindResult(processInfo, targetId, ERR_DM_TIME_OUT, DmAuthStatus::STATUS_DM_AUTH_DEFAULT, ""); return; } -- Gitee