在 Juice 中,枚举DetailedState 添加了一个名为
/** Link has poor connectivity. */
VERIFYING_POOR_LINK
但是这个国家代表什么?
搜索了整个项目后,我发现了这个:
WifiStateMachine.java 中的 VerifyingLinkState 子类
class VerifyingLinkState extends State {
@Override
public void enter() {
if (DBG) log(getName() + "\n");
EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED, getName());
setNetworkDetailedState(DetailedState.VERIFYING_POOR_LINK);
mWifiConfigStore.updateStatus(mLastNetworkId, DetailedState.VERIFYING_POOR_LINK);
sendNetworkStateChangeBroadcast(mLastBssid);
}
@Override
public boolean processMessage(Message message) {
switch (message.what) {
case WifiWatchdogStateMachine.POOR_LINK_DETECTED:
//stay here
break;
case WifiWatchdogStateMachine.GOOD_LINK_DETECTED:
try {
mNwService.enableIpv6(mInterfaceName);
} catch (RemoteException re) {
loge("Failed to enable IPv6: " + re);
} catch (IllegalStateException e) {
loge("Failed to enable IPv6: " + e);
}
setNetworkDetailedState(DetailedState.CONNECTED);
mWifiConfigStore.updateStatus(mLastNetworkId, DetailedState.CONNECTED);
sendNetworkStateChangeBroadcast(mLastBssid);
transitionTo(mConnectedState);
break;
default:
return NOT_HANDLED;
}
return HANDLED;
}
}
当它在验证链接状态时,在enter()
函数中,它将DetailedState设置为
DetailedState.VERIFYING_POOR_LINK
这将导致用户在连接非常好的情况下获得如下图所示的状态消息而感到困惑。
虽然这条消息只停留了一会儿,然后很快就被“已连接”取代。但是这个国家的目标是什么?如果我没有在enter()
函数中将DetailedState 设置为VERIFYING_POOR_LINK,会有什么风险。