Loading wifi/java/android/net/wifi/p2p/WifiP2pService.java +19 −11 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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; Loading Loading @@ -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())); Loading Loading @@ -1269,7 +1272,6 @@ 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; Loading @@ -1277,6 +1279,10 @@ public class WifiP2pService extends IWifiP2pManager.Stub { handleGroupCreationFailure(); transitionTo(mInactiveState); } } else { handleGroupCreationFailure(); transitionTo(mInactiveState); } break; default: return NOT_HANDLED; Loading Loading @@ -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; Loading @@ -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"); Loading Loading @@ -1821,9 +1829,9 @@ public class WifiP2pService extends IWifiP2pManager.Stub { isSaveRequired = true; } if (isSaveRequired) { sendP2pPersistentGroupsChangedBroadcast(); if (reload || isSaveRequired) { mWifiNative.saveConfig(); sendP2pPersistentGroupsChangedBroadcast(); } } Loading Loading @@ -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 } } Loading Loading @@ -2112,7 +2120,7 @@ public class WifiP2pService extends IWifiP2pManager.Stub { mServiceTransactionId = 0; mServiceDiscReqId = null; updatePersistentNetworks(); updatePersistentNetworks(RELOAD); } private void updateThisDevice(int status) { Loading Loading
wifi/java/android/net/wifi/p2p/WifiP2pService.java +19 −11 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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; Loading Loading @@ -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())); Loading Loading @@ -1269,7 +1272,6 @@ 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; Loading @@ -1277,6 +1279,10 @@ public class WifiP2pService extends IWifiP2pManager.Stub { handleGroupCreationFailure(); transitionTo(mInactiveState); } } else { handleGroupCreationFailure(); transitionTo(mInactiveState); } break; default: return NOT_HANDLED; Loading Loading @@ -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; Loading @@ -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"); Loading Loading @@ -1821,9 +1829,9 @@ public class WifiP2pService extends IWifiP2pManager.Stub { isSaveRequired = true; } if (isSaveRequired) { sendP2pPersistentGroupsChangedBroadcast(); if (reload || isSaveRequired) { mWifiNative.saveConfig(); sendP2pPersistentGroupsChangedBroadcast(); } } Loading Loading @@ -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 } } Loading Loading @@ -2112,7 +2120,7 @@ public class WifiP2pService extends IWifiP2pManager.Stub { mServiceTransactionId = 0; mServiceDiscReqId = null; updatePersistentNetworks(); updatePersistentNetworks(RELOAD); } private void updateThisDevice(int status) { Loading