!3377 检查datashare状态

Merge pull request !3377 from yanghui/master
This commit is contained in:
openharmony_ci 2024-11-21 14:36:06 +00:00 committed by Gitee
commit 61a1592393
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
16 changed files with 114 additions and 173 deletions

View File

@ -85,7 +85,6 @@
"OHOS::Wifi::WifiEventSubscriberManager::GetWifiAllowSemiActiveByDatashare()";
"OHOS::Wifi::WifiEventSubscriberManager::GetLocationModeByDatashare()";
"OHOS::Wifi::WifiEventSubscriberManager::DealLocationModeChangeEvent()";
"OHOS::Wifi::WifiEventSubscriberManager::DealCloneDataChangeEvent()";
"OHOS::Wifi::WifiEventSubscriberManager::CheckAndStartStaByDatashare()";
"OHOS::Wifi::WifiEventSubscriberManager::IsMdmForbidden()";
"OHOS::Wifi::WifiEventSubscriberManager::OnSystemAbilityChanged(int systemAbilityId, bool add) override";
@ -94,7 +93,6 @@
"OHOS::Wifi::WifiHotspotManager::StartUnloadApSaTimer()";
"OHOS::Wifi::WifiHotspotManager::CloseApService(int)";
"OHOS::Wifi::WifiLocationModeObserver::OnChange() override";
"OHOS::Wifi::WifiCloneModeObserver::OnChange() override";
"OHOS::Wifi::WifiMultiVapManager::CheckCanConnectDevice()";
"OHOS::Wifi::WifiMultiVapManager::CheckCanUseP2p()";
"OHOS::Wifi::WifiMultiVapManager::CheckCanUseSoftAp()";

View File

@ -79,6 +79,7 @@
"OHOS::Wifi::WifiCountryCodeManager::TriggerUpdateWifiCountryCode(int)";
"OHOS::Wifi::WifiCountryCodePolicy::CalculateWifiCountryCode(std::string &)";
"OHOS::Wifi::WifiDataShareHelperUtils::GetInstance()";
"OHOS::Wifi::WifiDataShareHelperUtils::CheckIfSettingsDataReady()";
"OHOS::Wifi::WifiDataShareHelperUtils::GetLoactionDataShareUri()";
"OHOS::Wifi::WifiDataShareHelperUtils::Query(OHOS::Uri&, std::__h::basic_string<char, std::__h::char_traits<char>, std::__h::allocator<char>> const&, std::__h::basic_string<char, std::__h::char_traits<char>, std::__h::allocator<char>>&, bool)";
"OHOS::Wifi::WifiDataShareHelperUtils::Insert(Uri &, const std::string &, const std::string &)";

View File

@ -21,6 +21,7 @@
#endif
#include "wifi_log.h"
#include "wifi_logger.h"
#include "system_ability_definition.h"
DEFINE_WIFILOG_LABEL("WifiDataShareHelperUtils");
@ -32,6 +33,10 @@ constexpr const char *SETTINGS_DATASHARE_URI =
constexpr const char *SETTINGS_DATA_EXT_URI = "datashare:///com.ohos.settingsdata.DataAbility";
constexpr const char *SETTINGS_DATA_COLUMN_KEYWORD = "KEYWORD";
constexpr const char *SETTINGS_DATA_COLUMN_VALUE = "VALUE";
// E_OK and E_DATA_SHARE_NOT_READY used to check datashare ready
constexpr const int32_t E_OK = 0;
constexpr const int32_t E_DATA_SHARE_NOT_READY = 1055;
}
WifiDataShareHelperUtils& WifiDataShareHelperUtils::GetInstance()
@ -40,8 +45,66 @@ WifiDataShareHelperUtils& WifiDataShareHelperUtils::GetInstance()
return instance;
}
bool WifiDataShareHelperUtils::IsDataMgrServiceActive()
{
sptr<ISystemAbilityManager> saMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
if (saMgr == nullptr) {
WIFI_LOGE("Failed to get SystemAbilityManager!");
return false;
}
sptr<IRemoteObject> object = saMgr->CheckSystemAbility(DISTRIBUTED_KV_DATA_SERVICE_ABILITY_ID);
if (object == nullptr) {
WIFI_LOGE("Failed to get DataMgrService!");
return false;
}
return true;
}
bool WifiDataShareHelperUtils::CheckIfSettingsDataReady()
{
if (isDataShareReady_) {
return true;
}
if (!IsDataMgrServiceActive()) {
return false;
}
auto remote = sptr<IWifiDataShareRemoteBroker>(new (std::nothrow) IRemoteStub<IWifiDataShareRemoteBroker>());
if (remote == nullptr) {
WIFI_LOGE("%{public}s remote is nullptr", __func__);
return false;
}
auto remoteObj = remote->AsObject();
if (remoteObj == nullptr) {
WIFI_LOGE("%{public}s remoteObj_ is nullptr", __func__);
return false;
}
std::pair<int, std::shared_ptr<DataShare::DataShareHelper>> ret =
DataShare::DataShareHelper::Create(remoteObj, SETTINGS_DATASHARE_URI, SETTINGS_DATA_EXT_URI);
WIFI_LOGI("%{public}s create datashare helper, ret = %{public}d", __func__, ret.first);
if (ret.first == E_DATA_SHARE_NOT_READY) {
return false;
}
if (ret.first == E_OK) {
if (ret.second) {
ret.second->Release();
}
isDataShareReady_ = true;
}
return true;
}
std::shared_ptr<DataShare::DataShareHelper> WifiDataShareHelperUtils::WifiCreateDataShareHelper(bool onlySettingsData)
{
if (!CheckIfSettingsDataReady()) {
WIFI_LOGE("%{public}s datashare not ready.", __func__);
return nullptr;
}
auto remote = sptr<IWifiDataShareRemoteBroker>(new (std::nothrow) IRemoteStub<IWifiDataShareRemoteBroker>());
if (remote == nullptr) {
WIFI_LOGE("%{public}s remote is nullptr", __func__);

View File

@ -37,10 +37,6 @@ constexpr const char *SETTINGS_DATASHARE_KEY_AIRPLANE_MODE = "settings.telephony
constexpr const char *SETTINGS_DATASHARE_KEY_LOCATION_MODE = "location_switch_enable";
#ifndef OHOS_ARCH_LITE
constexpr const char *SETTINGS_DATASHARE_URI_CLONE_DATA =
"datashare:///com.ohos.settingsdata/entry/settingsdata/SETTINGSDATA?Proxy=true&key=WifiBackupData";
constexpr const char *SETTINGS_DATASHARE_KEY_CLONE_DATA = "WifiBackupData";
constexpr const char *SETTINGS_DATASHARE_URI_WIFI_ON =
"datashare:///com.ohos.settingsdata/entry/settingsdata/SETTINGSDATA?Proxy=true&key=wifi_on";
constexpr const char *SETTINGS_DATASHARE_KEY_WIFI_ON = "wifi_on";
@ -70,6 +66,13 @@ public:
*/
static WifiDataShareHelperUtils &GetInstance();
/**
* @Description : Check if SettingsData ready
*
* @return true - datashare ready
*/
bool CheckIfSettingsDataReady();
/**
* @Description : Query function
*
@ -127,6 +130,9 @@ private:
std::shared_ptr<DataShare::DataShareHelper> WifiCreateDataShareHelper(bool onlySettingsData = false);
void ClearResources(std::shared_ptr<DataShare::DataShareHelper> operatrPtr,
std::shared_ptr<DataShare::DataShareResultSet> result);
bool IsDataMgrServiceActive();
bool isDataShareReady_ = false;
};
class IWifiDataShareRemoteBroker : public IRemoteBroker {

View File

@ -42,7 +42,6 @@ DEFINE_WIFILOG_LABEL("WifiEventSubscriberManager");
namespace OHOS {
namespace Wifi {
constexpr uint32_t TIMEOUT_EVENT_SUBSCRIBER = 3000;
constexpr uint32_t TIMEOUT_EVENT_DELAY_ACCESS_DATASHARE = 10 * 1000;
constexpr uint32_t PROP_LEN = 26;
constexpr uint32_t PROP_SUBCHIPTYPE_LEN = 10;
constexpr uint32_t SUPPORT_COEXCHIP_LEN = 7;
@ -59,7 +58,6 @@ const std::string WIFI_STANDBY_SLEEPING = "sleeping";
bool WifiEventSubscriberManager::mIsMdmForbidden = false;
static sptr<WifiLocationModeObserver> locationModeObserver_ = nullptr;
static sptr<WifiCloneModeObserver> cloneModeObserver_ = nullptr;
#ifdef HAS_MOVEMENT_PART
static sptr<DeviceMovementCallback> deviceMovementCallback_ = nullptr;
#endif
@ -81,19 +79,14 @@ const std::map<std::string, CesFuncType> CES_REQUEST_MAP = {
{OHOS::EventFwk::CommonEventSupport::COMMON_EVENT_DEVICE_IDLE_MODE_CHANGED, &
CesEventSubscriber::OnReceiveStandbyEvent},
{OHOS::EventFwk::CommonEventSupport::COMMON_EVENT_USER_UNLOCKED, &
CesEventSubscriber::OnReceiveUserUnlockedEvent}
CesEventSubscriber::OnReceiveUserUnlockedEvent},
{OHOS::EventFwk::CommonEventSupport::COMMON_EVENT_DATA_SHARE_READY, &
CesEventSubscriber::OnReceiveDataShareReadyEvent}
};
WifiEventSubscriberManager::WifiEventSubscriberManager()
{
WIFI_LOGI("create WifiEventSubscriberManager");
if (accessDatashareTimerId == 0) {
WifiTimer::TimerCallback timeoutCallback = [this]() { this->DelayedAccessDataShare(); };
WifiTimer::GetInstance()->Register(
timeoutCallback, accessDatashareTimerId, TIMEOUT_EVENT_DELAY_ACCESS_DATASHARE);
WIFI_LOGI("DelayedAccessDataShare register success! accessDatashareTimerId:%{public}u", accessDatashareTimerId);
}
RegisterCesEvent();
RegisterNotificationEvent();
#ifdef HAS_POWERMGR_PART
@ -102,13 +95,12 @@ WifiEventSubscriberManager::WifiEventSubscriberManager()
#ifdef SUPPORT_ClOUD_WIFI_ASSET
RegisterAssetEvent();
#endif
if (IsDataMgrServiceActive()) {
RegisterCloneEvent();
}
InitSubscribeListener();
GetMdmProp();
GetChipProp();
RegisterMdmPropListener();
RegisterNetworkStateChangeEvent();
RegisterWifiScanChangeEvent();
}
WifiEventSubscriberManager::~WifiEventSubscriberManager()
@ -119,7 +111,6 @@ WifiEventSubscriberManager::~WifiEventSubscriberManager()
UnRegisterAssetEvent();
#endif
UnRegisterNotificationEvent();
UnRegisterCloneEvent();
UnRegisterLocationEvent();
UnRegisterNetworkStateChangeEvent();
UnRegisterWifiScanChangeEvent();
@ -203,12 +194,15 @@ void WifiEventSubscriberManager::HandleHasMovementPartChange(int systemAbilityId
void WifiEventSubscriberManager::HandleDistributedKvDataServiceChange(bool add)
{
WIFI_LOGI("HandleDistributedKvDataServiceChange, mode=[%{public}d]!", add);
if (!add) {
UnRegisterCloneEvent();
UnRegisterLocationEvent();
return;
}
RegisterLocationEvent();
RegisterCloneEvent();
if (WifiDataShareHelperUtils::GetInstance().CheckIfSettingsDataReady()) {
AccessDataShare();
RegisterLocationEvent();
}
}
void WifiEventSubscriberManager::HandleCastServiceChange(bool add)
@ -358,44 +352,6 @@ void WifiEventSubscriberManager::DealLocationModeChangeEvent()
}
}
void WifiEventSubscriberManager::GetCloneDataByDatashare(std::string &cloneData)
{
Uri uri(SETTINGS_DATASHARE_URI_CLONE_DATA);
int ret = WifiDataShareHelperUtils::GetInstance().Query(uri, SETTINGS_DATASHARE_KEY_CLONE_DATA, cloneData);
if (ret != WIFI_OPT_SUCCESS) {
WIFI_LOGE("GetCloneDataByDatashare, Query cloneMode fail!");
return;
}
WIFI_LOGI("GetCloneDataByDatashare success");
}
void WifiEventSubscriberManager::SetCloneDataByDatashare(const std::string &cloneData)
{
Uri uri(SETTINGS_DATASHARE_URI_CLONE_DATA);
int ret = WifiDataShareHelperUtils::GetInstance().Update(uri, SETTINGS_DATASHARE_KEY_CLONE_DATA, cloneData);
if (ret != WIFI_OPT_SUCCESS) {
WIFI_LOGE("SetCloneDataByDatashare, Update cloneData fail!");
return;
}
WIFI_LOGI("SetCloneDataByDatashare success");
}
void WifiEventSubscriberManager::DealCloneDataChangeEvent()
{
WIFI_LOGI("DealCloneDataChangeEvent enter");
mWifiEventSubsThread = std::make_unique<WifiEventHandler>("WifiEventSubsThread");
mWifiEventSubsThread->PostAsyncTask([this]() {
std::string cloneData;
GetCloneDataByDatashare(cloneData);
if (cloneData.empty()) {
return;
}
WifiSettings::GetInstance().MergeWifiCloneConfig(cloneData);
cloneData.clear();
SetCloneDataByDatashare("");
});
}
void WifiEventSubscriberManager::CheckAndStartStaByDatashare()
{
constexpr int openWifi = 1;
@ -420,20 +376,24 @@ bool WifiEventSubscriberManager::IsMdmForbidden()
return mIsMdmForbidden;
}
void WifiEventSubscriberManager::DelayedAccessDataShare()
void WifiEventSubscriberManager::AccessDataShare()
{
WIFI_LOGI("DelayedAccessDataShare enter!");
WIFI_LOGI("AccessDataShare enter!");
{
std::unique_lock<std::mutex> lock(accessDataShareMutex_);
if (accessDataShare_) {
return;
}
accessDataShare_ = true;
}
std::filesystem::path pathName = WIFI_CONFIG_FILE_PATH;
std::error_code code;
if (!std::filesystem::exists(pathName, code)) {
CheckAndStartStaByDatashare();
}
GetAirplaneModeByDatashare();
if (accessDatashareTimerId != 0) {
WifiTimer::GetInstance()->UnRegister(accessDatashareTimerId);
accessDatashareTimerId = 0;
}
DealLocationModeChangeEvent();
}
void WifiEventSubscriberManager::InitSubscribeListener()
@ -451,21 +411,6 @@ void WifiEventSubscriberManager::InitSubscribeListener()
SubscribeSystemAbility(MOUSE_CROSS_SERVICE_ID);
}
bool WifiEventSubscriberManager::IsDataMgrServiceActive()
{
sptr<ISystemAbilityManager> sa_mgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
if (sa_mgr == nullptr) {
WIFI_LOGE("Failed to get SystemAbilityManager!");
return false;
}
sptr<IRemoteObject> object = sa_mgr->CheckSystemAbility(DISTRIBUTED_KV_DATA_SERVICE_ABILITY_ID);
if (object == nullptr) {
WIFI_LOGE("Failed to get DataMgrService!");
return false;
}
return true;
}
int WifiEventSubscriberManager::GetLastStaStateByDatashare()
{
std::string lastStaState;
@ -510,31 +455,6 @@ void WifiEventSubscriberManager::UnRegisterLocationEvent()
islocationModeObservered = false;
}
void WifiEventSubscriberManager::RegisterCloneEvent()
{
std::unique_lock<std::mutex> lock(cloneEventMutex);
if (cloneModeObserver_) {
return;
}
cloneModeObserver_ = sptr<WifiCloneModeObserver>(new (std::nothrow)WifiCloneModeObserver());
Uri uri(SETTINGS_DATASHARE_URI_CLONE_DATA);
WifiDataShareHelperUtils::GetInstance().RegisterObserver(uri, cloneModeObserver_);
WIFI_LOGI("RegisterCloneEvent success");
}
void WifiEventSubscriberManager::UnRegisterCloneEvent()
{
std::unique_lock<std::mutex> lock(cloneEventMutex);
if (cloneModeObserver_ == nullptr) {
WIFI_LOGE("UnRegisterCloneEvent cloneModeObserver_ is nullptr");
return;
}
Uri uri(SETTINGS_DATASHARE_URI_CLONE_DATA);
WifiDataShareHelperUtils::GetInstance().UnRegisterObserver(uri, cloneModeObserver_);
cloneModeObserver_ = nullptr;
WIFI_LOGI("UnRegisterCloneEvent success");
}
void WifiEventSubscriberManager::GetMdmProp()
{
char preValue[PROP_FALSE_LEN + 1] = {0};
@ -814,6 +734,16 @@ void CesEventSubscriber::OnReceiveStandbyEvent(const OHOS::EventFwk::CommonEvent
}
}
void CesEventSubscriber::OnReceiveDataShareReadyEvent(const OHOS::EventFwk::CommonEventData &eventData)
{
const auto &action = eventData.GetWant().GetAction();
WIFI_LOGI("OnReceiveDataShareReadyEvent action[%{public}s]", action.c_str());
if (WifiManager::GetInstance().GetWifiEventSubscriberManager()) {
WifiManager::GetInstance().GetWifiEventSubscriberManager()->AccessDataShare();
WifiManager::GetInstance().GetWifiEventSubscriberManager()->RegisterLocationEvent();
}
}
void WifiEventSubscriberManager::RegisterNotificationEvent()
{
std::unique_lock<std::mutex> lock(notificationEventMutex);

View File

@ -50,6 +50,7 @@ public:
void OnReceiveThermalEvent(const OHOS::EventFwk::CommonEventData &eventData);
void OnReceiveNotificationEvent(const OHOS::EventFwk::CommonEventData &eventData);
void OnReceiveUserUnlockedEvent(const OHOS::EventFwk::CommonEventData &eventData);
void OnReceiveDataShareReadyEvent(const OHOS::EventFwk::CommonEventData &eventData);
private:
bool lastSleepState = false;
};
@ -103,14 +104,13 @@ public:
void GetWifiAllowSemiActiveByDatashare();
bool GetLocationModeByDatashare();
void DealLocationModeChangeEvent();
void DealCloneDataChangeEvent();
void CheckAndStartStaByDatashare();
bool IsMdmForbidden(void);
void AccessDataShare();
void RegisterLocationEvent();
private:
void DelayedAccessDataShare();
void InitSubscribeListener();
bool IsDataMgrServiceActive();
void HandleAppMgrServiceChange(bool add);
void HandleCommNetConnManagerSysChange(int systemAbilityId, bool add);
#ifdef HAS_MOVEMENT_PART
@ -121,10 +121,6 @@ private:
void HandleShareServiceChange(bool add);
void HandleMouseCrossServiceChange(bool add);
int GetLastStaStateByDatashare();
void GetCloneDataByDatashare(std::string &cloneData);
void SetCloneDataByDatashare(const std::string &cloneData);
void RegisterCloneEvent();
void UnRegisterCloneEvent();
void RegisterCesEvent();
#ifdef HAS_POWERMGR_PART
void RegisterPowermgrEvent();
@ -133,7 +129,6 @@ private:
std::mutex powermgrEventMutex;
#endif
void UnRegisterCesEvent();
void RegisterLocationEvent();
void UnRegisterLocationEvent();
void RegisterNotificationEvent();
void UnRegisterNotificationEvent();
@ -156,11 +151,10 @@ private:
void UnRegisterNetworkStateChangeEvent();
void RegisterWifiScanChangeEvent();
void UnRegisterWifiScanChangeEvent();
private:
std::mutex cloneEventMutex;
uint32_t cesTimerId{0};
uint32_t notificationTimerId{0};
uint32_t accessDatashareTimerId{0};
uint32_t networkStateChangeTimerId{0};
uint32_t wifiScanChangeTimerId{0};
std::mutex cesEventMutex;
@ -184,6 +178,9 @@ private:
std::mutex AssetEventMutex;
uint32_t assetMgrId{0};
#endif
bool accessDataShare_ = false;
std::mutex accessDataShareMutex_;
};
} // namespace Wifi

View File

@ -24,10 +24,5 @@ void WifiLocationModeObserver::OnChange()
{
WifiManager::GetInstance().GetWifiEventSubscriberManager()->DealLocationModeChangeEvent();
}
void WifiCloneModeObserver::OnChange()
{
WifiManager::GetInstance().GetWifiEventSubscriberManager()->DealCloneDataChangeEvent();
}
}
}

View File

@ -28,15 +28,6 @@ public:
void OnChange() override;
};
class WifiCloneModeObserver : public AAFwk::DataAbilityObserverStub {
public:
WifiCloneModeObserver() = default;
~WifiCloneModeObserver() = default;
void OnChange() override;
};
}
}
#endif

View File

@ -657,27 +657,6 @@ int WifiSettings::OnBackup(UniqueFd &fd, const std::string &backupInfo)
return 0;
}
void WifiSettings::MergeWifiCloneConfig(std::string &cloneData)
{
LOGI("MergeWifiCloneConfig enter");
std::unique_ptr<NetworkXmlParser> xmlParser = std::make_unique<NetworkXmlParser>();
bool ret = xmlParser->LoadConfigurationMemory(cloneData.c_str());
if (!ret) {
LOGE("MergeWifiCloneConfig load fail");
return;
}
ret = xmlParser->Parse();
if (!ret) {
LOGE("MergeWifiCloneConfig Parse fail");
return;
}
std::vector<WifiDeviceConfig> cloneConfigs = xmlParser->GetNetworks();
if (cloneConfigs.empty()) {
return;
}
ConfigsDeduplicateAndSave(cloneConfigs);
}
std::string WifiSettings::SetBackupReplyCode(int replyCode)
{
Json::Value root;

View File

@ -163,8 +163,6 @@ public:
int OnBackup(UniqueFd &fd, const std::string &backupInfo);
void MergeWifiCloneConfig(std::string &cloneData);
std::string SetBackupReplyCode(int replyCode);
void RemoveBackupFile();

View File

@ -273,7 +273,6 @@
"OHOS::Wifi::WifiSettings::AddWpsDeviceConfig(OHOS::Wifi::WifiDeviceConfig const&)";
"OHOS::Wifi::WifiSettings::OnRestore(OHOS::UniqueFdAddDeletor<OHOS::DefaultDeleter>&, std::__h::basic_string<char, std::__h::char_traits<char>, std::__h::allocator<char>> const&)";
"OHOS::Wifi::WifiSettings::OnBackup(OHOS::UniqueFdAddDeletor<OHOS::DefaultDeleter>&, std::__h::basic_string<char, std::__h::char_traits<char>, std::__h::allocator<char>> const&)";
"OHOS::Wifi::WifiSettings::MergeWifiCloneConfig(std::__h::basic_string<char, std::__h::char_traits<char>, std::__h::allocator<char>>&)";
"OHOS::Wifi::WifiSettings::SetBackupReplyCode(int)";
"OHOS::Wifi::WifiSettings::RemoveBackupFile()";
"OHOS::Wifi::WifiSettings::AddRandomMac(OHOS::Wifi::WifiStoreRandomMac&)";

View File

@ -202,7 +202,6 @@ public:
virtual int GetHotspotState(int id = 0) = 0;
virtual bool SetWifiStateOnAirplaneChanged(const int &state);
virtual int GetScanControlInfo(ScanControlInfo &info, int instId = 0) = 0;
virtual void MergeWifiCloneConfig(std::string &cloneData) = 0;
virtual bool GetScanAlwaysState(int instId) = 0;
virtual bool GetSupportHwPnoFlag(int instId = 0) = 0;
virtual int SetAcceptUnvalidated(int networkId, bool state) = 0;
@ -376,7 +375,6 @@ public:
MOCK_METHOD1(GetHotspotState, int(int id));
MOCK_METHOD1(SetWifiStateOnAirplaneChanged, bool(const int &state));
MOCK_METHOD2(GetScanControlInfo, int(ScanControlInfo &info, int));
MOCK_METHOD1(MergeWifiCloneConfig, void(std::string &cloneData));
MOCK_METHOD1(GetScanAlwaysState, bool(int instId));
MOCK_METHOD1(GetSupportHwPnoFlag, bool(int instId));
MOCK_METHOD2(SetAcceptUnvalidated, int(int networkId, bool state));

View File

@ -365,12 +365,6 @@ HWTEST_F(WifiManagerTest, GetLastStaStateByDatashareTest, TestSize.Level1)
wifiManager.wifiEventSubscriberManager->GetLastStaStateByDatashare();
}
HWTEST_F(WifiManagerTest, DealCloneDataChangeEventTest, TestSize.Level1)
{
WIFI_LOGI("DealCloneDataChangeEventTest enter!");
wifiManager.wifiEventSubscriberManager->DealCloneDataChangeEvent();
}
HWTEST_F(WifiManagerTest, RegisterCesEventTest, TestSize.Level1)
{
WIFI_LOGE("RegisterCesEventTest enter!");

View File

@ -45,6 +45,7 @@ public:
static void TearDownTestCase()
{
sleep(1);
WifiManager::GetInstance().Exit();
}

View File

@ -42,7 +42,6 @@ public:
virtual int GetAllCandidateConfig(const int uid, std::vector<WifiDeviceConfig> &configs) = 0;
virtual int SetAcceptUnvalidated(int networkId) = 0;
virtual int SetWifiFlagOnAirplaneMode(bool ifOpen, int instId = 0) = 0;
virtual void MergeWifiCloneConfig(std::string &cloneData) = 0;
virtual bool GetScanAlwaysState(int instId) = 0;
virtual int GetDeviceConfig(const int &networkId, WifiDeviceConfig &config, int instId = 0) = 0;
virtual bool GetWifiFlagOnAirplaneMode(int instId = 0) = 0;
@ -69,7 +68,6 @@ public:
MOCK_METHOD2(GetAllCandidateConfig, int(const int uid, std::vector<WifiDeviceConfig> &configs));
MOCK_METHOD1(SetAcceptUnvalidated, int(int networkId));
MOCK_METHOD2(SetWifiFlagOnAirplaneMode, int(bool ifOpen, int instId));
MOCK_METHOD1(MergeWifiCloneConfig, void(std::string &cloneData));
MOCK_METHOD1(GetScanAlwaysState, bool(int instId));
MOCK_METHOD3(GetDeviceConfig, int(const int &networkId, WifiDeviceConfig &config, int));
MOCK_METHOD1(GetWifiFlagOnAirplaneMode, bool(int instId));

View File

@ -335,13 +335,6 @@ HWTEST_F(WifiSettingsTest, MergeSoftapConfigTest, TestSize.Level1)
WifiSettings::GetInstance().MergeSoftapConfig();
}
HWTEST_F(WifiSettingsTest, MergeWifiCloneConfigTest, TestSize.Level1)
{
WIFI_LOGI("MergeWifiCloneConfigTest enter");
std::string cloneConfig = "wifitest";
WifiSettings::GetInstance().MergeWifiCloneConfig(cloneConfig);
}
HWTEST_F(WifiSettingsTest, ConfigsDeduplicateAndSaveTest, TestSize.Level1)
{
WIFI_LOGI("ConfigsDeduplicateAndSaveTest enter");