From ff66e821faccc0c85d5b66cee404022f4907079c Mon Sep 17 00:00:00 2001 From: "yanxiaotao@huawei.com" Date: Sun, 31 Dec 2023 09:54:53 +0800 Subject: [PATCH 1/8] bigfix for IsConnected. Signed-off-by: yanxiaotao@huawei.com --- .../wifi_framework/wifi_toolkit/config/wifi_settings.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_toolkit/config/wifi_settings.cpp b/wifi/services/wifi_standard/wifi_framework/wifi_toolkit/config/wifi_settings.cpp index b34b54e98..fcda5dcfb 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_toolkit/config/wifi_settings.cpp +++ b/wifi/services/wifi_standard/wifi_framework/wifi_toolkit/config/wifi_settings.cpp @@ -74,7 +74,8 @@ WifiSettings::WifiSettings() mWifiIpInfo[0] = ipInfo; IpV6Info ipv6Info; mWifiIpV6Info[0] = ipv6Info; - WifiLinkedInfo wifiLinkedInfo; + WifiLinkedInfo wifiLinkedInfo = {0}; + wifiLinkedInfo.channelWidth = WifiChannelWidth::WIDTH_INVALID; mWifiLinkedInfo[0] = wifiLinkedInfo; mMacAddress[0] = ""; mHotspotState[0] = static_cast(ApState::AP_STATE_CLOSED); @@ -1724,7 +1725,7 @@ void WifiSettings::GetLinkedChannelWidth(int instId) return; } } - LOGD("WifiSettings GetLinkedChannelWidth failed."); + LOGI("WifiSettings GetLinkedChannelWidth failed, bssid = %{public}s.", mWifiLinkedInfo[instId].bssid.c_str()); } void WifiSettings::UpdateLinkedChannelWidth(const std::string bssid, WifiChannelWidth channelWidth, int instId) -- Gitee From 8f0361a7b1f9fd9214d251987e8e7347f04c53c0 Mon Sep 17 00:00:00 2001 From: "yanxiaotao@huawei.com" Date: Sun, 31 Dec 2023 10:29:49 +0800 Subject: [PATCH 2/8] bigfix for IsConnected. Signed-off-by: yanxiaotao@huawei.com --- .../wifi_manage/wifi_sta/ista_service.h | 8 ++++++++ .../wifi_manage/wifi_sta/sta_interface.cpp | 12 ++++++++++++ .../wifi_manage/wifi_sta/sta_interface.h | 6 ++++++ .../wifi_manage/wifi_sta/sta_service.cpp | 8 ++++++++ .../wifi_manage/wifi_sta/sta_service.h | 8 ++++++++ .../wifi_sta_sa/wifi_device_service_impl.cpp | 18 +++++++++++++----- .../wifi_toolkit/config/wifi_settings.cpp | 2 +- 7 files changed, 56 insertions(+), 6 deletions(-) diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/ista_service.h b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/ista_service.h index 4874f5498..7db4ad7a3 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/ista_service.h +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/ista_service.h @@ -64,6 +64,14 @@ public: * @Return success: WIFI_OPT_SUCCESS fail: WIFI_OPT_FAILED */ virtual ErrCode ConnectToNetwork(int networkId) = 0; + /** + * @Description check wifi is connected or NOT. + * + * @param isConnected - true for connected, false for NOT.(out) + * @Output: Return operating results to Interface Service. + * @Return success: WIFI_OPT_SUCCESS fail: WIFI_OPT_FAILED + */ + virtual ErrCode IsConnected(bool &isConnected) = 0; /** * @Description Disconnect to the network * diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_interface.cpp b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_interface.cpp index 12ddfcba1..838e339e8 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_interface.cpp +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_interface.cpp @@ -107,6 +107,18 @@ ErrCode StaInterface::ConnectToDevice(const WifiDeviceConfig &config) return WIFI_OPT_SUCCESS; } +ErrCode StaInterface::IsConnected(bool &isConnected) +{ + LOGD("Enter StaInterface::isConnected.\n"); + std::lock_guard lock(mutex); + CHECK_NULL_AND_RETURN(pStaService, WIFI_OPT_FAILED); + if (pStaService->IsConnected(isConnected) != WIFI_OPT_SUCCESS) { + LOGD("IsConnected failed.\n"); + return WIFI_OPT_FAILED; + } + return WIFI_OPT_SUCCESS; +} + ErrCode StaInterface::ReConnect() { LOGD("Enter StaInterface::ReConnect.\n"); diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_interface.h b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_interface.h index 52d0b946d..57204f2b1 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_interface.h +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_interface.h @@ -76,6 +76,12 @@ public: * @Return success: WIFI_OPT_SUCCESS fail: WIFI_OPT_FAILED */ virtual ErrCode Disconnect() override; + /** + * @Description Is wifi connected + * + * @Return success: WIFI_OPT_SUCCESS fail: WIFI_OPT_FAILED + */ + virtual ErrCode IsConnected(bool &isConnected) override; /** * @Description ReConnect network * diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_service.cpp b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_service.cpp index a7a05e468..471ee85f5 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_service.cpp +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_service.cpp @@ -418,6 +418,14 @@ ErrCode StaService::ConnectToNetwork(int networkId) const return WIFI_OPT_SUCCESS; } +ErrCode StaService::IsConnected(bool &isConnected) const +{ + WIFI_LOGI("Enter IsConnected.\n"); + CHECK_NULL_AND_RETURN(pStaStateMachine, WIFI_OPT_FAILED); + isConnected = pStaStateMachine->linkedInfo.connState == ConnState::CONNECTED; + return WIFI_OPT_SUCCESS; +} + ErrCode StaService::ReAssociate() const { WIFI_LOGI("Enter ReAssociate.\n"); diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_service.h b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_service.h index 3b9761a6c..bbc239bef 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_service.h +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_service.h @@ -86,6 +86,14 @@ public: * @Return success: WIFI_OPT_SUCCESS fail: WIFI_OPT_FAILED */ virtual ErrCode Disconnect() const; + /** + * @Description check wifi is connected or NOT. + * + * @param isConnected - true for connected, false for NOT.(out) + * @Output: Return operating results to Interface Service. + * @Return success: WIFI_OPT_SUCCESS fail: WIFI_OPT_FAILED + */ + virtual ErrCode IsConnected(bool &isConnected) const; /** * @Description ReAssociate network * diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta_sa/wifi_device_service_impl.cpp b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta_sa/wifi_device_service_impl.cpp index adbd3c1dc..4571d55c0 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta_sa/wifi_device_service_impl.cpp +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta_sa/wifi_device_service_impl.cpp @@ -821,15 +821,23 @@ ErrCode WifiDeviceServiceImpl::ConnectToDevice(const WifiDeviceConfig &config) ErrCode WifiDeviceServiceImpl::IsConnected(bool &isConnected) { - WifiLinkedInfo linkedInfo; - + WifiLinkedInfo linkedInfo = {0}; if (WifiPermissionUtils::VerifyGetWifiInfoPermission() == PERMISSION_DENIED) { WIFI_LOGE("IsConnected:VerifyGetWifiInfoPermission() PERMISSION_DENIED!"); return WIFI_OPT_PERMISSION_DENIED; } - - WifiConfigCenter::GetInstance().GetLinkedInfo(linkedInfo, m_instId); - isConnected = (linkedInfo.connState == ConnState::CONNECTED); + isConnected = false; + if (!IsStaServiceRunning()) { + return WIFI_OPT_SUCCESS; + } + IStaService *pService = WifiServiceManager::GetInstance().GetStaServiceInst(m_instId); + if (pService == nullptr) { + WIFI_LOGE("IsConnected: pService is nullptr!"); + return WIFI_OPT_SUCCESS; + } + if (pService->IsConnected(isConnected) != WIFI_OPT_SUCCESS) { + WIFI_LOGE("IsConnected: IsConnected return fail!"); + } return WIFI_OPT_SUCCESS; } diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_toolkit/config/wifi_settings.cpp b/wifi/services/wifi_standard/wifi_framework/wifi_toolkit/config/wifi_settings.cpp index fcda5dcfb..40a25ef62 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_toolkit/config/wifi_settings.cpp +++ b/wifi/services/wifi_standard/wifi_framework/wifi_toolkit/config/wifi_settings.cpp @@ -74,7 +74,7 @@ WifiSettings::WifiSettings() mWifiIpInfo[0] = ipInfo; IpV6Info ipv6Info; mWifiIpV6Info[0] = ipv6Info; - WifiLinkedInfo wifiLinkedInfo = {0}; + WifiLinkedInfo wifiLinkedInfo; wifiLinkedInfo.channelWidth = WifiChannelWidth::WIDTH_INVALID; mWifiLinkedInfo[0] = wifiLinkedInfo; mMacAddress[0] = ""; -- Gitee From 3cdfe32fc146b0fbf5a29c162a53de8df2f6f463 Mon Sep 17 00:00:00 2001 From: "yanxiaotao@huawei.com" Date: Sun, 31 Dec 2023 10:52:57 +0800 Subject: [PATCH 3/8] bigfix for IsConnected. Signed-off-by: yanxiaotao@huawei.com --- .../wifi_manage/wifi_sta/sta_service.cpp | 2 +- .../wifi_manage/wifi_sta/sta_state_machine.cpp | 5 +++++ .../wifi_manage/wifi_sta/sta_state_machine.h | 11 +++++++++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_service.cpp b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_service.cpp index 471ee85f5..58f0e59eb 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_service.cpp +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_service.cpp @@ -422,7 +422,7 @@ ErrCode StaService::IsConnected(bool &isConnected) const { WIFI_LOGI("Enter IsConnected.\n"); CHECK_NULL_AND_RETURN(pStaStateMachine, WIFI_OPT_FAILED); - isConnected = pStaStateMachine->linkedInfo.connState == ConnState::CONNECTED; + isConnected = pStaStateMachine->GetLinedConnState() == ConnState::CONNECTED; return WIFI_OPT_SUCCESS; } diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_state_machine.cpp b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_state_machine.cpp index fdf739a1f..03b1d2a79 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_state_machine.cpp +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_state_machine.cpp @@ -2756,6 +2756,11 @@ void StaStateMachine::DealScreenStateChangedEvent(InternalMessage *msg) return; } +ConnState StaStateMachine::GetLinedConnState() +{ + return linkedInfo.connState; +} + /* ------------------ state machine dhcp callback function ----------------- */ StaStateMachine* StaStateMachine::DhcpResultNotify::pStaStateMachine = nullptr; StaStateMachine::DhcpResultNotify::DhcpResultNotify() diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_state_machine.h b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_state_machine.h index 9c16e11d5..bfd4fa044 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_state_machine.h +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_state_machine.h @@ -831,14 +831,21 @@ private: * @param networkId - networkId */ void OnWifiWpa3SelfCure(int failreason, int networkId); - + /** * @Description : Deal screen state change event. * * @param msg - Message body received by the state machine[in] */ void DealScreenStateChangedEvent(InternalMessage *msg); - + + /** + * @Description : Get connState for LikedInfo. + * + * @param msg - Message body received by the state machine[in] + */ + ConnState GetLinedConnState(); + #ifndef OHOS_ARCH_LITE /** * @Description Subscribe system ability changed. -- Gitee From d7d3c6b061fb09d0e2ffac85fcce66c3f08b424d Mon Sep 17 00:00:00 2001 From: "yanxiaotao@huawei.com" Date: Sun, 31 Dec 2023 11:11:18 +0800 Subject: [PATCH 4/8] bigfix for IsConnected. Signed-off-by: yanxiaotao@huawei.com --- .../wifi_manage/wifi_sta_sa/wifi_device_service_impl.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta_sa/wifi_device_service_impl.cpp b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta_sa/wifi_device_service_impl.cpp index 4571d55c0..7e5feae92 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta_sa/wifi_device_service_impl.cpp +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta_sa/wifi_device_service_impl.cpp @@ -821,7 +821,6 @@ ErrCode WifiDeviceServiceImpl::ConnectToDevice(const WifiDeviceConfig &config) ErrCode WifiDeviceServiceImpl::IsConnected(bool &isConnected) { - WifiLinkedInfo linkedInfo = {0}; if (WifiPermissionUtils::VerifyGetWifiInfoPermission() == PERMISSION_DENIED) { WIFI_LOGE("IsConnected:VerifyGetWifiInfoPermission() PERMISSION_DENIED!"); return WIFI_OPT_PERMISSION_DENIED; -- Gitee From 54b93eaceb7814adeb928b5fb65f85dd8d77d027 Mon Sep 17 00:00:00 2001 From: "yanxiaotao@huawei.com" Date: Sun, 31 Dec 2023 11:35:06 +0800 Subject: [PATCH 5/8] bigfix for IsConnected. Signed-off-by: yanxiaotao@huawei.com --- .../wifi_manage/wifi_sta/sta_service.cpp | 2 +- .../wifi_manage/wifi_sta/sta_state_machine.cpp | 10 +++++----- .../wifi_manage/wifi_sta/sta_state_machine.h | 14 +++++++------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_service.cpp b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_service.cpp index 58f0e59eb..e64a6ea93 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_service.cpp +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_service.cpp @@ -422,7 +422,7 @@ ErrCode StaService::IsConnected(bool &isConnected) const { WIFI_LOGI("Enter IsConnected.\n"); CHECK_NULL_AND_RETURN(pStaStateMachine, WIFI_OPT_FAILED); - isConnected = pStaStateMachine->GetLinedConnState() == ConnState::CONNECTED; + isConnected = pStaStateMachine->GetLinkedConnState() == ConnState::CONNECTED; return WIFI_OPT_SUCCESS; } diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_state_machine.cpp b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_state_machine.cpp index 03b1d2a79..bfe88cf1d 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_state_machine.cpp +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_state_machine.cpp @@ -2756,11 +2756,6 @@ void StaStateMachine::DealScreenStateChangedEvent(InternalMessage *msg) return; } -ConnState StaStateMachine::GetLinedConnState() -{ - return linkedInfo.connState; -} - /* ------------------ state machine dhcp callback function ----------------- */ StaStateMachine* StaStateMachine::DhcpResultNotify::pStaStateMachine = nullptr; StaStateMachine::DhcpResultNotify::DhcpResultNotify() @@ -3014,6 +3009,11 @@ int StaStateMachine::GetLinkedInfo(WifiLinkedInfo& linkedInfo) return WifiSettings::GetInstance().GetLinkedInfo(linkedInfo, m_instId); } +ConnState StaStateMachine::GetLinkedConnState() +{ + return linkedInfo.connState; +} + ErrCode StaStateMachine::DisableNetwork(int networkId) { if (WifiStaHalInterface::GetInstance().DisableNetwork(networkId) != WIFI_IDL_OPT_OK) { diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_state_machine.h b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_state_machine.h index bfd4fa044..f2e928d91 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_state_machine.h +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_state_machine.h @@ -426,6 +426,13 @@ public: */ int GetLinkedInfo(WifiLinkedInfo& linkedInfo); + /** + * @Description : Get connState for LikedInfo. + * + * @return ConnState - ConnState of LikedInfo. + */ + ConnState GetLinkedConnState(); + /** * @Description Reupdate net link info */ @@ -839,13 +846,6 @@ private: */ void DealScreenStateChangedEvent(InternalMessage *msg); - /** - * @Description : Get connState for LikedInfo. - * - * @param msg - Message body received by the state machine[in] - */ - ConnState GetLinedConnState(); - #ifndef OHOS_ARCH_LITE /** * @Description Subscribe system ability changed. -- Gitee From 83d569d444c82ff7de8d4b2699ecbe1fbbf902ee Mon Sep 17 00:00:00 2001 From: "yanxiaotao@huawei.com" Date: Sun, 31 Dec 2023 12:11:02 +0800 Subject: [PATCH 6/8] bigfix for IsConnected. Signed-off-by: yanxiaotao@huawei.com --- .../wifi_framework/wifi_toolkit/config/wifi_settings.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_toolkit/config/wifi_settings.cpp b/wifi/services/wifi_standard/wifi_framework/wifi_toolkit/config/wifi_settings.cpp index 40a25ef62..0ec175f81 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_toolkit/config/wifi_settings.cpp +++ b/wifi/services/wifi_standard/wifi_framework/wifi_toolkit/config/wifi_settings.cpp @@ -969,7 +969,8 @@ int WifiSettings::GetLinkedInfo(WifiLinkedInfo &info, int instId) std::unique_lock lock(mInfoMutex); auto iter = mWifiLinkedInfo.find(instId); if (iter != mWifiLinkedInfo.end()) { - if (iter->second.channelWidth == WifiChannelWidth::WIDTH_INVALID) { + if (iter->second.channelWidth == WifiChannelWidth::WIDTH_INVALID && + mWifiLinkedInfo[instId].bssid.size() != 0) { GetLinkedChannelWidth(instId); } info = iter->second; @@ -1725,7 +1726,8 @@ void WifiSettings::GetLinkedChannelWidth(int instId) return; } } - LOGI("WifiSettings GetLinkedChannelWidth failed, bssid = %{public}s.", mWifiLinkedInfo[instId].bssid.c_str()); + LOGI("WifiSettings GetLinkedChannelWidth failed, bssid = %{public}s.", + MacAnonymize(mWifiLinkedInfo[instId].bssid)); } void WifiSettings::UpdateLinkedChannelWidth(const std::string bssid, WifiChannelWidth channelWidth, int instId) -- Gitee From 98c12355cfc1651918cc1177e5492e84b8ac7115 Mon Sep 17 00:00:00 2001 From: "yanxiaotao@huawei.com" Date: Sun, 31 Dec 2023 16:52:21 +0800 Subject: [PATCH 7/8] bigfix for IsConnected. Signed-off-by: yanxiaotao@huawei.com --- .../wifi_framework/wifi_toolkit/config/wifi_settings.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_toolkit/config/wifi_settings.cpp b/wifi/services/wifi_standard/wifi_framework/wifi_toolkit/config/wifi_settings.cpp index 0ec175f81..35683b6eb 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_toolkit/config/wifi_settings.cpp +++ b/wifi/services/wifi_standard/wifi_framework/wifi_toolkit/config/wifi_settings.cpp @@ -1726,8 +1726,8 @@ void WifiSettings::GetLinkedChannelWidth(int instId) return; } } - LOGI("WifiSettings GetLinkedChannelWidth failed, bssid = %{public}s.", - MacAnonymize(mWifiLinkedInfo[instId].bssid)); + LOGI("WifiSettings GetLinkedChannelWidth failed, bssid = %{private}s.", + mWifiLinkedInfo[instId].bssid.c_str()); } void WifiSettings::UpdateLinkedChannelWidth(const std::string bssid, WifiChannelWidth channelWidth, int instId) -- Gitee From 4f41ed88a3a51e186d37cfa1cc0f8c34b53e64d4 Mon Sep 17 00:00:00 2001 From: "yanxiaotao@huawei.com" Date: Sun, 31 Dec 2023 21:17:46 +0800 Subject: [PATCH 8/8] bigfix for IsConnected. Signed-off-by: yanxiaotao@huawei.com --- wifi/frameworks/native/src/wifi_device_impl.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wifi/frameworks/native/src/wifi_device_impl.cpp b/wifi/frameworks/native/src/wifi_device_impl.cpp index 7d3a53ae9..fb219db08 100644 --- a/wifi/frameworks/native/src/wifi_device_impl.cpp +++ b/wifi/frameworks/native/src/wifi_device_impl.cpp @@ -45,6 +45,8 @@ WifiDeviceImpl::~WifiDeviceImpl() { #ifdef OHOS_ARCH_LITE WifiDeviceProxy::ReleaseInstance(); +#else + client_ = nullptr; #endif } @@ -75,6 +77,11 @@ bool WifiDeviceImpl::GetWifiDeviceProxy() #ifdef OHOS_ARCH_LITE return (client_ != nullptr); #else + if (client_ != nullptr) { + WIFI_LOGD("client_ has been inited!"); + return true; + } + WifiSaLoadManager::GetInstance().LoadWifiSa(systemAbilityId_); if (IsRemoteDied() == false) { return true; -- Gitee