summaryrefslogtreecommitdiffstats
path: root/wifi
diff options
context:
space:
mode:
authorIrfan Sheriff <isheriff@google.com>2012-09-27 17:01:41 -0700
committerIrfan Sheriff <isheriff@google.com>2012-09-27 17:17:24 -0700
commitca1269fcb8265c36660b3b47e5c06180e94e6485 (patch)
tree26f524073b826aaf28d2ad0a9c2f9d68435d6b4a /wifi
parentd9730390c6bbac09107866462b9bf45d0b5706cf (diff)
downloadframeworks_base-ca1269fcb8265c36660b3b47e5c06180e94e6485.zip
frameworks_base-ca1269fcb8265c36660b3b47e5c06180e94e6485.tar.gz
frameworks_base-ca1269fcb8265c36660b3b47e5c06180e94e6485.tar.bz2
Fail fast on persistent failure
Other fixes - 20s idle time out was added a work around for an earlier cavium issue. Reduce to 10s - Reload network fix when supplicant issues an error for a persistent network Bug: 7248890 Change-Id: I6cea7c88c75aaca40ddcb973404e93ec0f66cbc4
Diffstat (limited to 'wifi')
-rw-r--r--wifi/java/android/net/wifi/p2p/WifiP2pService.java30
1 files changed, 19 insertions, 11 deletions
diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pService.java b/wifi/java/android/net/wifi/p2p/WifiP2pService.java
index 8670650..2e6aa88 100644
--- a/wifi/java/android/net/wifi/p2p/WifiP2pService.java
+++ b/wifi/java/android/net/wifi/p2p/WifiP2pService.java
@@ -123,6 +123,9 @@ public class WifiP2pService extends IWifiP2pManager.Stub {
private static final Boolean TRY_REINVOCATION = true;;
private static final Boolean NO_REINVOCATION = false;
+ private static final Boolean RELOAD = true;
+ private static final Boolean NO_RELOAD = false;
+
private static final int CONNECT_FAILURE = -1;
private static final int CONNECT_SUCCESS = 0;
private static final int NEEDS_PROVISION_REQ = 1;
@@ -135,7 +138,7 @@ public class WifiP2pService extends IWifiP2pManager.Stub {
private static final int DISCOVER_TIMEOUT_S = 120;
/* Idle time after a peer is gone when the group is torn down */
- private static final int GROUP_IDLE_TIME_S = 20;
+ private static final int GROUP_IDLE_TIME_S = 10;
private static final int BASE = Protocol.BASE_WIFI_P2P_SERVICE;
@@ -1222,7 +1225,7 @@ public class WifiP2pService extends IWifiP2pManager.Stub {
/*
* update cache information and set network id to mGroup.
*/
- updatePersistentNetworks();
+ updatePersistentNetworks(NO_RELOAD);
String devAddr = mGroup.getOwner().deviceAddress;
mGroup.setNetworkId(mGroups.getNetworkId(devAddr,
mGroup.getNetworkName()));
@@ -1269,11 +1272,14 @@ public class WifiP2pService extends IWifiP2pManager.Stub {
if (DBG) logd("Remove unknown client from the list");
removeClientFromList(netId, mSavedPeerConfig.deviceAddress, true);
}
- }
- // invocation is failed or deferred. Try another way to connect.
- mSavedPeerConfig.netId = WifiP2pGroup.PERSISTENT_NET_ID;
- if (connect(mSavedPeerConfig, NO_REINVOCATION) == CONNECT_FAILURE) {
+ // invocation is failed or deferred. Try another way to connect.
+ mSavedPeerConfig.netId = WifiP2pGroup.PERSISTENT_NET_ID;
+ if (connect(mSavedPeerConfig, NO_REINVOCATION) == CONNECT_FAILURE) {
+ handleGroupCreationFailure();
+ transitionTo(mInactiveState);
+ }
+ } else {
handleGroupCreationFailure();
transitionTo(mInactiveState);
}
@@ -1759,7 +1765,7 @@ public class WifiP2pService extends IWifiP2pManager.Stub {
* Synchronize the persistent group list between
* wpa_supplicant and mGroups.
*/
- private void updatePersistentNetworks() {
+ private void updatePersistentNetworks(boolean reload) {
String listStr = mWifiNative.listNetworks();
if (listStr == null) return;
@@ -1767,6 +1773,8 @@ public class WifiP2pService extends IWifiP2pManager.Stub {
String[] lines = listStr.split("\n");
if (lines == null) return;
+ if (reload) mGroups.clear();
+
// Skip the first line, which is a header
for (int i = 1; i < lines.length; i++) {
String[] result = lines[i].split("\t");
@@ -1821,9 +1829,9 @@ public class WifiP2pService extends IWifiP2pManager.Stub {
isSaveRequired = true;
}
- if (isSaveRequired) {
- sendP2pPersistentGroupsChangedBroadcast();
+ if (reload || isSaveRequired) {
mWifiNative.saveConfig();
+ sendP2pPersistentGroupsChangedBroadcast();
}
}
@@ -1900,7 +1908,7 @@ public class WifiP2pService extends IWifiP2pManager.Stub {
return CONNECT_SUCCESS;
} else {
loge("p2pReinvoke() failed, update networks");
- updatePersistentNetworks();
+ updatePersistentNetworks(RELOAD);
// continue with negotiation
}
}
@@ -2112,7 +2120,7 @@ public class WifiP2pService extends IWifiP2pManager.Stub {
mServiceTransactionId = 0;
mServiceDiscReqId = null;
- updatePersistentNetworks();
+ updatePersistentNetworks(RELOAD);
}
private void updateThisDevice(int status) {