java – DetailedState.VERIFYING_POOR_LINK代表什么

前端之家收集整理的这篇文章主要介绍了java – DetailedState.VERIFYING_POOR_LINK代表什么前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
在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,会有什么风险.

解决方法

验证某些三星设备的VERIFYING_POOR_LINK是Wi-Fi智能网络交换机的一部分,如果出现状况不佳,可以允许移动数据通过Wi-Fi保持连接.对于三星设备,当您看到详细状态时,请从CONNECTED转到VERIFYING_POOR_LINK.

大多数逻辑可以在:http://androidxref.com/4.3_r2.1/xref/frameworks/base/wifi/java/android/net/wifi/WifiWatchdogStateMachine.java中找到

WifiWatchdogStateMachine monitors the connection to a WiFi network. When WiFi
connects at L2 layer,the beacons from access point reach the device and it
can maintain a connection,but the application connectivity can be flaky (due
to bigger packet size exchange).

We now monitor the quality of the last hop on WiFi using packet loss ratio as
an indicator to decide if the link is good enough to switch to Wi-Fi as the uplink.

When WiFi is connected,the WiFi watchdog keeps sampling the RSSI and the
instant packet loss,and record it as per-AP loss-to-RSSi statistics. When
the instant packet loss is higher than a threshold,the WiFi watchdog sends a
poor link notification to avoid WiFi connection temporarily.

While WiFi is being avoided,the WiFi watchdog keep watching the RSSI to
bring the WiFi connection back. Once the RSSI is high enough to achieve a
lower packet loss,a good link detection is sent such that the WiFi
connection become available again.

BSSID roaming has been taken into account. When user is moving across
multiple APs,the WiFi watchdog will detect that and keep watching the
currently connected AP.

Power impact should be minimal since much of the measurement relies on passive statistics already being tracked at the driver and the polling is done when screen is turned on and the RSSI is in a certain range.

原文链接:https://www.f2er.com/java/129074.html

猜你在找的Java相关文章