summaryrefslogtreecommitdiffstats
path: root/wifi
diff options
context:
space:
mode:
authorIrfan Sheriff <isheriff@google.com>2012-05-24 17:16:50 -0700
committerIrfan Sheriff <isheriff@google.com>2012-05-25 12:52:34 -0700
commit9cb980422ac53b81d6ad15242b0de35b5f3ce13c (patch)
treec12c37ac323f17e65fab8b902e529425e5546b73 /wifi
parent4dd5a25a32dc4a721a411f92f0720672ee08020b (diff)
downloadframeworks_base-9cb980422ac53b81d6ad15242b0de35b5f3ce13c.zip
frameworks_base-9cb980422ac53b81d6ad15242b0de35b5f3ce13c.tar.gz
frameworks_base-9cb980422ac53b81d6ad15242b0de35b5f3ce13c.tar.bz2
Retain device during connecting state
With join taking much longer, sometimes device can be lost from supplicant. Retain device to complete connection. Also, clear up stale peer data after find stops during inactive state. Bug: 6557725 Change-Id: I15b92e50a837481f974034b1ea7b32c8abee969e
Diffstat (limited to 'wifi')
-rw-r--r--wifi/java/android/net/wifi/p2p/WifiP2pService.java28
1 files changed, 26 insertions, 2 deletions
diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pService.java b/wifi/java/android/net/wifi/p2p/WifiP2pService.java
index cc49cae..c800182 100644
--- a/wifi/java/android/net/wifi/p2p/WifiP2pService.java
+++ b/wifi/java/android/net/wifi/p2p/WifiP2pService.java
@@ -425,6 +425,12 @@ public class WifiP2pService extends IWifiP2pManager.Stub {
case WifiMonitor.NETWORK_DISCONNECTION_EVENT:
case WifiMonitor.SUPPLICANT_STATE_CHANGE_EVENT:
case WifiMonitor.P2P_GROUP_REMOVED_EVENT:
+ case WifiMonitor.P2P_DEVICE_FOUND_EVENT:
+ case WifiMonitor.P2P_DEVICE_LOST_EVENT:
+ case WifiMonitor.P2P_FIND_STOPPED_EVENT:
+ case WifiMonitor.P2P_SERV_DISC_RESP_EVENT:
+ case WifiStateMachine.CMD_ENABLE_P2P:
+ case WifiStateMachine.CMD_DISABLE_P2P:
case PEER_CONNECTION_USER_ACCEPT:
case PEER_CONNECTION_USER_REJECT:
case GROUP_CREATING_TIMED_OUT:
@@ -837,6 +843,13 @@ public class WifiP2pService extends IWifiP2pManager.Stub {
transitionTo(mUserAuthorizingInvitationState);
}
break;
+ case WifiMonitor.P2P_FIND_STOPPED_EVENT:
+ // When discovery stops in inactive state, flush to clear
+ // state peer data
+ mWifiNative.p2pFlush();
+ mServiceDiscReqId = null;
+ sendP2pDiscoveryChangedBroadcast(false);
+ break;
case WifiMonitor.P2P_PROV_DISC_PBC_REQ_EVENT:
case WifiMonitor.P2P_PROV_DISC_ENTER_PIN_EVENT:
case WifiMonitor.P2P_PROV_DISC_SHOW_PIN_EVENT:
@@ -873,6 +886,7 @@ public class WifiP2pService extends IWifiP2pManager.Stub {
@Override
public boolean processMessage(Message message) {
if (DBG) logd(getName() + message.toString());
+ boolean ret = HANDLED;
switch (message.what) {
case GROUP_CREATING_TIMED_OUT:
if (mGroupCreatingTimeoutIndex == message.arg1) {
@@ -881,6 +895,16 @@ public class WifiP2pService extends IWifiP2pManager.Stub {
transitionTo(mInactiveState);
}
break;
+ case WifiMonitor.P2P_DEVICE_LOST_EVENT:
+ WifiP2pDevice device = (WifiP2pDevice) message.obj;
+ if (!mSavedPeerConfig.deviceAddress.equals(device.deviceAddress)) {
+ // Do the regular device lost handling
+ ret = NOT_HANDLED;
+ break;
+ }
+ // Do nothing
+ if (DBG) logd("Retain connecting device " + device);
+ break;
case WifiP2pManager.DISCOVER_PEERS:
/* Discovery will break negotiation */
replyToMessage(message, WifiP2pManager.DISCOVER_PEERS_FAILED,
@@ -898,9 +922,9 @@ public class WifiP2pService extends IWifiP2pManager.Stub {
replyToMessage(message, WifiP2pManager.CANCEL_CONNECT_SUCCEEDED);
break;
default:
- return NOT_HANDLED;
+ ret = NOT_HANDLED;
}
- return HANDLED;
+ return ret;
}
}