Loading services/java/com/android/server/WifiService.java +6 −1 Original line number Diff line number Diff line Loading @@ -676,7 +676,12 @@ public class WifiService extends IWifiManager.Stub { */ public List<WifiConfiguration> getConfiguredNetworks() { enforceAccessPermission(); return mWifiStateMachine.syncGetConfiguredNetworks(); if (mWifiStateMachineChannel != null) { return mWifiStateMachine.syncGetConfiguredNetworks(mWifiStateMachineChannel); } else { Slog.e(TAG, "mWifiStateMachineChannel is not initialized"); return null; } } /** Loading wifi/java/android/net/wifi/WifiConfigStore.java +192 −177 Original line number Diff line number Diff line Loading @@ -31,6 +31,9 @@ import android.net.wifi.WifiConfiguration.Status; import android.net.wifi.NetworkUpdateResult; import static android.net.wifi.WifiConfiguration.INVALID_NETWORK_ID; import android.os.Environment; import android.os.Message; import android.os.Handler; import android.os.HandlerThread; import android.text.TextUtils; import android.util.Log; Loading @@ -50,6 +53,7 @@ import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; /** * This class provides the API to manage configured Loading Loading @@ -136,6 +140,13 @@ class WifiConfigStore { private static final String EXCLUSION_LIST_KEY = "exclusionList"; private static final String EOS = "eos"; private static HandlerThread sDiskWriteHandlerThread; private static DiskWriteHandler sDiskWriteHandler; private static Object sDiskWriteHandlerSync = new Object(); /* Tracks multiple writes on the same thread */ private static int sWriteSequence = 0; private static final int WRITE = 1; /** * Initialize context, fetch the list of configured networks * and enable all stored networks in supplicant. Loading @@ -153,11 +164,9 @@ class WifiConfigStore { */ static List<WifiConfiguration> getConfiguredNetworks() { List<WifiConfiguration> networks = new ArrayList<WifiConfiguration>(); synchronized (sConfiguredNetworks) { for(WifiConfiguration config : sConfiguredNetworks.values()) { networks.add(new WifiConfiguration(config)); } } return networks; } Loading @@ -167,7 +176,6 @@ class WifiConfigStore { */ static void enableAllNetworks() { boolean networkEnabledStateChanged = false; synchronized (sConfiguredNetworks) { for(WifiConfiguration config : sConfiguredNetworks.values()) { if(config != null && config.status == Status.DISABLED) { if(WifiNative.enableNetworkCommand(config.networkId, false)) { Loading @@ -178,7 +186,6 @@ class WifiConfigStore { } } } } if (networkEnabledStateChanged) { WifiNative.saveConfigCommand(); Loading Loading @@ -226,14 +233,12 @@ class WifiConfigStore { static void selectNetwork(int netId) { // Reset the priority of each network at start or if it goes too high. if (sLastPriority == -1 || sLastPriority > 1000000) { synchronized (sConfiguredNetworks) { for(WifiConfiguration config : sConfiguredNetworks.values()) { if (config.networkId != INVALID_NETWORK_ID) { config.priority = 0; addOrUpdateNetworkNative(config); } } } sLastPriority = 0; } Loading Loading @@ -264,10 +269,8 @@ class WifiConfigStore { /* enable a new network */ if (newNetwork && netId != INVALID_NETWORK_ID) { WifiNative.enableNetworkCommand(netId, false); synchronized (sConfiguredNetworks) { sConfiguredNetworks.get(netId).status = Status.ENABLED; } } WifiNative.saveConfigCommand(); sendConfiguredNetworksChangedBroadcast(); return result; Loading @@ -281,13 +284,11 @@ class WifiConfigStore { static void forgetNetwork(int netId) { if (WifiNative.removeNetworkCommand(netId)) { WifiNative.saveConfigCommand(); synchronized (sConfiguredNetworks) { WifiConfiguration config = sConfiguredNetworks.get(netId); if (config != null) { sConfiguredNetworks.remove(netId); sNetworkIds.remove(configKey(config)); } } writeIpAndProxyConfigurations(); sendConfiguredNetworksChangedBroadcast(); } else { Loading Loading @@ -319,7 +320,6 @@ class WifiConfigStore { */ static boolean removeNetwork(int netId) { boolean ret = WifiNative.removeNetworkCommand(netId); synchronized (sConfiguredNetworks) { if (ret) { WifiConfiguration config = sConfiguredNetworks.get(netId); if (config != null) { Loading @@ -327,7 +327,6 @@ class WifiConfigStore { sNetworkIds.remove(configKey(config)); } } } sendConfiguredNetworksChangedBroadcast(); return ret; } Loading @@ -349,10 +348,8 @@ class WifiConfigStore { static boolean enableNetworkWithoutBroadcast(int netId, boolean disableOthers) { boolean ret = WifiNative.enableNetworkCommand(netId, disableOthers); synchronized (sConfiguredNetworks) { WifiConfiguration config = sConfiguredNetworks.get(netId); if (config != null) config.status = Status.ENABLED; } if (disableOthers) { markAllNetworksDisabledExcept(netId); Loading @@ -375,14 +372,12 @@ class WifiConfigStore { */ static boolean disableNetwork(int netId, int reason) { boolean ret = WifiNative.disableNetworkCommand(netId); synchronized (sConfiguredNetworks) { WifiConfiguration config = sConfiguredNetworks.get(netId); /* Only change the reason if the network was not previously disabled */ if (config != null && config.status != Status.DISABLED) { config.status = Status.DISABLED; config.disableReason = reason; } } sendConfiguredNetworksChangedBroadcast(); return ret; } Loading Loading @@ -450,10 +445,8 @@ class WifiConfigStore { * Fetch the link properties for a given network id */ static LinkProperties getLinkProperties(int netId) { synchronized (sConfiguredNetworks) { WifiConfiguration config = sConfiguredNetworks.get(netId); if (config != null) return new LinkProperties(config.linkProperties); } return null; } Loading Loading @@ -493,7 +486,6 @@ class WifiConfigStore { static void setIpConfiguration(int netId, DhcpInfoInternal dhcpInfo) { LinkProperties linkProperties = dhcpInfo.makeLinkProperties(); synchronized (sConfiguredNetworks) { WifiConfiguration config = sConfiguredNetworks.get(netId); if (config != null) { // add old proxy details Loading @@ -503,13 +495,11 @@ class WifiConfigStore { config.linkProperties = linkProperties; } } } /** * clear IP configuration for a given network id */ static void clearIpConfiguration(int netId) { synchronized (sConfiguredNetworks) { WifiConfiguration config = sConfiguredNetworks.get(netId); if (config != null && config.linkProperties != null) { // Clear everything except proxy Loading @@ -518,7 +508,6 @@ class WifiConfigStore { config.linkProperties.setHttpProxy(proxy); } } } /** Loading @@ -536,12 +525,10 @@ class WifiConfigStore { * Return if the specified network is using static IP */ static boolean isUsingStaticIp(int netId) { synchronized (sConfiguredNetworks) { WifiConfiguration config = sConfiguredNetworks.get(netId); if (config != null && config.ipAssignment == IpAssignment.STATIC) { return true; } } return false; } Loading @@ -555,7 +542,6 @@ class WifiConfigStore { String listStr = WifiNative.listNetworksCommand(); sLastPriority = 0; synchronized (sConfiguredNetworks) { sConfiguredNetworks.clear(); sNetworkIds.clear(); Loading Loading @@ -590,13 +576,12 @@ class WifiConfigStore { sConfiguredNetworks.put(config.networkId, config); sNetworkIds.put(configKey(config), config.networkId); } } readIpAndProxyConfigurations(); sendConfiguredNetworksChangedBroadcast(); } static void updateIpAndProxyFromWpsConfig(int netId, WpsInfo wpsConfig) { synchronized (sConfiguredNetworks) { WifiConfiguration config = sConfiguredNetworks.get(netId); if (config != null) { config.ipAssignment = wpsConfig.ipAssignment; Loading @@ -605,11 +590,9 @@ class WifiConfigStore { writeIpAndProxyConfigurations(); } } } /* Mark all networks except specified netId as disabled */ private static void markAllNetworksDisabledExcept(int netId) { synchronized (sConfiguredNetworks) { for(WifiConfiguration config : sConfiguredNetworks.values()) { if(config != null && config.networkId != netId) { if (config.status != Status.DISABLED) { Loading @@ -619,7 +602,6 @@ class WifiConfigStore { } } } } private static void markAllNetworksDisabled() { markAllNetworksDisabledExcept(INVALID_NETWORK_ID); Loading @@ -627,6 +609,38 @@ class WifiConfigStore { private static void writeIpAndProxyConfigurations() { /* Make a copy */ List<WifiConfiguration> networks = new ArrayList<WifiConfiguration>(); for(WifiConfiguration config : sConfiguredNetworks.values()) { networks.add(new WifiConfiguration(config)); } /* Do a delayed write to disk on a seperate handler thread */ synchronized (sDiskWriteHandlerSync) { if (++sWriteSequence == 1) { sDiskWriteHandlerThread = new HandlerThread("WifiConfigThread"); sDiskWriteHandlerThread.start(); sDiskWriteHandler = new DiskWriteHandler(sDiskWriteHandlerThread.getLooper()); } } sDiskWriteHandler.sendMessage(Message.obtain(sDiskWriteHandler, WRITE, networks)); } private static class DiskWriteHandler extends Handler { DiskWriteHandler(android.os.Looper l) { super(l); } public void handleMessage(Message msg) { if (msg.what != WRITE) { throw new RuntimeException("Unsupported message in WifiConfigStore: " + msg); } List<WifiConfiguration> networks = (List<WifiConfiguration>) msg.obj; DataOutputStream out = null; try { out = new DataOutputStream(new BufferedOutputStream( Loading @@ -634,8 +648,7 @@ class WifiConfigStore { out.writeInt(IPCONFIG_FILE_VERSION); synchronized (sConfiguredNetworks) { for(WifiConfiguration config : sConfiguredNetworks.values()) { for(WifiConfiguration config : networks) { boolean writeToFile = false; try { Loading Loading @@ -720,7 +733,6 @@ class WifiConfigStore { } out.writeUTF(EOS); } } } catch (IOException e) { loge("Error writing data file"); Loading @@ -730,6 +742,16 @@ class WifiConfigStore { out.close(); } catch (Exception e) {} } //Quit if no more writes sent synchronized (sDiskWriteHandlerSync) { if (--sWriteSequence == 0) { getLooper().quit(); sDiskWriteHandlerThread = null; sDiskWriteHandler= null; } } } } } Loading Loading @@ -806,7 +828,6 @@ class WifiConfigStore { } while (true); if (id != -1) { synchronized (sConfiguredNetworks) { WifiConfiguration config = sConfiguredNetworks.get( sNetworkIds.get(id)); Loading Loading @@ -845,7 +866,6 @@ class WifiConfigStore { break; } } } } else { loge("Missing id while parsing configuration"); } Loading Loading @@ -1061,10 +1081,7 @@ class WifiConfigStore { * when written. For example, wep key is stored as * irrespective * of the value sent to the supplicant */ WifiConfiguration sConfig; synchronized (sConfiguredNetworks) { sConfig = sConfiguredNetworks.get(netId); } WifiConfiguration sConfig = sConfiguredNetworks.get(netId); if (sConfig == null) { sConfig = new WifiConfiguration(); sConfig.networkId = netId; Loading @@ -1072,10 +1089,8 @@ class WifiConfigStore { readNetworkVariables(sConfig); synchronized (sConfiguredNetworks) { sConfiguredNetworks.put(netId, sConfig); sNetworkIds.put(configKey(sConfig), netId); } NetworkUpdateResult result = writeIpAndProxyConfigurationsOnChange(sConfig, config); result.setNetworkId(netId); Loading wifi/java/android/net/wifi/WifiStateMachine.java +11 −2 Original line number Diff line number Diff line Loading @@ -276,6 +276,8 @@ public class WifiStateMachine extends StateMachine { static final int CMD_CLEAR_BLACKLIST = BASE + 58; /* Save configuration */ static final int CMD_SAVE_CONFIG = BASE + 59; /* Get configured networks*/ static final int CMD_GET_CONFIGURED_NETWORKS = BASE + 60; /* Supplicant commands after driver start*/ /* Initiate a scan */ Loading Loading @@ -847,8 +849,11 @@ public class WifiStateMachine extends StateMachine { return result; } public List<WifiConfiguration> syncGetConfiguredNetworks() { return WifiConfigStore.getConfiguredNetworks(); public List<WifiConfiguration> syncGetConfiguredNetworks(AsyncChannel channel) { Message resultMsg = channel.sendMessageSynchronously(CMD_GET_CONFIGURED_NETWORKS); List<WifiConfiguration> result = (List<WifiConfiguration>) resultMsg.obj; resultMsg.recycle(); return result; } /** Loading Loading @@ -1811,6 +1816,10 @@ public class WifiStateMachine extends StateMachine { case CMD_SAVE_CONFIG: mReplyChannel.replyToMessage(message, message.what, FAILURE); break; case CMD_GET_CONFIGURED_NETWORKS: mReplyChannel.replyToMessage(message, message.what, WifiConfigStore.getConfiguredNetworks()); break; case CMD_ENABLE_RSSI_POLL: mEnableRssiPolling = (message.arg1 == 1); break; Loading Loading
services/java/com/android/server/WifiService.java +6 −1 Original line number Diff line number Diff line Loading @@ -676,7 +676,12 @@ public class WifiService extends IWifiManager.Stub { */ public List<WifiConfiguration> getConfiguredNetworks() { enforceAccessPermission(); return mWifiStateMachine.syncGetConfiguredNetworks(); if (mWifiStateMachineChannel != null) { return mWifiStateMachine.syncGetConfiguredNetworks(mWifiStateMachineChannel); } else { Slog.e(TAG, "mWifiStateMachineChannel is not initialized"); return null; } } /** Loading
wifi/java/android/net/wifi/WifiConfigStore.java +192 −177 Original line number Diff line number Diff line Loading @@ -31,6 +31,9 @@ import android.net.wifi.WifiConfiguration.Status; import android.net.wifi.NetworkUpdateResult; import static android.net.wifi.WifiConfiguration.INVALID_NETWORK_ID; import android.os.Environment; import android.os.Message; import android.os.Handler; import android.os.HandlerThread; import android.text.TextUtils; import android.util.Log; Loading @@ -50,6 +53,7 @@ import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; /** * This class provides the API to manage configured Loading Loading @@ -136,6 +140,13 @@ class WifiConfigStore { private static final String EXCLUSION_LIST_KEY = "exclusionList"; private static final String EOS = "eos"; private static HandlerThread sDiskWriteHandlerThread; private static DiskWriteHandler sDiskWriteHandler; private static Object sDiskWriteHandlerSync = new Object(); /* Tracks multiple writes on the same thread */ private static int sWriteSequence = 0; private static final int WRITE = 1; /** * Initialize context, fetch the list of configured networks * and enable all stored networks in supplicant. Loading @@ -153,11 +164,9 @@ class WifiConfigStore { */ static List<WifiConfiguration> getConfiguredNetworks() { List<WifiConfiguration> networks = new ArrayList<WifiConfiguration>(); synchronized (sConfiguredNetworks) { for(WifiConfiguration config : sConfiguredNetworks.values()) { networks.add(new WifiConfiguration(config)); } } return networks; } Loading @@ -167,7 +176,6 @@ class WifiConfigStore { */ static void enableAllNetworks() { boolean networkEnabledStateChanged = false; synchronized (sConfiguredNetworks) { for(WifiConfiguration config : sConfiguredNetworks.values()) { if(config != null && config.status == Status.DISABLED) { if(WifiNative.enableNetworkCommand(config.networkId, false)) { Loading @@ -178,7 +186,6 @@ class WifiConfigStore { } } } } if (networkEnabledStateChanged) { WifiNative.saveConfigCommand(); Loading Loading @@ -226,14 +233,12 @@ class WifiConfigStore { static void selectNetwork(int netId) { // Reset the priority of each network at start or if it goes too high. if (sLastPriority == -1 || sLastPriority > 1000000) { synchronized (sConfiguredNetworks) { for(WifiConfiguration config : sConfiguredNetworks.values()) { if (config.networkId != INVALID_NETWORK_ID) { config.priority = 0; addOrUpdateNetworkNative(config); } } } sLastPriority = 0; } Loading Loading @@ -264,10 +269,8 @@ class WifiConfigStore { /* enable a new network */ if (newNetwork && netId != INVALID_NETWORK_ID) { WifiNative.enableNetworkCommand(netId, false); synchronized (sConfiguredNetworks) { sConfiguredNetworks.get(netId).status = Status.ENABLED; } } WifiNative.saveConfigCommand(); sendConfiguredNetworksChangedBroadcast(); return result; Loading @@ -281,13 +284,11 @@ class WifiConfigStore { static void forgetNetwork(int netId) { if (WifiNative.removeNetworkCommand(netId)) { WifiNative.saveConfigCommand(); synchronized (sConfiguredNetworks) { WifiConfiguration config = sConfiguredNetworks.get(netId); if (config != null) { sConfiguredNetworks.remove(netId); sNetworkIds.remove(configKey(config)); } } writeIpAndProxyConfigurations(); sendConfiguredNetworksChangedBroadcast(); } else { Loading Loading @@ -319,7 +320,6 @@ class WifiConfigStore { */ static boolean removeNetwork(int netId) { boolean ret = WifiNative.removeNetworkCommand(netId); synchronized (sConfiguredNetworks) { if (ret) { WifiConfiguration config = sConfiguredNetworks.get(netId); if (config != null) { Loading @@ -327,7 +327,6 @@ class WifiConfigStore { sNetworkIds.remove(configKey(config)); } } } sendConfiguredNetworksChangedBroadcast(); return ret; } Loading @@ -349,10 +348,8 @@ class WifiConfigStore { static boolean enableNetworkWithoutBroadcast(int netId, boolean disableOthers) { boolean ret = WifiNative.enableNetworkCommand(netId, disableOthers); synchronized (sConfiguredNetworks) { WifiConfiguration config = sConfiguredNetworks.get(netId); if (config != null) config.status = Status.ENABLED; } if (disableOthers) { markAllNetworksDisabledExcept(netId); Loading @@ -375,14 +372,12 @@ class WifiConfigStore { */ static boolean disableNetwork(int netId, int reason) { boolean ret = WifiNative.disableNetworkCommand(netId); synchronized (sConfiguredNetworks) { WifiConfiguration config = sConfiguredNetworks.get(netId); /* Only change the reason if the network was not previously disabled */ if (config != null && config.status != Status.DISABLED) { config.status = Status.DISABLED; config.disableReason = reason; } } sendConfiguredNetworksChangedBroadcast(); return ret; } Loading Loading @@ -450,10 +445,8 @@ class WifiConfigStore { * Fetch the link properties for a given network id */ static LinkProperties getLinkProperties(int netId) { synchronized (sConfiguredNetworks) { WifiConfiguration config = sConfiguredNetworks.get(netId); if (config != null) return new LinkProperties(config.linkProperties); } return null; } Loading Loading @@ -493,7 +486,6 @@ class WifiConfigStore { static void setIpConfiguration(int netId, DhcpInfoInternal dhcpInfo) { LinkProperties linkProperties = dhcpInfo.makeLinkProperties(); synchronized (sConfiguredNetworks) { WifiConfiguration config = sConfiguredNetworks.get(netId); if (config != null) { // add old proxy details Loading @@ -503,13 +495,11 @@ class WifiConfigStore { config.linkProperties = linkProperties; } } } /** * clear IP configuration for a given network id */ static void clearIpConfiguration(int netId) { synchronized (sConfiguredNetworks) { WifiConfiguration config = sConfiguredNetworks.get(netId); if (config != null && config.linkProperties != null) { // Clear everything except proxy Loading @@ -518,7 +508,6 @@ class WifiConfigStore { config.linkProperties.setHttpProxy(proxy); } } } /** Loading @@ -536,12 +525,10 @@ class WifiConfigStore { * Return if the specified network is using static IP */ static boolean isUsingStaticIp(int netId) { synchronized (sConfiguredNetworks) { WifiConfiguration config = sConfiguredNetworks.get(netId); if (config != null && config.ipAssignment == IpAssignment.STATIC) { return true; } } return false; } Loading @@ -555,7 +542,6 @@ class WifiConfigStore { String listStr = WifiNative.listNetworksCommand(); sLastPriority = 0; synchronized (sConfiguredNetworks) { sConfiguredNetworks.clear(); sNetworkIds.clear(); Loading Loading @@ -590,13 +576,12 @@ class WifiConfigStore { sConfiguredNetworks.put(config.networkId, config); sNetworkIds.put(configKey(config), config.networkId); } } readIpAndProxyConfigurations(); sendConfiguredNetworksChangedBroadcast(); } static void updateIpAndProxyFromWpsConfig(int netId, WpsInfo wpsConfig) { synchronized (sConfiguredNetworks) { WifiConfiguration config = sConfiguredNetworks.get(netId); if (config != null) { config.ipAssignment = wpsConfig.ipAssignment; Loading @@ -605,11 +590,9 @@ class WifiConfigStore { writeIpAndProxyConfigurations(); } } } /* Mark all networks except specified netId as disabled */ private static void markAllNetworksDisabledExcept(int netId) { synchronized (sConfiguredNetworks) { for(WifiConfiguration config : sConfiguredNetworks.values()) { if(config != null && config.networkId != netId) { if (config.status != Status.DISABLED) { Loading @@ -619,7 +602,6 @@ class WifiConfigStore { } } } } private static void markAllNetworksDisabled() { markAllNetworksDisabledExcept(INVALID_NETWORK_ID); Loading @@ -627,6 +609,38 @@ class WifiConfigStore { private static void writeIpAndProxyConfigurations() { /* Make a copy */ List<WifiConfiguration> networks = new ArrayList<WifiConfiguration>(); for(WifiConfiguration config : sConfiguredNetworks.values()) { networks.add(new WifiConfiguration(config)); } /* Do a delayed write to disk on a seperate handler thread */ synchronized (sDiskWriteHandlerSync) { if (++sWriteSequence == 1) { sDiskWriteHandlerThread = new HandlerThread("WifiConfigThread"); sDiskWriteHandlerThread.start(); sDiskWriteHandler = new DiskWriteHandler(sDiskWriteHandlerThread.getLooper()); } } sDiskWriteHandler.sendMessage(Message.obtain(sDiskWriteHandler, WRITE, networks)); } private static class DiskWriteHandler extends Handler { DiskWriteHandler(android.os.Looper l) { super(l); } public void handleMessage(Message msg) { if (msg.what != WRITE) { throw new RuntimeException("Unsupported message in WifiConfigStore: " + msg); } List<WifiConfiguration> networks = (List<WifiConfiguration>) msg.obj; DataOutputStream out = null; try { out = new DataOutputStream(new BufferedOutputStream( Loading @@ -634,8 +648,7 @@ class WifiConfigStore { out.writeInt(IPCONFIG_FILE_VERSION); synchronized (sConfiguredNetworks) { for(WifiConfiguration config : sConfiguredNetworks.values()) { for(WifiConfiguration config : networks) { boolean writeToFile = false; try { Loading Loading @@ -720,7 +733,6 @@ class WifiConfigStore { } out.writeUTF(EOS); } } } catch (IOException e) { loge("Error writing data file"); Loading @@ -730,6 +742,16 @@ class WifiConfigStore { out.close(); } catch (Exception e) {} } //Quit if no more writes sent synchronized (sDiskWriteHandlerSync) { if (--sWriteSequence == 0) { getLooper().quit(); sDiskWriteHandlerThread = null; sDiskWriteHandler= null; } } } } } Loading Loading @@ -806,7 +828,6 @@ class WifiConfigStore { } while (true); if (id != -1) { synchronized (sConfiguredNetworks) { WifiConfiguration config = sConfiguredNetworks.get( sNetworkIds.get(id)); Loading Loading @@ -845,7 +866,6 @@ class WifiConfigStore { break; } } } } else { loge("Missing id while parsing configuration"); } Loading Loading @@ -1061,10 +1081,7 @@ class WifiConfigStore { * when written. For example, wep key is stored as * irrespective * of the value sent to the supplicant */ WifiConfiguration sConfig; synchronized (sConfiguredNetworks) { sConfig = sConfiguredNetworks.get(netId); } WifiConfiguration sConfig = sConfiguredNetworks.get(netId); if (sConfig == null) { sConfig = new WifiConfiguration(); sConfig.networkId = netId; Loading @@ -1072,10 +1089,8 @@ class WifiConfigStore { readNetworkVariables(sConfig); synchronized (sConfiguredNetworks) { sConfiguredNetworks.put(netId, sConfig); sNetworkIds.put(configKey(sConfig), netId); } NetworkUpdateResult result = writeIpAndProxyConfigurationsOnChange(sConfig, config); result.setNetworkId(netId); Loading
wifi/java/android/net/wifi/WifiStateMachine.java +11 −2 Original line number Diff line number Diff line Loading @@ -276,6 +276,8 @@ public class WifiStateMachine extends StateMachine { static final int CMD_CLEAR_BLACKLIST = BASE + 58; /* Save configuration */ static final int CMD_SAVE_CONFIG = BASE + 59; /* Get configured networks*/ static final int CMD_GET_CONFIGURED_NETWORKS = BASE + 60; /* Supplicant commands after driver start*/ /* Initiate a scan */ Loading Loading @@ -847,8 +849,11 @@ public class WifiStateMachine extends StateMachine { return result; } public List<WifiConfiguration> syncGetConfiguredNetworks() { return WifiConfigStore.getConfiguredNetworks(); public List<WifiConfiguration> syncGetConfiguredNetworks(AsyncChannel channel) { Message resultMsg = channel.sendMessageSynchronously(CMD_GET_CONFIGURED_NETWORKS); List<WifiConfiguration> result = (List<WifiConfiguration>) resultMsg.obj; resultMsg.recycle(); return result; } /** Loading Loading @@ -1811,6 +1816,10 @@ public class WifiStateMachine extends StateMachine { case CMD_SAVE_CONFIG: mReplyChannel.replyToMessage(message, message.what, FAILURE); break; case CMD_GET_CONFIGURED_NETWORKS: mReplyChannel.replyToMessage(message, message.what, WifiConfigStore.getConfiguredNetworks()); break; case CMD_ENABLE_RSSI_POLL: mEnableRssiPolling = (message.arg1 == 1); break; Loading