diff options
author | Robert Greenwalt <rgreenwalt@google.com> | 2013-10-21 18:09:02 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-10-21 18:09:02 -0700 |
commit | 405f731a4dccf867166df5a1064b44a791a1696b (patch) | |
tree | 1a95a70f62087192b79789d122fecfff31f46539 /wifi/java/android/net/wifi/p2p | |
parent | 0cbfafdf706d96a3b2838b8470196ba1f54f2523 (diff) | |
parent | 63dd9d2f550983d890ea21eee9b8f8619608bb79 (diff) | |
download | frameworks_base-405f731a4dccf867166df5a1064b44a791a1696b.zip frameworks_base-405f731a4dccf867166df5a1064b44a791a1696b.tar.gz frameworks_base-405f731a4dccf867166df5a1064b44a791a1696b.tar.bz2 |
am 63dd9d2f: am 4802c6da: am 4d8a8392: Merge "Don\'t set same country code on supplicant again and again" into klp-dev
* commit '63dd9d2f550983d890ea21eee9b8f8619608bb79':
Don't set same country code on supplicant again and again
Diffstat (limited to 'wifi/java/android/net/wifi/p2p')
-rw-r--r-- | wifi/java/android/net/wifi/p2p/WifiP2pService.java | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pService.java b/wifi/java/android/net/wifi/p2p/WifiP2pService.java index 23058f4..25b2270 100644 --- a/wifi/java/android/net/wifi/p2p/WifiP2pService.java +++ b/wifi/java/android/net/wifi/p2p/WifiP2pService.java @@ -85,6 +85,8 @@ import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.List; +import java.util.Locale; + /** * WifiP2pService includes a state machine to perform Wi-Fi p2p operations. Applications @@ -201,6 +203,10 @@ public class WifiP2pService extends IWifiP2pManager.Stub { */ private boolean mDiscoveryBlocked; + // Supplicant doesn't like setting the same country code multiple times (it may drop + // current connected network), so we save the country code here to avoid redundency + private String mLastSetCountryCode; + /* * remember if we were in a scan when it had to be stopped */ @@ -1070,7 +1076,13 @@ public class WifiP2pService extends IWifiP2pManager.Stub { break; case SET_COUNTRY_CODE: String countryCode = (String) message.obj; - mWifiNative.setCountryCode(countryCode); + countryCode = countryCode.toUpperCase(Locale.ROOT); + if (mLastSetCountryCode == null || + countryCode.equals(mLastSetCountryCode) == false) { + if (mWifiNative.setCountryCode(countryCode)) { + mLastSetCountryCode = countryCode; + } + } break; default: return NOT_HANDLED; @@ -1083,6 +1095,8 @@ public class WifiP2pService extends IWifiP2pManager.Stub { sendP2pDiscoveryChangedBroadcast(false); sendP2pStateChangedBroadcast(false); mNetworkInfo.setIsAvailable(false); + + mLastSetCountryCode = null; } } |