summaryrefslogtreecommitdiffstats
path: root/wifi/java
diff options
context:
space:
mode:
authorIrfan Sheriff <isheriff@google.com>2011-12-28 13:00:28 -0800
committerIrfan Sheriff <isheriff@google.com>2011-12-28 13:25:14 -0800
commit44b330dfb0aeecb4e2ac97ff72a5abfb341c74fb (patch)
tree98c8746c9d49f00b34abd015e03ed7b817b533b3 /wifi/java
parent1f095869536472c178046bb63c59947508eac4a6 (diff)
downloadframeworks_base-44b330dfb0aeecb4e2ac97ff72a5abfb341c74fb.zip
frameworks_base-44b330dfb0aeecb4e2ac97ff72a5abfb341c74fb.tar.gz
frameworks_base-44b330dfb0aeecb4e2ac97ff72a5abfb341c74fb.tar.bz2
Add multi-interface support to native calls
Add the initial support for supporting seperate socket connections on the p2p interface. This is the initial change making primary interface connections work alongside native support for p2p socket connection Change-Id: I7619715ca75b10afd29af852279fe713331f75e0
Diffstat (limited to 'wifi/java')
-rw-r--r--wifi/java/android/net/wifi/WifiNative.java43
-rw-r--r--wifi/java/android/net/wifi/WifiStateMachine.java3
2 files changed, 40 insertions, 6 deletions
diff --git a/wifi/java/android/net/wifi/WifiNative.java b/wifi/java/android/net/wifi/WifiNative.java
index b599054..f8eafde 100644
--- a/wifi/java/android/net/wifi/WifiNative.java
+++ b/wifi/java/android/net/wifi/WifiNative.java
@@ -19,6 +19,7 @@ package android.net.wifi;
import android.net.wifi.p2p.WifiP2pConfig;
import android.net.wifi.p2p.WifiP2pGroup;
import android.net.wifi.p2p.WifiP2pDevice;
+import android.os.SystemProperties;
import android.text.TextUtils;
import android.util.Log;
@@ -42,6 +43,8 @@ public class WifiNative {
static final int BLUETOOTH_COEXISTENCE_MODE_DISABLED = 1;
static final int BLUETOOTH_COEXISTENCE_MODE_SENSE = 2;
+ static String sDefaultInterface;
+
public native static boolean loadDriver();
public native static boolean isDriverLoaded();
@@ -56,21 +59,49 @@ public class WifiNative {
or when the supplicant is hung */
public native static boolean killSupplicant();
- public native static boolean connectToSupplicant();
+ public native static boolean connectToSupplicant(String iface);
- public native static void closeSupplicantConnection();
+ public native static void closeSupplicantConnection(String iface);
/**
* Wait for the supplicant to send an event, returning the event string.
* @return the event string sent by the supplicant.
*/
- public native static String waitForEvent();
+ public native static String waitForEvent(String iface);
+
+ private native static boolean doBooleanCommand(String iface, String command);
+
+ private native static int doIntCommand(String iface, String command);
+
+ private native static String doStringCommand(String iface, String command);
- private native static boolean doBooleanCommand(String command);
+ public static void setDefaultInterface(String iface) {
+ sDefaultInterface = iface;
+ }
+
+ public static boolean connectToSupplicant() {
+ return connectToSupplicant(sDefaultInterface);
+ }
- private native static int doIntCommand(String command);
+ public static void closeSupplicantConnection() {
+ closeSupplicantConnection(sDefaultInterface);
+ }
- private native static String doStringCommand(String command);
+ public static String waitForEvent() {
+ return waitForEvent(sDefaultInterface);
+ }
+
+ private static boolean doBooleanCommand(String command) {
+ return doBooleanCommand(sDefaultInterface, command);
+ }
+
+ private static int doIntCommand(String command) {
+ return doIntCommand(sDefaultInterface, command);
+ }
+
+ private static String doStringCommand(String command) {
+ return doStringCommand(sDefaultInterface, command);
+ }
public static boolean ping() {
String pong = doStringCommand("PING");
diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java
index 25bd8f7..1a85529 100644
--- a/wifi/java/android/net/wifi/WifiStateMachine.java
+++ b/wifi/java/android/net/wifi/WifiStateMachine.java
@@ -572,6 +572,9 @@ public class WifiStateMachine extends StateMachine {
mLastNetworkId = WifiConfiguration.INVALID_NETWORK_ID;
mLastSignalLevel = -1;
+ /* Set default interface for all primary socket communication */
+ WifiNative.setDefaultInterface(mInterfaceName);
+
mAlarmManager = (AlarmManager)mContext.getSystemService(Context.ALARM_SERVICE);
Intent scanIntent = new Intent(ACTION_START_SCAN, null);
mScanIntent = PendingIntent.getBroadcast(mContext, SCAN_REQUEST, scanIntent, 0);