Loading wifi/java/android/net/wifi/WifiStateMachine.java +17 −2 Original line number Diff line number Diff line Loading @@ -89,6 +89,7 @@ import java.net.InetAddress; import java.net.Inet6Address; import java.util.ArrayList; import java.util.List; import java.util.Locale; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicBoolean; import java.util.Iterator; Loading Loading @@ -500,6 +501,10 @@ public class WifiStateMachine extends StateMachine { // until after, so the write is deferred private volatile String mPersistedCountryCode; // Supplicant doesn't like setting the same country code multiple times (it may drop // currently connected network), so we save the country code here to avoid redundency private String mLastSetCountryCode; private static final int MIN_RSSI = -200; private static final int MAX_RSSI = 256; Loading Loading @@ -3022,9 +3027,17 @@ public class WifiStateMachine extends StateMachine { case CMD_SET_COUNTRY_CODE: String country = (String) message.obj; if (DBG) log("set country code " + country); if (!mWifiNative.setCountryCode(country)) { if (country != null) { country = country.toUpperCase(Locale.ROOT); if (mLastSetCountryCode == null || country.equals(mLastSetCountryCode) == false) { if (mWifiNative.setCountryCode(country)) { mLastSetCountryCode = country; } else { loge("Failed to set country code " + country); } } } break; case CMD_SET_FREQUENCY_BAND: int band = message.arg1; Loading Loading @@ -3156,6 +3169,8 @@ public class WifiStateMachine extends StateMachine { intent.putExtra(WifiManager.EXTRA_SCAN_AVAILABLE, WIFI_STATE_DISABLED); mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL); noteScanEnd(); // wrap up any pending request. mLastSetCountryCode = null; } } Loading wifi/java/android/net/wifi/p2p/WifiP2pService.java +15 −1 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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 */ Loading Loading @@ -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; Loading @@ -1082,6 +1094,8 @@ public class WifiP2pService extends IWifiP2pManager.Stub { public void exit() { sendP2pStateChangedBroadcast(false); mNetworkInfo.setIsAvailable(false); mLastSetCountryCode = null; } } Loading Loading
wifi/java/android/net/wifi/WifiStateMachine.java +17 −2 Original line number Diff line number Diff line Loading @@ -89,6 +89,7 @@ import java.net.InetAddress; import java.net.Inet6Address; import java.util.ArrayList; import java.util.List; import java.util.Locale; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicBoolean; import java.util.Iterator; Loading Loading @@ -500,6 +501,10 @@ public class WifiStateMachine extends StateMachine { // until after, so the write is deferred private volatile String mPersistedCountryCode; // Supplicant doesn't like setting the same country code multiple times (it may drop // currently connected network), so we save the country code here to avoid redundency private String mLastSetCountryCode; private static final int MIN_RSSI = -200; private static final int MAX_RSSI = 256; Loading Loading @@ -3022,9 +3027,17 @@ public class WifiStateMachine extends StateMachine { case CMD_SET_COUNTRY_CODE: String country = (String) message.obj; if (DBG) log("set country code " + country); if (!mWifiNative.setCountryCode(country)) { if (country != null) { country = country.toUpperCase(Locale.ROOT); if (mLastSetCountryCode == null || country.equals(mLastSetCountryCode) == false) { if (mWifiNative.setCountryCode(country)) { mLastSetCountryCode = country; } else { loge("Failed to set country code " + country); } } } break; case CMD_SET_FREQUENCY_BAND: int band = message.arg1; Loading Loading @@ -3156,6 +3169,8 @@ public class WifiStateMachine extends StateMachine { intent.putExtra(WifiManager.EXTRA_SCAN_AVAILABLE, WIFI_STATE_DISABLED); mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL); noteScanEnd(); // wrap up any pending request. mLastSetCountryCode = null; } } Loading
wifi/java/android/net/wifi/p2p/WifiP2pService.java +15 −1 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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 */ Loading Loading @@ -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; Loading @@ -1082,6 +1094,8 @@ public class WifiP2pService extends IWifiP2pManager.Stub { public void exit() { sendP2pStateChangedBroadcast(false); mNetworkInfo.setIsAvailable(false); mLastSetCountryCode = null; } } Loading