diff options
author | Mahesh A Saptasagar <msapta@codeaurora.org> | 2014-11-20 00:33:48 +0530 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2014-11-20 03:02:17 -0800 |
commit | 73ad868e44a0cbfba6eadbd690420e8e5cfcd33e (patch) | |
tree | e9023cfb09d983c9beedcf17e9b479570955124d | |
parent | 5e68f8618fc5638e848c198dc5a356c6ccce780c (diff) | |
download | android_frameworks_opt_net_wifi-73ad868e44a0cbfba6eadbd690420e8e5cfcd33e.tar.gz android_frameworks_opt_net_wifi-73ad868e44a0cbfba6eadbd690420e8e5cfcd33e.tar.bz2 android_frameworks_opt_net_wifi-73ad868e44a0cbfba6eadbd690420e8e5cfcd33e.zip |
wifi: Address the improper scan behavior on PNO failure
This commit takes care of the following behavior on a PNO fail.
Trigger a periodic scan on a PNO failure when p2p session is active
and there are no configured profiles.
There is no point to continue the periodic scan triggered on a PNO fail
when p2p session is active.Thus, stall further attempts after a p2p
disconnections.
Change-Id: I7844dca7fe9dd45b99e71ef04beb19ea2ae5343e
CRs-Fixed: 759618
-rw-r--r-- | service/java/com/android/server/wifi/WifiStateMachine.java | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java index b0fcb17c1..ea84f3105 100644 --- a/service/java/com/android/server/wifi/WifiStateMachine.java +++ b/service/java/com/android/server/wifi/WifiStateMachine.java @@ -198,6 +198,9 @@ public class WifiStateMachine extends StateMachine { /* Chipset supports background scan */ private final boolean mBackgroundScanSupported; + /* Flag to verify backgroundScan is configured successfully */ + private boolean mBackgroundScanConfigured = false; + private String mInterfaceName; /* Tethering interface could be separate from wlan interface */ private String mTetherInterfaceName; @@ -7709,9 +7712,9 @@ public class WifiStateMachine extends StateMachine { } break; case CMD_PNO_PERIODIC_SCAN: - if ((message.arg1 == mPnoPeriodicScanToken) && - (mEnableBackgroundScan) && - (mWifiConfigStore.getConfiguredNetworks().size() != 0)) { + if ((mBackgroundScanConfigured == false) && + (message.arg1 == mPnoPeriodicScanToken) && + (mEnableBackgroundScan)) { startScan(UNKNOWN_SCAN_SOURCE, -1, null, null); sendMessageDelayed(obtainMessage(CMD_PNO_PERIODIC_SCAN, ++mPnoPeriodicScanToken, 0), @@ -7794,6 +7797,9 @@ public class WifiStateMachine extends StateMachine { (mWifiConfigStore.getConfiguredNetworks().size() != 0)) { if (!mWifiNative.enableBackgroundScan(true)) { handlePnoFailError(); + } else { + if (DBG) log("Stop periodic scan on PNO success"); + mBackgroundScanConfigured = true; } } case CMD_RECONNECT: @@ -8373,12 +8379,15 @@ public class WifiStateMachine extends StateMachine { } private void handlePnoFailError() { + /* PNO should not fail when P2P is not connected and there are + saved profiles */ if (!mP2pConnected.get() && (mWifiConfigStore.getConfiguredNetworks().size() == 0)) { return; } - if (mEnableBackgroundScan && - (mWifiConfigStore.getConfiguredNetworks().size() != 0)) { + /* Trigger a periodic scan for every 300Sec if PNO fails */ + if (mEnableBackgroundScan) { + mBackgroundScanConfigured = false; sendMessageDelayed(obtainMessage(CMD_PNO_PERIODIC_SCAN, ++mPnoPeriodicScanToken, 0), mDefaultFrameworkScanIntervalMs); |