diff options
author | Randy Pan <zpan@google.com> | 2016-05-17 23:17:47 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2016-05-17 23:17:47 +0000 |
commit | ac90f832cc7efcbe0a7a2ec24d8d45192e3ecc66 (patch) | |
tree | c407815478e205d0ae33f6da14b308b49134d808 /service | |
parent | c03758554f64e6afeaaf5068df0e691d0aa006a3 (diff) | |
parent | 304d3451b9245f7c7bb5e81465561f0eb63b2473 (diff) |
Merge changes from topic 'exponential backoff periodic scan' into nyc-dev
* changes:
WifiConfigManager: clean up makeChannelList()
WifiStateMachine: clean up dead code
WifiConnectivityManagerTest: exponential backoff periodic scan
Restrict connectivty periodic scan
Diffstat (limited to 'service')
3 files changed, 114 insertions, 248 deletions
diff --git a/service/java/com/android/server/wifi/WifiConfigManager.java b/service/java/com/android/server/wifi/WifiConfigManager.java index de4ec1f31..76a95ccce 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( @@ -2401,7 +2387,7 @@ public class WifiConfigManager { } } - public HashSet<Integer> makeChannelList(WifiConfiguration config, int age, boolean restrict) { + public HashSet<Integer> makeChannelList(WifiConfiguration config, int age) { if (config == null) { return null; } @@ -2441,7 +2427,7 @@ public class WifiConfigManager { logd("has " + result.BSSID + " freq=" + Integer.toString(result.frequency) + " age=" + Long.toString(now_ms - result.seen) + " ?=" + test); } - if (((now_ms - result.seen) < age)/*||(!restrict || result.is24GHz())*/) { + if (((now_ms - result.seen) < age)) { channels.add(result.frequency); numChannels++; } @@ -2468,7 +2454,7 @@ public class WifiConfigManager { if (numChannels > mMaxNumActiveChannelsForPartialScans.get()) { break; } - if (((now_ms - result.seen) < age)/*||(!restrict || result.is24GHz())*/) { + if (((now_ms - result.seen) < age)) { channels.add(result.frequency); numChannels++; } diff --git a/service/java/com/android/server/wifi/WifiConnectivityManager.java b/service/java/com/android/server/wifi/WifiConnectivityManager.java index 0c992a429..8200ef633 100644 --- a/service/java/com/android/server/wifi/WifiConnectivityManager.java +++ b/service/java/com/android/server/wifi/WifiConnectivityManager.java @@ -41,6 +41,7 @@ import com.android.server.wifi.util.ScanDetailUtil; import java.io.FileDescriptor; import java.io.PrintWriter; import java.util.ArrayList; +import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.List; @@ -66,7 +67,13 @@ public class WifiConnectivityManager { private static final String TAG = "WifiConnectivityManager"; // Periodic scan interval in milli-seconds. This is the scan // performed when screen is on. - private static final int PERIODIC_SCAN_INTERVAL_MS = 20 * 1000; // 20 seconds + @VisibleForTesting + public static final int PERIODIC_SCAN_INTERVAL_MS = 20 * 1000; // 20 seconds + // When screen is on and WiFi traffic is heavy, exponential backoff + // connectivity scans are scheduled. This constant defines the maximum + // scan interval in this scenario. + @VisibleForTesting + public static final int MAX_PERIODIC_SCAN_INTERVAL_MS = 160 * 1000; // 160 seconds // PNO scan interval in milli-seconds. This is the scan // performed when screen is off and disconnected. private static final int DISCONNECTED_PNO_SCAN_INTERVAL_MS = 20 * 1000; // 20 seconds @@ -86,6 +93,8 @@ public class WifiConnectivityManager { // every WATCHDOG_INTERVAL_MS to start a single scan. This is // to prevent caveat from things like PNO scan. private static final int WATCHDOG_INTERVAL_MS = 20 * 60 * 1000; // 20 minutes + // Restricted channel list age out value. + private static final int CHANNEL_LIST_AGE_MS = 60 * 60 * 1000; // 1 hour // This is the time interval for the connection attempt rate calculation. Connection attempt // timestamps beyond this interval is evicted from the list. public static final int MAX_CONNECTION_ATTEMPTS_TIME_INTERVAL_MS = 4 * 60 * 1000; // 4 mins @@ -101,8 +110,8 @@ public class WifiConnectivityManager { public static final int WIFI_STATE_DISCONNECTED = 2; public static final int WIFI_STATE_TRANSITIONING = 3; - // Due to b/28020168, timer based single scan will be scheduled every - // PERIODIC_SCAN_INTERVAL_MS to provide periodic scan. + // Due to b/28020168, timer based single scan will be scheduled + // to provide periodic scan in an exponential backoff fashion. private static final boolean ENABLE_BACKGROUND_SCAN = false; // Flag to turn on connected PNO, when needed private static final boolean ENABLE_CONNECTED_PNO_SCAN = false; @@ -132,6 +141,7 @@ public class WifiConnectivityManager { private int mSingleScanRestartCount = 0; private int mTotalConnectivityAttemptsRateLimited = 0; private String mLastConnectionAttemptBssid = null; + private int mPeriodicSingleScanInterval = PERIODIC_SCAN_INTERVAL_MS; // PNO settings private int mMin5GHzRssi; @@ -161,14 +171,16 @@ public class WifiConnectivityManager { // if the start scan command failed. An timer is used here to make it a deferred retry. private class RestartSingleScanListener implements AlarmManager.OnAlarmListener { private final boolean mIsWatchdogTriggered; + private final boolean mIsFullBandScan; - RestartSingleScanListener(boolean isWatchdogTriggered) { + RestartSingleScanListener(boolean isWatchdogTriggered, boolean isFullBandScan) { mIsWatchdogTriggered = isWatchdogTriggered; + mIsFullBandScan = isFullBandScan; } @Override public void onAlarm() { - startSingleScan(mIsWatchdogTriggered); + startSingleScan(mIsWatchdogTriggered, mIsFullBandScan); } } @@ -181,8 +193,8 @@ public class WifiConnectivityManager { } }; - // Due to b/28020168, timer based single scan will be scheduled every - // PERIODIC_SCAN_INTERVAL_MS to provide periodic scan. + // Due to b/28020168, timer based single scan will be scheduled + // to provide periodic scan in an exponential backoff fashion. private final AlarmManager.OnAlarmListener mPeriodicScanTimerListener = new AlarmManager.OnAlarmListener() { public void onAlarm() { @@ -282,9 +294,11 @@ public class WifiConnectivityManager { private class SingleScanListener implements WifiScanner.ScanListener { private List<ScanDetail> mScanDetails = new ArrayList<ScanDetail>(); private final boolean mIsWatchdogTriggered; + private final boolean mIsFullBandScan; - SingleScanListener(boolean isWatchdogTriggered) { + SingleScanListener(boolean isWatchdogTriggered, boolean isFullBandScan) { mIsWatchdogTriggered = isWatchdogTriggered; + mIsFullBandScan = isFullBandScan; } public void clearScanDetails() { @@ -307,7 +321,7 @@ public class WifiConnectivityManager { // reschedule the scan if (mSingleScanRestartCount++ < MAX_SCAN_RESTART_ALLOWED) { - scheduleDelayedSingleScan(mIsWatchdogTriggered); + scheduleDelayedSingleScan(mIsWatchdogTriggered, mIsFullBandScan); } else { mSingleScanRestartCount = 0; Log.e(TAG, "Failed to successfully start single scan for " @@ -588,13 +602,44 @@ public class WifiConnectivityManager { // Helper for selecting the band for connectivity scan private int getScanBand() { - int freqBand = mStateMachine.getFrequencyBand(); - if (freqBand == WifiManager.WIFI_FREQUENCY_BAND_5GHZ) { - return WifiScanner.WIFI_BAND_5_GHZ_WITH_DFS; - } else if (freqBand == WifiManager.WIFI_FREQUENCY_BAND_2GHZ) { - return WifiScanner.WIFI_BAND_24_GHZ; + return getScanBand(true); + } + + private int getScanBand(boolean isFullBandScan) { + if (isFullBandScan) { + int freqBand = mStateMachine.getFrequencyBand(); + if (freqBand == WifiManager.WIFI_FREQUENCY_BAND_5GHZ) { + return WifiScanner.WIFI_BAND_5_GHZ_WITH_DFS; + } else if (freqBand == WifiManager.WIFI_FREQUENCY_BAND_2GHZ) { + return WifiScanner.WIFI_BAND_24_GHZ; + } else { + return WifiScanner.WIFI_BAND_BOTH_WITH_DFS; + } } else { - return WifiScanner.WIFI_BAND_BOTH_WITH_DFS; + // Use channel list instead. + return WifiScanner.WIFI_BAND_UNSPECIFIED; + } + } + + // Helper for setting the channels for connectivity scan when + // band is unspecified + private void setScanChannels(ScanSettings settings) { + WifiConfiguration config = mStateMachine.getCurrentWifiConfiguration(); + + if (config == null) { + return; + } + + HashSet<Integer> freqs = mConfigManager.makeChannelList(config, CHANNEL_LIST_AGE_MS); + + if (freqs != null && freqs.size() != 0) { + int index = 0; + settings.channels = new WifiScanner.ChannelSpec[freqs.size()]; + for (Integer freq : freqs) { + settings.channels[index++] = new WifiScanner.ChannelSpec(freq); + } + } else { + localLog("no scan channels for " + config.configKey()); } } @@ -609,7 +654,32 @@ public class WifiConnectivityManager { Log.i(TAG, "start a single scan from watchdogHandler"); scheduleWatchdogTimer(); - startSingleScan(true); + startSingleScan(true, true); + } + } + + // Start a single scan and set up the interval for next single scan. + private void startPeriodicSingleScan() { + boolean isFullBandScan = true; + + // If the WiFi traffic is heavy, only partial scan is initiated. + if (mWifiInfo.txSuccessRate + > 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, txSuccessRate=" + + mWifiInfo.txSuccessRate + " rxSuccessRate=" + + mWifiInfo.rxSuccessRate); + isFullBandScan = false; + } + + startSingleScan(false, isFullBandScan); + schedulePeriodicScanTimer(mPeriodicSingleScanInterval); + + // Set up the next scan interval in an exponential backoff fashion. + mPeriodicSingleScanInterval *= 2; + if (mPeriodicSingleScanInterval > MAX_PERIODIC_SCAN_INTERVAL_MS) { + mPeriodicSingleScanInterval = MAX_PERIODIC_SCAN_INTERVAL_MS; } } @@ -619,13 +689,12 @@ public class WifiConnectivityManager { // Schedule the next timer and start a single scan if screen is on. if (mScreenOn) { - schedulePeriodicScanTimer(); - startSingleScan(false); + startPeriodicSingleScan(); } } // Start a single scan - private void startSingleScan(boolean isWatchdogTriggered) { + private void startSingleScan(boolean isWatchdogTriggered, boolean isFullBandScan) { if (!mWifiEnabled || !mWifiConnectivityManagerEnabled) { return; } @@ -633,7 +702,10 @@ public class WifiConnectivityManager { mPnoScanListener.resetLowRssiNetworkRetryDelay(); ScanSettings settings = new ScanSettings(); - settings.band = getScanBand(); + settings.band = getScanBand(isFullBandScan); + if (!isFullBandScan) { + setScanChannels(settings); + } settings.reportEvents = WifiScanner.REPORT_EVENT_FULL_SCAN_RESULT | WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN; settings.numBssidsPerScan = 0; @@ -651,7 +723,8 @@ public class WifiConnectivityManager { // re-enable this when b/27695292 is fixed // mSingleScanListener.clearScanDetails(); // mScanner.startScan(settings, mSingleScanListener, WIFI_WORK_SOURCE); - SingleScanListener singleScanListener = new SingleScanListener(isWatchdogTriggered); + SingleScanListener singleScanListener = + new SingleScanListener(isWatchdogTriggered, isFullBandScan); mScanner.startScan(settings, singleScanListener, WIFI_WORK_SOURCE); } @@ -659,11 +732,11 @@ public class WifiConnectivityManager { private void startPeriodicScan() { mPnoScanListener.resetLowRssiNetworkRetryDelay(); - // Due to b/28020168, timer based single scan will be scheduled every - // PERIODIC_SCAN_INTERVAL_MS to provide periodic scan. + // Due to b/28020168, timer based single scan will be scheduled + // to provide periodic scan in an exponential backoff fashion. if (!ENABLE_BACKGROUND_SCAN) { - startSingleScan(false); - schedulePeriodicScanTimer(); + mPeriodicSingleScanInterval = PERIODIC_SCAN_INTERVAL_MS; + startPeriodicSingleScan(); } else { ScanSettings settings = new ScanSettings(); settings.band = getScanBand(); @@ -769,19 +842,19 @@ public class WifiConnectivityManager { } // Set up periodic scan timer - private void schedulePeriodicScanTimer() { + private void schedulePeriodicScanTimer(int intervalMs) { mAlarmManager.set(AlarmManager.RTC_WAKEUP, - mClock.currentTimeMillis() + PERIODIC_SCAN_INTERVAL_MS, + mClock.currentTimeMillis() + intervalMs, PERIODIC_SCAN_TIMER_TAG, mPeriodicScanTimerListener, mEventHandler); } // Set up timer to start a delayed single scan after RESTART_SCAN_DELAY_MS - private void scheduleDelayedSingleScan(boolean isWatchdogTriggered) { + private void scheduleDelayedSingleScan(boolean isWatchdogTriggered, boolean isFullBandScan) { localLog("scheduleDelayedSingleScan"); RestartSingleScanListener restartSingleScanListener = - new RestartSingleScanListener(isWatchdogTriggered); + new RestartSingleScanListener(isWatchdogTriggered, isFullBandScan); mAlarmManager.set(AlarmManager.RTC_WAKEUP, mClock.currentTimeMillis() + RESTART_SCAN_DELAY_MS, RESTART_SINGLE_SCAN_TIMER_TAG, @@ -837,8 +910,8 @@ public class WifiConnectivityManager { // Stop connectivity scan if there is any. private void stopConnectivityScan() { - // Due to b/28020168, timer based single scan will be scheduled every - // PERIODIC_SCAN_INTERVAL_MS to provide periodic scan. + // Due to b/28020168, timer based single scan will be scheduled + // to provide periodic scan in an exponential backoff fashion. if (!ENABLE_BACKGROUND_SCAN) { mAlarmManager.cancel(mPeriodicScanTimerListener); } else { diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java index 1079ae112..84cd6c09c 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); @@ -6400,7 +6370,7 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss return prefix + imsi + "@wlan.mnc" + mnc + ".mcc" + mcc + ".3gppnetwork.org"; } - boolean startScanForConfiguration(WifiConfiguration config, boolean restrictChannelList) { + boolean startScanForConfiguration(WifiConfiguration config) { if (config == null) return false; @@ -6417,8 +6387,7 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss //return true but to not trigger the scan return true; } - HashSet<Integer> freqs = mWifiConfigManager.makeChannelList(config, - ONE_HOUR_MILLI, restrictChannelList); + HashSet<Integer> freqs = mWifiConfigManager.makeChannelList(config, ONE_HOUR_MILLI); if (freqs != null && freqs.size() != 0) { //if (DBG) { logd("starting scan for " + config.configKey() + " with " + freqs); @@ -6583,147 +6552,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 +6998,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) { @@ -7307,7 +7132,7 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss // to reconnect, go thru the // roaming cycle and enter Obtaining IP address // before signalling the disconnect to ConnectivityService and L3 - startScanForConfiguration(getCurrentWifiConfiguration(), false); + startScanForConfiguration(getCurrentWifiConfiguration()); linkDebouncing = true; sendMessageDelayed(obtainMessage(CMD_DELAYED_NETWORK_DISCONNECT, @@ -7477,9 +7302,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 +7364,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 +7450,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; |