diff options
author | Vinit Deshapnde <vinitd@google.com> | 2013-07-12 00:58:07 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-07-12 00:58:07 +0000 |
commit | e08842840064801e32f33798c8ed6185c7d7650b (patch) | |
tree | 486ba8ebc0fd99c86b5a909491f4ffecd5af3f4a /wifi/java | |
parent | 171699fbdd366d7cba6cfd224f988bf0592272b7 (diff) | |
parent | 64f0d5ba158e9135bcd48d64a1c0db282a4628ba (diff) | |
download | frameworks_base-e08842840064801e32f33798c8ed6185c7d7650b.zip frameworks_base-e08842840064801e32f33798c8ed6185c7d7650b.tar.gz frameworks_base-e08842840064801e32f33798c8ed6185c7d7650b.tar.bz2 |
Merge "Allow enabling TDLS on specific routes"
Diffstat (limited to 'wifi/java')
-rw-r--r-- | wifi/java/android/net/wifi/IWifiManager.aidl | 4 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/WifiManager.java | 38 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/WifiNative.java | 7 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/WifiStateMachine.java | 17 |
4 files changed, 66 insertions, 0 deletions
diff --git a/wifi/java/android/net/wifi/IWifiManager.aidl b/wifi/java/android/net/wifi/IWifiManager.aidl index 547ae95..6a4bd45 100644 --- a/wifi/java/android/net/wifi/IWifiManager.aidl +++ b/wifi/java/android/net/wifi/IWifiManager.aidl @@ -110,5 +110,9 @@ interface IWifiManager String getConfigFile(); void captivePortalCheckComplete(); + + void enableTdls(String remoteIPAddress, boolean enable); + + void enableTdlsWithMacAddress(String remoteMacAddress, boolean enable); } diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java index a3c172a..86ca4a7 100644 --- a/wifi/java/android/net/wifi/WifiManager.java +++ b/wifi/java/android/net/wifi/WifiManager.java @@ -32,6 +32,7 @@ import android.os.Messenger; import android.util.Log; import android.util.SparseArray; +import java.net.InetAddress; import java.util.concurrent.CountDownLatch; import com.android.internal.util.AsyncChannel; @@ -1132,6 +1133,43 @@ public class WifiManager { } } + + /** + * Enable TDLS on a specific local route + * + * This API is used by WiFi display, but eventually it can be made public, + * just depends on how popular TDLS gets + * + * @param remoteIPAddress IP address of the endpoint to setup TDLS with + * @param enable true = setup and false = tear down TDLS + * @hide + */ + public void enableTdls(InetAddress remoteIPAddress, boolean enable) { + try { + mService.enableTdls(remoteIPAddress.getHostAddress(), enable); + } catch (RemoteException e) { + // Just ignore the exception + } + } + + /** + * Enable TDLS on a specific local route + * + * This API is used by WiFi display, but eventually it can be made public, + * just depends on how popular TDLS gets + * + * @param remoteMacAddress MAC address of the remote endpoint such as 00:00:0c:9f:f2:ab + * @param enable true = setup and false = tear down TDLS + * @hide + */ + public void enableTdlsWithMacAddress(String remoteMacAddress, boolean enable) { + try { + mService.enableTdlsWithMacAddress(remoteMacAddress, enable); + } catch (RemoteException e) { + // Just ignore the exception + } + } + /* TODO: deprecate synchronous API and open up the following API */ private static final int BASE = Protocol.BASE_WIFI_MANAGER; diff --git a/wifi/java/android/net/wifi/WifiNative.java b/wifi/java/android/net/wifi/WifiNative.java index ae41c9a..7ee7085 100644 --- a/wifi/java/android/net/wifi/WifiNative.java +++ b/wifi/java/android/net/wifi/WifiNative.java @@ -370,6 +370,13 @@ public class WifiNative { doBooleanCommand("SCAN_INTERVAL " + scanInterval); } + public void startTdls(String macAddr, boolean enable) { + if (enable) + doBooleanCommand("TDLS_SETUP " + macAddr); + else + doBooleanCommand("TDLS_TEARDOWN " + macAddr); + } + /** Example output: * RSSI=-65 * LINKSPEED=48 diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java index 8b9fe55..858fbcc 100644 --- a/wifi/java/android/net/wifi/WifiStateMachine.java +++ b/wifi/java/android/net/wifi/WifiStateMachine.java @@ -337,6 +337,8 @@ public class WifiStateMachine extends StateMachine { static final int CMD_SET_FREQUENCY_BAND = BASE + 90; /* Enable background scan for configured networks */ static final int CMD_ENABLE_BACKGROUND_SCAN = BASE + 91; + /* Enable TDLS on a specific MAC address */ + static final int CMD_ENABLE_TDLS = BASE + 92; /* Commands from/to the SupplicantStateTracker */ /* Reset the supplicant state tracker */ @@ -1074,6 +1076,14 @@ public class WifiStateMachine extends StateMachine { } /** + * Enable TDLS for a specific MAC address + */ + public void enableTdls(String remoteMacAddress, boolean enable) { + int enabler = enable ? 1 : 0; + sendMessage(CMD_ENABLE_TDLS, enabler, 0, remoteMacAddress); + } + + /** * Returns the operational frequency band */ public int getFrequencyBand() { @@ -2605,6 +2615,13 @@ public class WifiStateMachine extends StateMachine { setSuspendOptimizationsNative(SUSPEND_DUE_TO_HIGH_PERF, true); } break; + case CMD_ENABLE_TDLS: + if (message.obj != null) { + String remoteAddress = (String) message.obj; + boolean enable = (message.arg1 == 1); + mWifiNative.startTdls(remoteAddress, enable); + } + break; default: return NOT_HANDLED; } |