diff options
author | Vinit Deshapnde <vinitd@google.com> | 2014-04-17 11:05:21 -0700 |
---|---|---|
committer | Vinit Deshapnde <vinitd@google.com> | 2014-04-17 11:05:21 -0700 |
commit | b5ee95edf97f83e31e44f72e1b0f95a0c71a97ed (patch) | |
tree | c4519eff2b8638dc675d7fcb7c3cf7cc824d56bd /wifi/java | |
parent | 849a8208c88d38e55ec13a1fa76bf295fde96cb5 (diff) | |
download | frameworks_base-b5ee95edf97f83e31e44f72e1b0f95a0c71a97ed.zip frameworks_base-b5ee95edf97f83e31e44f72e1b0f95a0c71a97ed.tar.gz frameworks_base-b5ee95edf97f83e31e44f72e1b0f95a0c71a97ed.tar.bz2 |
Don't reset country code once it is persisted
This change simply ignores resetting of country code by cellular
networks to avoid disconnecting existing wifi connections. It also
defers setting newly found country code until after existing Wifi
connection is torn down.
Also removes some dead code related to resetting of country codes.
Bug: 13894807
Change-Id: Ie2fcfdd4b3be8ba94542772c132fb1acb6a2c683
Diffstat (limited to 'wifi/java')
-rw-r--r-- | wifi/java/android/net/wifi/WifiStateMachine.java | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java index d6b23ae..9ea98b0 100644 --- a/wifi/java/android/net/wifi/WifiStateMachine.java +++ b/wifi/java/android/net/wifi/WifiStateMachine.java @@ -233,8 +233,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 { @@ -1538,15 +1536,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); } @@ -1661,6 +1657,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); } @@ -3679,6 +3677,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); |