summaryrefslogtreecommitdiffstats
path: root/wifi/java/android/net
diff options
context:
space:
mode:
Diffstat (limited to 'wifi/java/android/net')
-rw-r--r--wifi/java/android/net/wifi/WifiStateMachine.java25
1 files changed, 15 insertions, 10 deletions
diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java
index 0fffd37..3c7237f 100644
--- a/wifi/java/android/net/wifi/WifiStateMachine.java
+++ b/wifi/java/android/net/wifi/WifiStateMachine.java
@@ -118,6 +118,7 @@ public class WifiStateMachine extends StateMachine {
private INetworkManagementService mNwService;
private ConnectivityManager mCm;
+ private final boolean mWifiSupported;
private final boolean mP2pSupported;
private final AtomicBoolean mP2pConnected = new AtomicBoolean(false);
private boolean mTemporarilyDisconnectWifi = false;
@@ -233,8 +234,6 @@ public class WifiStateMachine extends StateMachine {
private DhcpStateMachine mDhcpStateMachine;
private boolean mDhcpActive = false;
- // Delay in switching to null country code (non-null has no delay)
- private final int COUNTRY_CODE_DELAY_MS = 15000;
private final AtomicInteger mCountryCodeSequence = new AtomicInteger();
private class InterfaceObserver extends BaseNetworkObserver {
@@ -660,6 +659,9 @@ public class WifiStateMachine extends StateMachine {
mP2pSupported = mContext.getPackageManager().hasSystemFeature(
PackageManager.FEATURE_WIFI_DIRECT);
+ mWifiSupported = mContext.getPackageManager().hasSystemFeature(
+ PackageManager.FEATURE_WIFI);
+
mWifiNative = new WifiNative(mInterfaceName);
mWifiConfigStore = new WifiConfigStore(context, mWifiNative);
mWifiMonitor = new WifiMonitor(this, mWifiNative);
@@ -1539,15 +1541,13 @@ public class WifiStateMachine extends StateMachine {
* @param persist {@code true} if the setting should be remembered.
*/
public void setCountryCode(String countryCode, boolean persist) {
- // If it's a country code, apply immediately,
- // If it's empty, delay it in case it's a momentary dropout
+ // If it's a good country code, apply after the current
+ // wifi connection is terminated; ignore resetting of code
+ // for now (it is unclear what the chipset should do when
+ // country code is reset)
int countryCodeSequence = mCountryCodeSequence.incrementAndGet();
if (TextUtils.isEmpty(countryCode)) {
- String defaultCountryCode = mContext.getResources().getString(
- R.string.config_wifi_unknown_country_code);
-
- sendMessageDelayed(CMD_SET_COUNTRY_CODE, countryCodeSequence, persist ? 1 : 0,
- defaultCountryCode, COUNTRY_CODE_DELAY_MS);
+ log("Ignoring resetting of country code");
} else {
sendMessage(CMD_SET_COUNTRY_CODE, countryCodeSequence, persist ? 1 : 0, countryCode);
}
@@ -1662,6 +1662,8 @@ public class WifiStateMachine extends StateMachine {
pw.println("mSuspendOptNeedsDisabled " + mSuspendOptNeedsDisabled);
pw.println("Supplicant status " + mWifiNative.status());
pw.println("mEnableBackgroundScan " + mEnableBackgroundScan);
+ pw.println("mLastSetCountryCode " + mLastSetCountryCode);
+ pw.println("mPersistedCountryCode " + mPersistedCountryCode);
pw.println();
mWifiConfigStore.dump(fd, pw, args);
}
@@ -1678,7 +1680,7 @@ public class WifiStateMachine extends StateMachine {
}
if (screenOn) enableAllNetworks();
- if (mUserWantsSuspendOpt.get()) {
+ if (mWifiSupported && mUserWantsSuspendOpt.get()) {
if (screenOn) {
sendMessage(CMD_SET_SUSPEND_OPT_ENABLED, 0, 0);
} else {
@@ -3680,6 +3682,9 @@ public class WifiStateMachine extends StateMachine {
deferMessage(message);
}
break;
+ case CMD_SET_COUNTRY_CODE:
+ deferMessage(message);
+ break;
case CMD_START_SCAN:
/* Do not attempt to connect when we are already connected */
noteScanStart(message.arg1, (WorkSource) message.obj);