p2p: Close the channel when onStop is called.
P2P dialog is moved to an indenpendent activity, it will push Settings to background and trigger onPause(). As P2P dialog is a Dialog Activity, it won't trigger onStop, but SoftAp and NAN activity will. Moving channel closing to onStop to adapt to new P2P dialog design. Bug: 219406778 Test: make RunSettingsRoboTests ROBOTEST_FILTER=WifiP2pSettingsTest create a p2p connection between 2 devices with this build. Change-Id: I2fab5aa1021ec1a993f811c7310079db9d7f03c0
This commit is contained in:
@@ -375,13 +375,20 @@ public class WifiP2pSettings extends DashboardFragment
|
||||
super.onPause();
|
||||
if (mWifiP2pManager != null && mChannel != null) {
|
||||
mWifiP2pManager.stopPeerDiscovery(mChannel, null);
|
||||
}
|
||||
getActivity().unregisterReceiver(mReceiver);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
if (mWifiP2pManager != null && mChannel != null) {
|
||||
if (!mLastGroupFormed) {
|
||||
// Close the channel when p2p doesn't connected.
|
||||
mChannel.close();
|
||||
mChannel = null;
|
||||
}
|
||||
}
|
||||
getActivity().unregisterReceiver(mReceiver);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user