summaryrefslogtreecommitdiffstats
path: root/wifi
diff options
context:
space:
mode:
authorIrfan Sheriff <isheriff@google.com>2011-11-30 17:20:47 -0800
committerIrfan Sheriff <isheriff@google.com>2011-11-30 17:22:30 -0800
commit530040e0b9458994c02f4392765db168128d48da (patch)
treeac6b6d645963dd19c5ff54a402df90ff6c2a303a /wifi
parent618455f7e7255019c8cc08a734ba7c52b67a7dc8 (diff)
downloadframeworks_base-530040e0b9458994c02f4392765db168128d48da.zip
frameworks_base-530040e0b9458994c02f4392765db168128d48da.tar.gz
frameworks_base-530040e0b9458994c02f4392765db168128d48da.tar.bz2
p2p enhancements
- Add device name on SSID for legacy devices to discover a given group and join - Do not remove a group for a device lost event which only indicates discovery is stopped Change-Id: Id431c29da371986e694ab230d72d32061b209ebe
Diffstat (limited to 'wifi')
-rw-r--r--wifi/java/android/net/wifi/WifiNative.java4
-rw-r--r--wifi/java/android/net/wifi/p2p/WifiP2pGroup.java6
-rw-r--r--wifi/java/android/net/wifi/p2p/WifiP2pService.java17
3 files changed, 18 insertions, 9 deletions
diff --git a/wifi/java/android/net/wifi/WifiNative.java b/wifi/java/android/net/wifi/WifiNative.java
index 65caa51..0fc0a45 100644
--- a/wifi/java/android/net/wifi/WifiNative.java
+++ b/wifi/java/android/net/wifi/WifiNative.java
@@ -239,6 +239,10 @@ public class WifiNative {
return WifiNative.doBooleanCommand("SET config_methods " + cfg);
}
+ public static boolean setP2pSsidPostfix(String postfix) {
+ return WifiNative.doBooleanCommand("SET p2p_ssid_postfix " + postfix);
+ }
+
public static boolean p2pFind() {
return doBooleanCommand("P2P_FIND");
}
diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pGroup.java b/wifi/java/android/net/wifi/p2p/WifiP2pGroup.java
index 9473993..e141aba 100644
--- a/wifi/java/android/net/wifi/p2p/WifiP2pGroup.java
+++ b/wifi/java/android/net/wifi/p2p/WifiP2pGroup.java
@@ -172,6 +172,12 @@ public class WifiP2pGroup implements Parcelable {
return mClients.size() == 0;
}
+ /** @hide Returns {@code true} if the device is part of the group */
+ public boolean contains(WifiP2pDevice device) {
+ if (mOwner.equals(device) || mClients.contains(device)) return true;
+ return false;
+ }
+
/** Get the list of clients currently part of the p2p group */
public Collection<WifiP2pDevice> getClientList() {
return Collections.unmodifiableCollection(mClients);
diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pService.java b/wifi/java/android/net/wifi/p2p/WifiP2pService.java
index f7e79b3..dc110e3 100644
--- a/wifi/java/android/net/wifi/p2p/WifiP2pService.java
+++ b/wifi/java/android/net/wifi/p2p/WifiP2pService.java
@@ -1088,16 +1088,13 @@ public class WifiP2pService extends IWifiP2pManager.Stub {
break;
case WifiMonitor.P2P_DEVICE_LOST_EVENT:
WifiP2pDevice device = (WifiP2pDevice) message.obj;
- if (device.equals(mGroup.getOwner())) {
- logd("Lost the group owner, killing p2p connection");
- WifiNative.p2pGroupRemove(mGroup.getInterface());
- } else if (mGroup.removeClient(device)) {
- if (!mPersistGroup && mGroup.isClientListEmpty()) {
- Slog.d(TAG, "Client list empty, removing a non-persistent p2p group");
- WifiNative.p2pGroupRemove(mGroup.getInterface());
- }
+ //Device loss for a connected device indicates it is not in discovery any more
+ if (mGroup.contains(device)) {
+ if (DBG) logd("Lost " + device +" , do nothing");
+ return HANDLED;
}
- return NOT_HANDLED; // Do the regular device lost handling
+ // Do the regular device lost handling
+ return NOT_HANDLED;
case WifiP2pManager.DISABLE_P2P:
sendMessage(WifiP2pManager.REMOVE_GROUP);
deferMessage(message);
@@ -1401,6 +1398,8 @@ public class WifiP2pService extends IWifiP2pManager.Stub {
private void initializeP2pSettings() {
WifiNative.setPersistentReconnect(true);
WifiNative.setDeviceName(mThisDevice.deviceName);
+ //DIRECT-XY-DEVICENAME (XY is randomly generated)
+ WifiNative.setP2pSsidPostfix("-" + mThisDevice.deviceName);
WifiNative.setDeviceType(mThisDevice.primaryDeviceType);
//The supplicant default is to support everything, but a bug necessitates
//the framework to specify this explicitly