diff options
author | Randy Pan <zpan@google.com> | 2016-05-16 11:29:03 -0700 |
---|---|---|
committer | Randy Pan <zpan@google.com> | 2016-05-17 10:44:56 -0700 |
commit | 46604d0d8d27c9dbdf986032de6e906e331f80ce (patch) | |
tree | 210e49fe6034efe73081f7076594ffa9e217c3d5 /service | |
parent | b32b649c815b0b50fd0127d9d4a4563c54a536fb (diff) |
WifiStateMachine: clean up dead code
Cleaned up the dead code from the original exponential back off
scan implementation.
Bug: 28750989
Bug: 28070598
Change-Id: I8abf82cdaa3530fb514794b4004c5d3f15950672
Tests: Wifi Unit Tests, manual test
Diffstat (limited to 'service')
3 files changed, 7 insertions, 211 deletions
diff --git a/service/java/com/android/server/wifi/WifiConfigManager.java b/service/java/com/android/server/wifi/WifiConfigManager.java index de4ec1f31..b736aa93c 100644 --- a/service/java/com/android/server/wifi/WifiConfigManager.java +++ b/service/java/com/android/server/wifi/WifiConfigManager.java @@ -218,22 +218,16 @@ public class WifiConfigManager { }; public final AtomicBoolean mEnableAutoJoinWhenAssociated = new AtomicBoolean(); - public final AtomicBoolean mEnableFullBandScanWhenAssociated = new AtomicBoolean(true); public final AtomicBoolean mEnableChipWakeUpWhenAssociated = new AtomicBoolean(true); public final AtomicBoolean mEnableRssiPollWhenAssociated = new AtomicBoolean(true); public final AtomicInteger mThresholdSaturatedRssi5 = new AtomicInteger(); public final AtomicInteger mThresholdQualifiedRssi24 = new AtomicInteger(); public final AtomicInteger mEnableVerboseLogging = new AtomicInteger(0); - public final AtomicInteger mAssociatedFullScanBackoff = - new AtomicInteger(); // Will be divided by 8 by WifiStateMachine public final AtomicInteger mAlwaysEnableScansWhileAssociated = new AtomicInteger(0); public final AtomicInteger mMaxNumActiveChannelsForPartialScans = new AtomicInteger(); - public final AtomicInteger mWifiDisconnectedShortScanIntervalMs = new AtomicInteger(); - public final AtomicInteger mWifiAssociatedShortScanIntervalMs = new AtomicInteger(); public boolean mEnableLinkDebouncing; public boolean mEnableWifiCellularHandoverUserTriggeredAdjustment; - public int mAssociatedFullScanMaxIntervalMs; public int mNetworkSwitchingBlackListPeriodMs; public int mBadLinkSpeed24; public int mBadLinkSpeed5; @@ -352,18 +346,10 @@ public class WifiConfigManager { mLocalLog = null; } - mWifiAssociatedShortScanIntervalMs.set(mContext.getResources().getInteger( - R.integer.config_wifi_associated_short_scan_interval)); - mWifiDisconnectedShortScanIntervalMs.set(mContext.getResources().getInteger( - R.integer.config_wifi_disconnected_short_scan_interval)); mOnlyLinkSameCredentialConfigurations = mContext.getResources().getBoolean( R.bool.config_wifi_only_link_same_credential_configurations); mMaxNumActiveChannelsForPartialScans.set(mContext.getResources().getInteger( R.integer.config_wifi_framework_associated_partial_scan_max_num_active_channels)); - mAssociatedFullScanMaxIntervalMs = mContext.getResources().getInteger( - R.integer.config_wifi_framework_associated_full_scan_max_interval); - mAssociatedFullScanBackoff.set(mContext.getResources().getInteger( - R.integer.config_wifi_framework_associated_full_scan_backoff)); mEnableLinkDebouncing = mContext.getResources().getBoolean( R.bool.config_wifi_enable_disconnection_debounce); mBandAward5Ghz.set(mContext.getResources().getInteger( diff --git a/service/java/com/android/server/wifi/WifiConnectivityManager.java b/service/java/com/android/server/wifi/WifiConnectivityManager.java index f2ea62d1a..f38e36768 100644 --- a/service/java/com/android/server/wifi/WifiConnectivityManager.java +++ b/service/java/com/android/server/wifi/WifiConnectivityManager.java @@ -676,7 +676,9 @@ public class WifiConnectivityManager { > mConfigManager.MAX_TX_PACKET_FOR_FULL_SCANS || mWifiInfo.rxSuccessRate > mConfigManager.MAX_RX_PACKET_FOR_FULL_SCANS) { - localLog("No full band scan due to heavy traffic"); + localLog("No full band scan due to heavy traffic, txSuccessRate=" + + mWifiInfo.txSuccessRate + " rxSuccessRate=" + + mWifiInfo.rxSuccessRate); isFullBandScan = false; if (mWifiInfo.txSuccessRate diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java index 1079ae112..82ede5694 100644 --- a/service/java/com/android/server/wifi/WifiStateMachine.java +++ b/service/java/com/android/server/wifi/WifiStateMachine.java @@ -276,7 +276,6 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss private final Queue<Message> mBufferedScanMsg = new LinkedList<Message>(); private WorkSource mScanWorkSource = null; private static final int UNKNOWN_SCAN_SOURCE = -1; - private static final int SCAN_ALARM_SOURCE = -2; private static final int ADD_OR_UPDATE_SOURCE = -3; private static final int SET_ALLOW_UNTRUSTED_SOURCE = -4; private static final int ENABLE_WIFI = -5; @@ -869,24 +868,6 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss private long mSupplicantScanIntervalMs; /** - * timeStamp of last full band scan we perfoemed for autojoin while connected with screen lit - */ - private long lastFullBandConnectedTimeMilli; - - /** - * time interval to the next full band scan we will perform for - * autojoin while connected with screen lit - */ - private long fullBandConnectedTimeIntervalMilli; - - /** - * max time interval to the next full band scan we will perform for - * autojoin while connected with screen lit - * Max time is 5 minutes - */ - private static final long maxFullBandConnectedTimeIntervalMilli = 1000 * 60 * 5; - - /** * Minimum time interval between enabling all networks. * A device can end up repeatedly connecting to a bad network on screen on/off toggle * due to enabling every time. We add a threshold to avoid this. @@ -2438,8 +2419,6 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss for(int freq : lastScanFreqs) { sb.append(freq).append(","); } - } else { - sb.append(" fiv=").append(fullBandConnectedTimeIntervalMilli); } report = reportOnTime(); if (report != null) { @@ -3539,15 +3518,6 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss /* Reset roaming parameters */ mAutoRoaming = false; - /** - * fullBandConnectedTimeIntervalMilli: - * - start scans at mWifiConfigManager.mWifiAssociatedShortScanIntervalMs seconds - * interval - * - exponentially increase to mWifiConfigManager.mAssociatedFullScanMaxIntervalMs - * Initialize to sane value = 20 seconds - */ - fullBandConnectedTimeIntervalMilli = 20 * 1000; - setNetworkDetailedState(DetailedState.DISCONNECTED); if (mNetworkAgent != null) { mNetworkAgent.sendNetworkInfo(mNetworkInfo); @@ -6583,147 +6553,6 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss setAndEnableLastSelectedConfiguration( WifiConfiguration.INVALID_NETWORK_ID); break; - case CMD_START_SCAN: - if (DBG) { - logd("CMD_START_SCAN source " + message.arg1 - + " txSuccessRate="+String.format( "%.2f", mWifiInfo.txSuccessRate) - + " rxSuccessRate="+String.format( "%.2f", mWifiInfo.rxSuccessRate) - + " targetRoamBSSID=" + mTargetRoamBSSID - + " RSSI=" + mWifiInfo.getRssi()); - } - if (message.arg1 == SCAN_ALARM_SOURCE) { - // Check if the CMD_START_SCAN message is obsolete (and thus if it should - // not be processed) and restart the scan if neede - if (!mWifiConfigManager.getEnableAutoJoinWhenAssociated()) { - return HANDLED; - } - - if (mP2pConnected.get()) { - logd("L2Connected CMD_START_SCAN source " - + message.arg1 - + " " + message.arg2 + ", " - + " ignore because P2P is connected"); - messageHandlingStatus = MESSAGE_HANDLING_STATUS_DISCARD; - return HANDLED; - } - boolean tryFullBandScan = false; - boolean restrictChannelList = false; - long now_ms = System.currentTimeMillis(); - if (DBG) { - logd("CMD_START_SCAN with age=" - + Long.toString(now_ms - lastFullBandConnectedTimeMilli) - + " interval=" + fullBandConnectedTimeIntervalMilli - + " maxinterval=" + maxFullBandConnectedTimeIntervalMilli); - } - - if (mWifiConfigManager.mEnableFullBandScanWhenAssociated.get() - && (now_ms - lastFullBandConnectedTimeMilli) - > fullBandConnectedTimeIntervalMilli) { - if (DBG) { - logd("CMD_START_SCAN try full band scan age=" - + Long.toString(now_ms - lastFullBandConnectedTimeMilli) - + " interval=" + fullBandConnectedTimeIntervalMilli - + " maxinterval=" + maxFullBandConnectedTimeIntervalMilli); - } - tryFullBandScan = true; - } - - if (mWifiInfo.txSuccessRate - > mWifiConfigManager.MAX_TX_PACKET_FOR_FULL_SCANS - || mWifiInfo.rxSuccessRate - > mWifiConfigManager.MAX_RX_PACKET_FOR_FULL_SCANS) { - // Too much traffic at the interface, hence no full band scan - if (DBG) { - logd("CMD_START_SCAN prevent full band scan due to pkt rate"); - } - tryFullBandScan = false; - } - - if (mWifiInfo.txSuccessRate - > mWifiConfigManager.MAX_TX_PACKET_FOR_PARTIAL_SCANS - || mWifiInfo.rxSuccessRate - > mWifiConfigManager.MAX_RX_PACKET_FOR_PARTIAL_SCANS) { - // Don't scan if lots of packets are being sent - restrictChannelList = true; - if (mWifiConfigManager.mAlwaysEnableScansWhileAssociated.get() == 0) { - if (DBG) { - logd("CMD_START_SCAN source " + message.arg1 - + " ...and ignore scans" - + " tx=" - + String.format("%.2f", mWifiInfo.txSuccessRate) - + " rx=" - + String.format("%.2f", mWifiInfo.rxSuccessRate)); - } - messageHandlingStatus = MESSAGE_HANDLING_STATUS_REFUSED; - return HANDLED; - } - } - - WifiConfiguration currentConfiguration = getCurrentWifiConfiguration(); - if (DBG) { - logd("CMD_START_SCAN full=" + - tryFullBandScan); - } - if (currentConfiguration != null) { - if (fullBandConnectedTimeIntervalMilli < - mWifiConfigManager.mWifiAssociatedShortScanIntervalMs.get()) { - // Sanity - fullBandConnectedTimeIntervalMilli = - mWifiConfigManager - .mWifiAssociatedShortScanIntervalMs.get(); - } - if (tryFullBandScan) { - lastFullBandConnectedTimeMilli = now_ms; - if (fullBandConnectedTimeIntervalMilli - < mWifiConfigManager.mAssociatedFullScanMaxIntervalMs) { - // Increase the interval - fullBandConnectedTimeIntervalMilli = - fullBandConnectedTimeIntervalMilli * - mWifiConfigManager - .mAssociatedFullScanBackoff.get() / 8; - - if (DBG) { - logd("CMD_START_SCAN bump interval =" - + fullBandConnectedTimeIntervalMilli); - } - } - handleScanRequest(message); - } else { - if (!startScanForConfiguration( - currentConfiguration, restrictChannelList)) { - if (DBG) { - logd("starting scan, " + - " did not find channels -> full"); - } - lastFullBandConnectedTimeMilli = now_ms; - if (fullBandConnectedTimeIntervalMilli - < mWifiConfigManager - .mAssociatedFullScanMaxIntervalMs) { - // Increase the interval - fullBandConnectedTimeIntervalMilli = - fullBandConnectedTimeIntervalMilli - * mWifiConfigManager - .mAssociatedFullScanBackoff.get() - / 8; - - if (DBG) { - logd("CMD_START_SCAN bump interval =" - + fullBandConnectedTimeIntervalMilli); - } - } - handleScanRequest(message); - } - } - - } else { - logd("CMD_START_SCAN : connected mode and no configuration"); - messageHandlingStatus = MESSAGE_HANDLING_STATUS_HANDLING_ERROR; - } - } else { - // Not scan alarm source - return NOT_HANDLED; - } - break; /* Ignore connection to same network */ case WifiManager.CONNECT_NETWORK: int netId = message.arg1; @@ -7170,10 +6999,7 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss updateDefaultRouteMacAddress(1000); if (DBG) { log("Enter ConnectedState " - + " mScreenOn=" + mScreenOn - + " scanperiod=" - + Integer.toString( - mWifiConfigManager.mWifiAssociatedShortScanIntervalMs.get())); + + " mScreenOn=" + mScreenOn); } if (mWifiConnectivityManager != null) { @@ -7477,9 +7303,7 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss public void enter() { if (DBG) { - logd(" Enter DisconnectingState State scan interval " - + mWifiConfigManager.mWifiDisconnectedShortScanIntervalMs.get() - + " screenOn=" + mScreenOn); + logd(" Enter DisconnectingState State screenOn=" + mScreenOn); } // Make sure we disconnect: we enter this state prior to connecting to a new @@ -7541,9 +7365,7 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss } if (DBG) { - logd(" Enter DisconnectedState scan interval " - + mWifiConfigManager.mWifiDisconnectedShortScanIntervalMs.get() - + " screenOn=" + mScreenOn); + logd(" Enter DisconnectedState screenOn=" + mScreenOn); } /** clear the roaming state, if we were roaming, we failed */ @@ -7629,22 +7451,8 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss messageHandlingStatus = MESSAGE_HANDLING_STATUS_REFUSED; return HANDLED; } - if (message.arg1 == SCAN_ALARM_SOURCE) { - // Check if the CMD_START_SCAN message is obsolete (and thus if it should - // not be processed) and restart the scan - int period = - mWifiConfigManager.mWifiDisconnectedShortScanIntervalMs.get(); - if (mP2pConnected.get()) { - period = (int) mFacade.getLongSetting(mContext, - Settings.Global.WIFI_SCAN_INTERVAL_WHEN_P2P_CONNECTED_MS, - period); - } - handleScanRequest(message); - ret = HANDLED; - } else { - ret = NOT_HANDLED; - } + ret = NOT_HANDLED; break; case WifiP2pServiceImpl.P2P_CONNECTION_CHANGED: NetworkInfo info = (NetworkInfo) message.obj; |