mirror of
https://gitee.com/openharmony/communication_wifi.git
synced 2024-11-23 07:00:07 +00:00
!3254 when network recover, update Accept Unvalidated state
Merge pull request !3254 from yinyongbin/master
This commit is contained in:
commit
41ce37dd70
@ -3530,6 +3530,7 @@ void StaStateMachine::HandleNetCheckResult(SystemNetWorkState netState, const st
|
|||||||
StartDetectTimer(DETECT_TYPE_PERIODIC);
|
StartDetectTimer(DETECT_TYPE_PERIODIC);
|
||||||
}
|
}
|
||||||
#ifndef OHOS_ARCH_LITE
|
#ifndef OHOS_ARCH_LITE
|
||||||
|
UpdateAcceptUnvalidatedState();
|
||||||
WifiNotificationUtil::GetInstance().CancelWifiNotification(
|
WifiNotificationUtil::GetInstance().CancelWifiNotification(
|
||||||
WifiNotificationId::WIFI_PORTAL_NOTIFICATION_ID);
|
WifiNotificationId::WIFI_PORTAL_NOTIFICATION_ID);
|
||||||
#endif
|
#endif
|
||||||
@ -3575,6 +3576,10 @@ void StaStateMachine::HandleNetCheckResult(SystemNetWorkState netState, const st
|
|||||||
#ifndef OHOS_ARCH_LITE
|
#ifndef OHOS_ARCH_LITE
|
||||||
void StaStateMachine::SyncDeviceEverConnectedState(bool hasNet)
|
void StaStateMachine::SyncDeviceEverConnectedState(bool hasNet)
|
||||||
{
|
{
|
||||||
|
if (IsFactoryMode()) {
|
||||||
|
WIFI_LOGI("factory version, no need to pop up diag");
|
||||||
|
return;
|
||||||
|
}
|
||||||
WifiLinkedInfo linkedInfo;
|
WifiLinkedInfo linkedInfo;
|
||||||
WifiConfigCenter::GetInstance().GetLinkedInfo(linkedInfo);
|
WifiConfigCenter::GetInstance().GetLinkedInfo(linkedInfo);
|
||||||
int networkId = linkedInfo.networkId;
|
int networkId = linkedInfo.networkId;
|
||||||
@ -3591,6 +3596,20 @@ void StaStateMachine::SyncDeviceEverConnectedState(bool hasNet)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef OHOS_ARCH_LITE
|
||||||
|
void StaStateMachine::UpdateAcceptUnvalidatedState()
|
||||||
|
{
|
||||||
|
WifiLinkedInfo linkedInfo;
|
||||||
|
WifiConfigCenter::GetInstance().GetLinkedInfo(linkedInfo);
|
||||||
|
int networkId = linkedInfo.networkId;
|
||||||
|
if (WifiSettings::GetInstance().GetAcceptUnvalidated(networkId)) {
|
||||||
|
WIFI_LOGI("network is recover, change the value of AcceptUnvalidated to false");
|
||||||
|
WifiSettings::GetInstance().SetAcceptUnvalidated(networkId, false);
|
||||||
|
WifiSettings::GetInstance().SyncDeviceConfig();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void StaStateMachine::HandleArpCheckResult(StaArpState arpState)
|
void StaStateMachine::HandleArpCheckResult(StaArpState arpState)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -141,8 +141,6 @@ enum PortalState {
|
|||||||
EXPERIED
|
EXPERIED
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Signal levels are classified into: 0 1 2 3 4 ,the max is 4. */
|
|
||||||
constexpr int MAX_LEVEL = 4;
|
|
||||||
const std::string WPA_BSSID_ANY = "any";
|
const std::string WPA_BSSID_ANY = "any";
|
||||||
|
|
||||||
class StaStateMachine : public StateMachine {
|
class StaStateMachine : public StateMachine {
|
||||||
@ -555,6 +553,7 @@ public:
|
|||||||
void SetEnhanceService(IEnhanceService* enhanceService);
|
void SetEnhanceService(IEnhanceService* enhanceService);
|
||||||
void SetSelfCureService(ISelfCureService *selfCureService);
|
void SetSelfCureService(ISelfCureService *selfCureService);
|
||||||
void SyncDeviceEverConnectedState(bool hasNet);
|
void SyncDeviceEverConnectedState(bool hasNet);
|
||||||
|
void UpdateAcceptUnvalidatedState();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool SetMacToHal(const std::string ¤tMac, const std::string &realMac, int instId);
|
bool SetMacToHal(const std::string ¤tMac, const std::string &realMac, int instId);
|
||||||
|
@ -881,7 +881,7 @@ void NotificationEventSubscriber::OnReceiveWlanKeepConnected(const OHOS::EventFw
|
|||||||
if (code == 1) { // The user clicks the use button.
|
if (code == 1) { // The user clicks the use button.
|
||||||
WifiNetAgent::GetInstance().RestoreWifiConnection();
|
WifiNetAgent::GetInstance().RestoreWifiConnection();
|
||||||
WIFI_LOGI("change the value of AcceptUnvalidated to true");
|
WIFI_LOGI("change the value of AcceptUnvalidated to true");
|
||||||
WifiSettings::GetInstance().SetAcceptUnvalidated(networkId);
|
WifiSettings::GetInstance().SetAcceptUnvalidated(networkId, true);
|
||||||
WifiSettings::GetInstance().SyncDeviceConfig();
|
WifiSettings::GetInstance().SyncDeviceConfig();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -348,14 +348,14 @@ int WifiSettings::SetDeviceEverConnected(int networkId)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int WifiSettings::SetAcceptUnvalidated(int networkId)
|
int WifiSettings::SetAcceptUnvalidated(int networkId, bool state)
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> lock(mStaMutex);
|
std::unique_lock<std::mutex> lock(mStaMutex);
|
||||||
auto iter = mWifiDeviceConfig.find(networkId);
|
auto iter = mWifiDeviceConfig.find(networkId);
|
||||||
if (iter == mWifiDeviceConfig.end()) {
|
if (iter == mWifiDeviceConfig.end()) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
iter->second.acceptUnvalidated = true;
|
iter->second.acceptUnvalidated = state;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ public:
|
|||||||
|
|
||||||
int SetDeviceEverConnected(int networkId);
|
int SetDeviceEverConnected(int networkId);
|
||||||
|
|
||||||
int SetAcceptUnvalidated(int networkId);
|
int SetAcceptUnvalidated(int networkId, bool state);
|
||||||
|
|
||||||
bool GetDeviceEverConnected(int networkId);
|
bool GetDeviceEverConnected(int networkId);
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@
|
|||||||
"OHOS::Wifi::WifiSettings::SetDeviceRandomizedMacSuccessEver(int)";
|
"OHOS::Wifi::WifiSettings::SetDeviceRandomizedMacSuccessEver(int)";
|
||||||
"OHOS::Wifi::WifiSettings::SetDeviceEverConnected(int)";
|
"OHOS::Wifi::WifiSettings::SetDeviceEverConnected(int)";
|
||||||
"OHOS::Wifi::WifiSettings::GetPackageName(std::__h::basic_string<char, std::__h::char_traits<char>, std::__h::allocator<char>>)";
|
"OHOS::Wifi::WifiSettings::GetPackageName(std::__h::basic_string<char, std::__h::char_traits<char>, std::__h::allocator<char>>)";
|
||||||
"OHOS::Wifi::WifiSettings::SetAcceptUnvalidated(int)";
|
"OHOS::Wifi::WifiSettings::SetAcceptUnvalidated(int, bool)";
|
||||||
"OHOS::Wifi::WifiSettings::GetDeviceEverConnected(int)";
|
"OHOS::Wifi::WifiSettings::GetDeviceEverConnected(int)";
|
||||||
"OHOS::Wifi::WifiSettings::GetAcceptUnvalidated(int)";
|
"OHOS::Wifi::WifiSettings::GetAcceptUnvalidated(int)";
|
||||||
"OHOS::Wifi::WifiSettings::GetCandidateConfig(int, 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>> const&, OHOS::Wifi::WifiDeviceConfig&)";
|
"OHOS::Wifi::WifiSettings::GetCandidateConfig(int, 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>> const&, OHOS::Wifi::WifiDeviceConfig&)";
|
||||||
|
@ -93,6 +93,7 @@ public:
|
|||||||
virtual int GetHotspotConfig(HotspotConfig &config, int id) = 0;
|
virtual int GetHotspotConfig(HotspotConfig &config, int id) = 0;
|
||||||
virtual bool GetDeviceEverConnected(int networkId) = 0;
|
virtual bool GetDeviceEverConnected(int networkId) = 0;
|
||||||
virtual int SetDeviceEverConnected(int networkId) = 0;
|
virtual int SetDeviceEverConnected(int networkId) = 0;
|
||||||
|
virtual int SetAcceptUnvalidated(int networkId, bool state) = 0;
|
||||||
virtual bool GetAcceptUnvalidated(int networkId) = 0;
|
virtual bool GetAcceptUnvalidated(int networkId) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -168,6 +169,7 @@ public:
|
|||||||
MOCK_METHOD2(GetHotspotConfig, int(HotspotConfig &config, int id));
|
MOCK_METHOD2(GetHotspotConfig, int(HotspotConfig &config, int id));
|
||||||
MOCK_METHOD1(GetDeviceEverConnected, bool(int networkId));
|
MOCK_METHOD1(GetDeviceEverConnected, bool(int networkId));
|
||||||
MOCK_METHOD1(SetDeviceEverConnected, int(int networkId));
|
MOCK_METHOD1(SetDeviceEverConnected, int(int networkId));
|
||||||
|
MOCK_METHOD2(SetAcceptUnvalidated, int(int networkId, bool state));
|
||||||
MOCK_METHOD1(GetAcceptUnvalidated, bool(int networkId));
|
MOCK_METHOD1(GetAcceptUnvalidated, bool(int networkId));
|
||||||
};
|
};
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
|
Loading…
Reference in New Issue
Block a user