Only one channel is reserved for WifiP2pSettings

Every time we enter WifiP2pSettings, a channel will be created,
but we should keep only one channel if p2p connected.

Bug: 259364357

Change-Id: Ie3c1b1281d74332cd5df720fb13476097f3f5df9
Merged-In: I999b108bc3e3c22519398a55b503078c1069cef1
Signed-off-by: DingFei Song <v-dingfeisong@xiaomi.corp-partner.google.com>
This commit is contained in:
DingFei Song
2022-11-21 18:37:58 +08:00
committed by Quang Luong
parent 8ae657bd80
commit 42ee738f1b
2 changed files with 34 additions and 34 deletions

View File

@@ -336,7 +336,7 @@ public class WifiP2pSettingsTest {
public void onStop_notLastGroupFormed_shouldCloseChannel() {
mFragment.onStop();
assertThat(mFragment.mChannel).isNull();
assertThat(mFragment.sChannel).isNull();
}
@Test
@@ -353,7 +353,7 @@ public class WifiP2pSettingsTest {
verify(mWifiP2pManager, times(1)).stopPeerDiscovery(any(), any());
mFragment.onResume();
assertThat(mFragment.mChannel).isNotNull();
assertThat(mFragment.sChannel).isNotNull();
}
@Test
@@ -524,7 +524,7 @@ public class WifiP2pSettingsTest {
@Test
public void onCreateView_withNullP2pManager_shouldGetP2pManagerAgain() {
mFragment.mChannel = null; // Reset channel to re-test onCreateView flow
mFragment.sChannel = null; // Reset channel to re-test onCreateView flow
mFragment.mWifiP2pManager = null;
mFragment.onCreateView(LayoutInflater.from(mContext), null, new Bundle());
@@ -535,7 +535,7 @@ public class WifiP2pSettingsTest {
@Test
public void onCreateView_withNullChannel_shouldSetP2pManagerNull() {
doReturn(null).when(mWifiP2pManager).initialize(any(), any(), any());
mFragment.mChannel = null; // Reset channel to re-test onCreateView flow
mFragment.sChannel = null; // Reset channel to re-test onCreateView flow
mFragment.onCreateView(LayoutInflater.from(mContext), null, new Bundle());
assertThat(mFragment.mWifiP2pManager).isNull();