From 971155194ac0e08d80ec3e3ff1a2a00f88576cc9 Mon Sep 17 00:00:00 2001 From: chenminghui Date: Fri, 11 Oct 2024 15:18:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=95=E5=8F=B7=EF=BC=9A#IAWAZ5=20=E6=8F=8F?= =?UTF-8?q?=E8=BF=B0:=E3=80=90B311=E3=80=91=E3=80=90=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E9=81=8D=E5=8E=86=E3=80=91=E3=80=90=E7=A8=B3=E5=AE=9A=E6=80=A7?= =?UTF-8?q?=E4=B8=93=E9=A1=B9=E3=80=911=E6=9C=8830=E6=97=A5=E5=88=B01?= =?UTF-8?q?=E6=9C=8831=E6=97=A5=EF=BC=8C=E8=BF=9B=E8=A1=8C12=E5=B0=8F?= =?UTF-8?q?=E6=97=B6=E7=B3=BB=E7=BB=9F=E9=81=8D=E5=8E=86=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=EF=BC=8C=E5=87=BA=E7=8E=B0appfreeze=E9=97=AE=E9=A2=98=EF=BC=8C?= =?UTF-8?q?=E8=BF=9B=E7=A8=8B=EF=BC=9Acom.ohos.demandplayer=EF=BC=8C?= =?UTF-8?q?=E5=B4=A9=E6=BA=83so=EF=BC=9Alibdevicemanagersdk.z.so=20https:/?= =?UTF-8?q?/e.gitee.com/kunyuan-hongke/projects/579136/bugs/table=3Fissue?= =?UTF-8?q?=5Ftype=5Fcategory=3Dbug&%3Bissue=3DI8XMRM&issue=3DI9097R=20?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E6=A0=B9=E5=9B=A0=EF=BC=9A=E7=BB=91=E5=AE=9A?= =?UTF-8?q?=E6=B5=81=E7=A8=8B=E4=B8=AD=E5=90=8C=E6=AD=A5=E6=89=A7=E8=A1=8C?= =?UTF-8?q?OpenAuthSession=EF=BC=8C=E5=BD=93=E6=80=BB=E7=BA=BF=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=9B=A0=E7=BD=91=E7=BB=9C=E5=8E=9F=E5=9B=A0=E9=98=BB?= =?UTF-8?q?=E5=A1=9E=E6=97=B6=EF=BC=8C=E4=BC=9A=E5=AF=BC=E8=87=B4=E4=B8=9A?= =?UTF-8?q?=E5=8A=A1=E9=98=BB=E5=A1=9E=20=E8=A7=A3=E5=86=B3=E6=96=B9?= =?UTF-8?q?=E6=A1=88=EF=BC=9A=E5=B0=86OpenAuthSession=E7=9A=84=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=E6=94=BE=E5=88=B0=E4=B8=80=E4=B8=AA=E6=96=B0=E7=9A=84?= =?UTF-8?q?=E7=BA=BF=E7=A8=8B=E4=B8=AD=E6=89=A7=E8=A1=8C=EF=BC=8C=E8=AE=A9?= =?UTF-8?q?=E7=BB=91=E5=AE=9A=E6=B5=81=E7=A8=8B=E4=B8=8D=E5=86=8D=E7=AD=89?= =?UTF-8?q?=E5=BE=85OpenAuthSession=E7=9A=84=E6=89=A7=E8=A1=8C=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=20=E6=98=AF=E5=90=A6=E5=AE=8C=E6=88=90=E5=8F=98?= =?UTF-8?q?=E6=88=90=E8=A7=84=E8=8C=83=E8=87=AA=E6=A3=80=EF=BC=9AY=20?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E7=BC=96=E8=AF=91=E4=B8=94=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E9=80=9A=E8=BF=87=EF=BC=9AY=20=E5=BD=B1=E5=93=8D=E7=9A=84?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E4=B8=8E=E5=B9=B3=E5=8F=B0=E8=8C=83=E5=9B=B4?= =?UTF-8?q?=EF=BC=9Ark3568?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: chenminghui Change-Id: I5cd259feab3f8d2c6035b140b951389446b4a7cc --- .../include/authentication/dm_auth_manager.h | 2 ++ .../src/authentication/dm_auth_manager.cpp | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/services/implementation/include/authentication/dm_auth_manager.h b/services/implementation/include/authentication/dm_auth_manager.h index c9716d65a..34350a38c 100644 --- a/services/implementation/include/authentication/dm_auth_manager.h +++ b/services/implementation/include/authentication/dm_auth_manager.h @@ -519,6 +519,7 @@ private: void PutAccessControlList(); void SinkAuthenticateFinish(); void SrcAuthenticateFinish(); + static void OpenAuthSession(); std::string GetBundleLable(const std::string &bundleName); bool IsScreenLocked(); std::string ConvertSrcVersion(const std::string &version, const std::string &edition); @@ -530,6 +531,7 @@ private: void DeleteOffLineTimer(int32_t sessionId); private: + static std::shared_ptr sessionState_; std::shared_ptr softbusConnector_; std::shared_ptr hiChainConnector_; std::shared_ptr authUiStateMgr_; diff --git a/services/implementation/src/authentication/dm_auth_manager.cpp b/services/implementation/src/authentication/dm_auth_manager.cpp index f5fb9c185..603e8e809 100644 --- a/services/implementation/src/authentication/dm_auth_manager.cpp +++ b/services/implementation/src/authentication/dm_auth_manager.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include "bundle_mgr_interface.h" #include "iservice_registry.h" @@ -94,6 +95,8 @@ constexpr const char* CANCEL_DISPLAY_KEY = "cancelPinCodeDisplay"; constexpr const char* DM_VERSION_4_1_5_1 = "4.1.5.1"; constexpr const char* DM_VERSION_5_0_1 = "5.0.1"; constexpr const char* DM_VERSION_5_0_2 = "5.0.2"; +constexpr const char* DM_OPEN_AUTH_SESSION = "dmOpenAuthSession"; +std::shared_ptr DmAuthManager::sessionState_ = nullptr; std::mutex g_authFinishLock; DmAuthManager::DmAuthManager(std::shared_ptr softbusConnector, @@ -233,10 +236,21 @@ void DmAuthManager::InitAuthState(const std::string &pkgName, int32_t authType, if (!DmRadarHelper::GetInstance().ReportAuthStart(peerTargetId_.deviceId, pkgName)) { LOGE("ReportAuthStart failed"); } - authRequestState_->Enter(); + sessionState_ = authRequestState_; + std::thread openAuthSession(OpenAuthSession); + if (pthread_setname_np(openAuthSession.native_handle(), DM_OPEN_AUTH_SESSION) != DM_OK) { + LOGE("OpenAuthSession setname failed."); + } + openAuthSession.detach(); LOGI("DmAuthManager::AuthenticateDevice complete"); } +void DmAuthManager::OpenAuthSession() +{ + LOGI("DmAuthManager::OpenAuthSession, state %d.", sessionState_->GetStateType()); + sessionState_->Enter(); +} + int32_t DmAuthManager::AuthenticateDevice(const std::string &pkgName, int32_t authType, const std::string &deviceId, const std::string &extra) { @@ -1245,6 +1259,7 @@ void DmAuthManager::AuthenticateFinish() authResponseContext_ = nullptr; authMessageProcessor_ = nullptr; authPtr_ = nullptr; + sessionState_ = nullptr; LOGI("DmAuthManager::AuthenticateFinish complete"); } -- Gitee