Skip to content

Commit bf310d1

Browse files
isheriffAndroid (Google) Code Review
authored andcommitted
Merge "Fix issues shown on CTS tests" into jb-mr1-dev
2 parents 1c8135a + 51aec5e commit bf310d1

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

wifi/java/android/net/wifi/p2p/WifiP2pService.java

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,7 +1079,21 @@ public boolean processMessage(Message message) {
10791079
// remain at this state.
10801080
}
10811081
break;
1082-
default:
1082+
case WifiMonitor.P2P_GROUP_STARTED_EVENT:
1083+
mGroup = (WifiP2pGroup) message.obj;
1084+
if (DBG) logd(getName() + " group started");
1085+
1086+
// We hit this scenario when a persistent group is reinvoked
1087+
if (mGroup.getNetworkId() == WifiP2pGroup.PERSISTENT_NET_ID) {
1088+
mAutonomousGroup = false;
1089+
deferMessage(message);
1090+
transitionTo(mGroupNegotiationState);
1091+
} else {
1092+
loge("Unexpected group creation, remove " + mGroup);
1093+
mWifiNative.p2pGroupRemove(mGroup.getInterface());
1094+
}
1095+
break;
1096+
default:
10831097
return NOT_HANDLED;
10841098
}
10851099
return HANDLED;
@@ -2338,6 +2352,10 @@ private void handleGroupRemoved() {
23382352
}
23392353
NetworkUtils.resetConnections(mGroup.getInterface(), NetworkUtils.RESET_ALL_ADDRESSES);
23402354

2355+
// Clear any timeout that was set. This is essential for devices
2356+
// that reuse the main p2p interface for a created group.
2357+
mWifiNative.setP2pGroupIdle(mGroup.getInterface(), 0);
2358+
23412359
mGroup = null;
23422360
mWifiNative.p2pFlush();
23432361
if (mPeers.remove(mPeersLostDuringConnection)) sendP2pPeersChangedBroadcast();
@@ -2349,7 +2367,7 @@ private void handleGroupRemoved() {
23492367
mWifiChannel.sendMessage(WifiP2pService.DISCONNECT_WIFI_REQUEST, 0);
23502368
mTempoarilyDisconnectedWifi = false;
23512369
}
2352-
}
2370+
}
23532371

23542372
//State machine initiated requests can have replyTo set to null indicating
23552373
//there are no recipients, we ignore those reply actions

0 commit comments

Comments
 (0)