From e6611b384f35aafd787c471ae048cc2ce5ac4999 Mon Sep 17 00:00:00 2001 From: Stefan Assmann Date: Mon, 11 Mar 2019 17:09:49 +0100 Subject: resurrect mWifiLinkLayerStatsSupported counter On devices with broken/not implemented LinkLayerStats the counter mWifiLinkLayerStatsSupported prevents the following error messages from appearing every 3 seconds. 03-08 10:43:02.616 389 389 E WifiHAL : wifi_get_link_stats: requestResponse Error:-3 03-08 10:43:02.617 2030 2206 E WifiVendorHal: getWifiLinkLayerStats(l.937) failed {.code = ERROR_NOT_SUPPORTED, .description = } This partially reverts commit 1ba5b5858ffc04acbd317dc1f6789f1777d375e6. Change-Id: I840f9d1304bf0a31e7a6b65db00a37dc3651e4b8 --- .../com/android/server/wifi/ClientModeImpl.java | 23 ++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java index 3a24f3580..d6645dfd8 100644 --- a/service/java/com/android/server/wifi/ClientModeImpl.java +++ b/service/java/com/android/server/wifi/ClientModeImpl.java @@ -355,6 +355,8 @@ public class ClientModeImpl extends StateMachine { private DetailedState mNetworkAgentState; private SupplicantStateTracker mSupplicantStateTracker; + private int mWifiLinkLayerStatsSupported = 4; // Temporary disable + // Indicates that framework is attempting to roam, set true on CMD_START_ROAM, set false when // wifi connects or fails to connect private boolean mIsAutoRoaming = false; @@ -1304,15 +1306,20 @@ public class ClientModeImpl extends StateMachine { loge("getWifiLinkLayerStats called without an interface"); return null; } + WifiLinkLayerStats stats = null; mLastLinkLayerStatsUpdate = mClock.getWallClockMillis(); - WifiLinkLayerStats stats = mWifiNative.getWifiLinkLayerStats(mInterfaceName); - if (stats != null) { - mOnTime = stats.on_time; - mTxTime = stats.tx_time; - mRxTime = stats.rx_time; - mRunningBeaconCount = stats.beacon_rx; - mWifiInfo.updatePacketRates(stats, mLastLinkLayerStatsUpdate); - } else { + if (mWifiLinkLayerStatsSupported > 0) { + stats = mWifiNative.getWifiLinkLayerStats(mInterfaceName); + if (stats == null) { + mWifiLinkLayerStatsSupported -= 1; + } else { + mOnTime = stats.on_time; + mTxTime = stats.tx_time; + mRxTime = stats.rx_time; + mRunningBeaconCount = stats.beacon_rx; + mWifiInfo.updatePacketRates(stats, mLastLinkLayerStatsUpdate); + } + } else { // LinkLayerStats are broken or unsupported long mTxPkts = mFacade.getTxPackets(mInterfaceName); long mRxPkts = mFacade.getRxPackets(mInterfaceName); mWifiInfo.updatePacketRates(mTxPkts, mRxPkts, mLastLinkLayerStatsUpdate); -- cgit v1.2.3