summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruno Randolf <br1@einfach.org>2015-01-13 16:54:21 -0800
committerSteve Kondik <steve@cyngn.com>2015-10-26 16:07:31 -0700
commitf6c974f6c3d30799fb98bffec4d8071dcda70c52 (patch)
tree277533d4f58220fe1b18f1398e2e3b4f894f7fd2
parent389a27d8ae4e2b6ae5a59855138b4b1648957651 (diff)
downloadframeworks_base-f6c974f6c3d30799fb98bffec4d8071dcda70c52.zip
frameworks_base-f6c974f6c3d30799fb98bffec4d8071dcda70c52.tar.gz
frameworks_base-f6c974f6c3d30799fb98bffec4d8071dcda70c52.tar.bz2
wifi: Framework support for Ad-Hoc WiFi (IBSS mode)
* Backport from previous CM releases, adapted to new API Change-Id: Id175bbfb7500329d5f8abfe645106854c201b2fb Signed-off-by: Steve Kondik <steve@cyngn.com>
-rw-r--r--wifi/java/android/net/wifi/IWifiManager.aidl2
-rw-r--r--wifi/java/android/net/wifi/WifiChannel.java5
-rw-r--r--wifi/java/android/net/wifi/WifiConfiguration.java24
-rw-r--r--wifi/java/android/net/wifi/WifiManager.java13
4 files changed, 44 insertions, 0 deletions
diff --git a/wifi/java/android/net/wifi/IWifiManager.aidl b/wifi/java/android/net/wifi/IWifiManager.aidl
index 0d95b38..160fd76 100644
--- a/wifi/java/android/net/wifi/IWifiManager.aidl
+++ b/wifi/java/android/net/wifi/IWifiManager.aidl
@@ -90,6 +90,8 @@ interface IWifiManager
boolean isDualBandSupported();
+ boolean isIbssSupported();
+
boolean saveConfiguration();
DhcpInfo getDhcpInfo();
diff --git a/wifi/java/android/net/wifi/WifiChannel.java b/wifi/java/android/net/wifi/WifiChannel.java
index 640481e..a526062 100644
--- a/wifi/java/android/net/wifi/WifiChannel.java
+++ b/wifi/java/android/net/wifi/WifiChannel.java
@@ -43,6 +43,9 @@ public class WifiChannel implements Parcelable {
/** is it a DFS channel? */
public boolean isDFS;
+ /** is IBSS allowed? */
+ public boolean ibssAllowed;
+
/** public constructor */
public WifiChannel() { }
@@ -65,6 +68,7 @@ public class WifiChannel implements Parcelable {
out.writeInt(freqMHz);
out.writeInt(channelNum);
out.writeInt(isDFS ? 1 : 0);
+ out.writeInt(ibssAllowed ? 1 : 0);
}
/** implement Parcelable interface */
@@ -76,6 +80,7 @@ public class WifiChannel implements Parcelable {
channel.freqMHz = in.readInt();
channel.channelNum = in.readInt();
channel.isDFS = in.readInt() != 0;
+ channel.ibssAllowed = in.readInt() != 0;
return channel;
}
diff --git a/wifi/java/android/net/wifi/WifiConfiguration.java b/wifi/java/android/net/wifi/WifiConfiguration.java
index 2bd1de9..9d4f6e2 100644
--- a/wifi/java/android/net/wifi/WifiConfiguration.java
+++ b/wifi/java/android/net/wifi/WifiConfiguration.java
@@ -58,6 +58,10 @@ public class WifiConfiguration implements Parcelable {
public static final String pmfVarName = "ieee80211w";
/** {@hide} */
public static final String updateIdentiferVarName = "update_identifier";
+ /** {@hide} */
+ public static final String modeVarName = "mode";
+ /** {@hide} */
+ public static final String frequencyVarName = "frequency";
/** {@hide} */
public static final int INVALID_NETWORK_ID = -1;
/** {@hide} */
@@ -305,6 +309,18 @@ public class WifiConfiguration implements Parcelable {
*/
public String updateIdentifier;
+ /**
+ * This is an Ad-Hoc (IBSS) network
+ * {@hide}
+ */
+ public boolean isIBSS;
+
+ /**
+ * Frequency of the Ad-Hoc (IBSS) network, if newly created
+ * {@hide}
+ */
+ public int frequency;
+
/**
* The set of key management protocols supported by this configuration.
* See {@link KeyMgmt} for descriptions of the values.
@@ -919,6 +935,8 @@ public class WifiConfiguration implements Parcelable {
roamingConsortiumIds = new long[0];
priority = 0;
hiddenSSID = false;
+ isIBSS = false;
+ frequency = 0;
disableReason = DISABLED_UNKNOWN_REASON;
allowedKeyManagement = new BitSet();
allowedProtocols = new BitSet();
@@ -1466,6 +1484,8 @@ public class WifiConfiguration implements Parcelable {
wepTxKeyIndex = source.wepTxKeyIndex;
priority = source.priority;
hiddenSSID = source.hiddenSSID;
+ isIBSS = source.isIBSS;
+ frequency = source.frequency;
allowedKeyManagement = (BitSet) source.allowedKeyManagement.clone();
allowedProtocols = (BitSet) source.allowedProtocols.clone();
allowedAuthAlgorithms = (BitSet) source.allowedAuthAlgorithms.clone();
@@ -1568,6 +1588,8 @@ public class WifiConfiguration implements Parcelable {
dest.writeInt(wepTxKeyIndex);
dest.writeInt(priority);
dest.writeInt(hiddenSSID ? 1 : 0);
+ dest.writeInt(isIBSS ? 1 : 0);
+ dest.writeInt(frequency);
dest.writeInt(requirePMF ? 1 : 0);
dest.writeString(updateIdentifier);
@@ -1645,6 +1667,8 @@ public class WifiConfiguration implements Parcelable {
config.wepTxKeyIndex = in.readInt();
config.priority = in.readInt();
config.hiddenSSID = in.readInt() != 0;
+ config.isIBSS = in.readInt() != 0;
+ config.frequency = in.readInt();
config.requirePMF = in.readInt() != 0;
config.updateIdentifier = in.readString();
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index 9c73735..6b6be54e 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -1422,6 +1422,19 @@ public class WifiManager {
}
/**
+ * Check if the chipset supports IBSS (Adhoc) mode
+ * @return {@code true} if supported, {@code false} otherwise.
+ * @hide
+ */
+ public boolean isIbssSupported() {
+ try {
+ return mService.isIbssSupported();
+ } catch (RemoteException e) {
+ return false;
+ }
+ }
+
+ /**
* Return the DHCP-assigned addresses from the last successful DHCP request,
* if any.
* @return the DHCP information