Loading wifi/java/android/net/wifi/WifiConfigStore.java +35 −0 Original line number Diff line number Diff line Loading @@ -1025,6 +1025,32 @@ class WifiConfigStore { break setVariables; } // Android sometimes call this function with infrastructure // configuration for ad-hoc networks (from selectNetwork), // so we only set the variable if the mode is ad-hoc. // (Infrastructure is default and does not have to be set.) if (config.mode == WifiConfiguration.Mode.ADHOC) { if (!WifiNative.setNetworkVariableCommand( netId, WifiConfiguration.Mode.varName, Integer.toString(config.mode))) { loge(config.SSID + ": failed to set mode: " +config.mode); break setVariables; } // Some drivers/wpa_supplicant require the frequency // to be set for ad-hoc networks, even though it will // not actually be used. Set it to Channel 11. if (!WifiNative.setNetworkVariableCommand( netId, "frequency", "2462")) { loge(config.SSID + ": failed to set frequency: 2462"); break setVariables; } } for (WifiConfiguration.EnterpriseField field : config.enterpriseFields) { String varName = field.varName(); Loading Loading @@ -1246,6 +1272,15 @@ class WifiConfigStore { } } value = WifiNative.getNetworkVariableCommand(netId, WifiConfiguration.Mode.varName); config.mode = WifiConfiguration.Mode.INFRASTRUCTURE; if (!TextUtils.isEmpty(value)) { try { config.mode = Integer.parseInt(value); } catch (NumberFormatException ignore) { } } value = WifiNative.getNetworkVariableCommand(netId, WifiConfiguration.wepTxKeyIdxVarName); config.wepTxKeyIndex = -1; if (!TextUtils.isEmpty(value)) { Loading wifi/java/android/net/wifi/WifiConfiguration.java +27 −0 Original line number Diff line number Diff line Loading @@ -211,6 +211,23 @@ public class WifiConfiguration implements Parcelable { public static final String[] strings = { "current", "disabled", "enabled" }; } /** * Possible modes of a network configuration. * @hide */ public static class Mode { private Mode() { } /** this is an infrastructure network */ public static final int INFRASTRUCTURE = 0; /** this is an ad-hoc network */ public static final int ADHOC = 1; public static final String varName = "mode"; public static final String[] strings = { "infrastructure", "ad-hoc" }; } /** @hide */ public static final int DISABLED_UNKNOWN_REASON = 0; /** @hide */ Loading Loading @@ -290,6 +307,12 @@ public class WifiConfiguration implements Parcelable { */ public boolean hiddenSSID; /** * The mode this access point operates on (infrastructure or ad-hoc) * @hide */ public int mode; /** * The set of key management protocols supported by this configuration. * See {@link KeyMgmt} for descriptions of the values. Loading Loading @@ -368,6 +391,7 @@ public class WifiConfiguration implements Parcelable { BSSID = null; priority = 0; hiddenSSID = false; mode = Mode.INFRASTRUCTURE; disableReason = DISABLED_UNKNOWN_REASON; allowedKeyManagement = new BitSet(); allowedProtocols = new BitSet(); Loading Loading @@ -542,6 +566,7 @@ public class WifiConfiguration implements Parcelable { wepTxKeyIndex = source.wepTxKeyIndex; priority = source.priority; hiddenSSID = source.hiddenSSID; mode = source.mode; allowedKeyManagement = (BitSet) source.allowedKeyManagement.clone(); allowedProtocols = (BitSet) source.allowedProtocols.clone(); allowedAuthAlgorithms = (BitSet) source.allowedAuthAlgorithms.clone(); Loading Loading @@ -570,6 +595,7 @@ public class WifiConfiguration implements Parcelable { dest.writeInt(wepTxKeyIndex); dest.writeInt(priority); dest.writeInt(hiddenSSID ? 1 : 0); dest.writeInt(mode); writeBitSet(dest, allowedKeyManagement); writeBitSet(dest, allowedProtocols); Loading Loading @@ -601,6 +627,7 @@ public class WifiConfiguration implements Parcelable { config.wepTxKeyIndex = in.readInt(); config.priority = in.readInt(); config.hiddenSSID = in.readInt() != 0; config.mode = in.readInt(); config.allowedKeyManagement = readBitSet(in); config.allowedProtocols = readBitSet(in); config.allowedAuthAlgorithms = readBitSet(in); Loading Loading
wifi/java/android/net/wifi/WifiConfigStore.java +35 −0 Original line number Diff line number Diff line Loading @@ -1025,6 +1025,32 @@ class WifiConfigStore { break setVariables; } // Android sometimes call this function with infrastructure // configuration for ad-hoc networks (from selectNetwork), // so we only set the variable if the mode is ad-hoc. // (Infrastructure is default and does not have to be set.) if (config.mode == WifiConfiguration.Mode.ADHOC) { if (!WifiNative.setNetworkVariableCommand( netId, WifiConfiguration.Mode.varName, Integer.toString(config.mode))) { loge(config.SSID + ": failed to set mode: " +config.mode); break setVariables; } // Some drivers/wpa_supplicant require the frequency // to be set for ad-hoc networks, even though it will // not actually be used. Set it to Channel 11. if (!WifiNative.setNetworkVariableCommand( netId, "frequency", "2462")) { loge(config.SSID + ": failed to set frequency: 2462"); break setVariables; } } for (WifiConfiguration.EnterpriseField field : config.enterpriseFields) { String varName = field.varName(); Loading Loading @@ -1246,6 +1272,15 @@ class WifiConfigStore { } } value = WifiNative.getNetworkVariableCommand(netId, WifiConfiguration.Mode.varName); config.mode = WifiConfiguration.Mode.INFRASTRUCTURE; if (!TextUtils.isEmpty(value)) { try { config.mode = Integer.parseInt(value); } catch (NumberFormatException ignore) { } } value = WifiNative.getNetworkVariableCommand(netId, WifiConfiguration.wepTxKeyIdxVarName); config.wepTxKeyIndex = -1; if (!TextUtils.isEmpty(value)) { Loading
wifi/java/android/net/wifi/WifiConfiguration.java +27 −0 Original line number Diff line number Diff line Loading @@ -211,6 +211,23 @@ public class WifiConfiguration implements Parcelable { public static final String[] strings = { "current", "disabled", "enabled" }; } /** * Possible modes of a network configuration. * @hide */ public static class Mode { private Mode() { } /** this is an infrastructure network */ public static final int INFRASTRUCTURE = 0; /** this is an ad-hoc network */ public static final int ADHOC = 1; public static final String varName = "mode"; public static final String[] strings = { "infrastructure", "ad-hoc" }; } /** @hide */ public static final int DISABLED_UNKNOWN_REASON = 0; /** @hide */ Loading Loading @@ -290,6 +307,12 @@ public class WifiConfiguration implements Parcelable { */ public boolean hiddenSSID; /** * The mode this access point operates on (infrastructure or ad-hoc) * @hide */ public int mode; /** * The set of key management protocols supported by this configuration. * See {@link KeyMgmt} for descriptions of the values. Loading Loading @@ -368,6 +391,7 @@ public class WifiConfiguration implements Parcelable { BSSID = null; priority = 0; hiddenSSID = false; mode = Mode.INFRASTRUCTURE; disableReason = DISABLED_UNKNOWN_REASON; allowedKeyManagement = new BitSet(); allowedProtocols = new BitSet(); Loading Loading @@ -542,6 +566,7 @@ public class WifiConfiguration implements Parcelable { wepTxKeyIndex = source.wepTxKeyIndex; priority = source.priority; hiddenSSID = source.hiddenSSID; mode = source.mode; allowedKeyManagement = (BitSet) source.allowedKeyManagement.clone(); allowedProtocols = (BitSet) source.allowedProtocols.clone(); allowedAuthAlgorithms = (BitSet) source.allowedAuthAlgorithms.clone(); Loading Loading @@ -570,6 +595,7 @@ public class WifiConfiguration implements Parcelable { dest.writeInt(wepTxKeyIndex); dest.writeInt(priority); dest.writeInt(hiddenSSID ? 1 : 0); dest.writeInt(mode); writeBitSet(dest, allowedKeyManagement); writeBitSet(dest, allowedProtocols); Loading Loading @@ -601,6 +627,7 @@ public class WifiConfiguration implements Parcelable { config.wepTxKeyIndex = in.readInt(); config.priority = in.readInt(); config.hiddenSSID = in.readInt() != 0; config.mode = in.readInt(); config.allowedKeyManagement = readBitSet(in); config.allowedProtocols = readBitSet(in); config.allowedAuthAlgorithms = readBitSet(in); Loading