Prevent hotspot from being affected by the wifi retention feature
To prevent WiFi-to-WiFi interruption while entering APM:
- If WiFi is retained while entering APM, hotspot will also remain enabled.
- If WiFi is off before APM or disabled while entering APM, hotspot will be disabled.
To make sure hotspot always be disabled while entering APM, disable wifi before enable hotspot.
Bug: 278150162
Test: 1. turn on wifi while airplan mode on, then turn off airplan mode
2. atest ConnectivityManagerTest#testFactoryReset
(cherry picked from https://android-review.googlesource.com/q/commit:8f49a826ad4a0ff1ae57c394eeb89e086d09b4aa)
Merged-In: Ic48ba63deab02683280543516228104be928a6a2
Change-Id: Ic48ba63deab02683280543516228104be928a6a2
This commit is contained in:
committed by
Cherrypicker Worker
parent
b7a509ee94
commit
b4310e6934
@@ -2552,6 +2552,14 @@ public class ConnectivityManagerTest {
|
||||
tetherUtils.registerTetheringEventCallback();
|
||||
try {
|
||||
tetherEventCallback.assumeWifiTetheringSupported(mContext);
|
||||
// To prevent WiFi-to-WiFi interruption while entering APM:
|
||||
// - If WiFi is retained while entering APM, hotspot will also remain enabled.
|
||||
// - If WiFi is off before APM or disabled while entering APM, hotspot will be
|
||||
// disabled.
|
||||
//
|
||||
// To ensure hotspot always be disabled after enabling APM, disable wifi before
|
||||
// enabling the hotspot.
|
||||
mCtsNetUtils.disableWifi();
|
||||
|
||||
tetherUtils.startWifiTethering(tetherEventCallback);
|
||||
// Update setting to verify the behavior.
|
||||
@@ -2585,6 +2593,7 @@ public class ConnectivityManagerTest {
|
||||
ConnectivitySettingsManager.setPrivateDnsMode(mContext, curPrivateDnsMode);
|
||||
tetherUtils.unregisterTetheringEventCallback(tetherEventCallback);
|
||||
tetherUtils.stopAllTethering();
|
||||
mCtsNetUtils.ensureWifiConnected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user