diff options
author | Patrik Fimml <patrikf@google.com> | 2019-11-06 17:55:11 +0100 |
---|---|---|
committer | Patrik Fimml <patrikf@google.com> | 2019-11-08 15:13:57 +0100 |
commit | d8b3d7c285b24a1b1e22721631c7bdb3c31ef3e1 (patch) | |
tree | c96766211fec0fec299128f63668d3b7817d7db1 | |
parent | 9c3df4f21d38f55373ae8f1454368ad375e8ae33 (diff) |
Configurable SoftAP: Fix exclusivity logic.
mActiveConfig isn't cleared on shutdown; use the same conditions used in
other locations to determine if LOHS is active.
Bug: 132705022
Test: run twice in a row: atest android.net.wifi.cts.WifiManagerTest#testStartLocalOnlyHotspotWithConfig
Change-Id: Id93a34eb97727f69b20f69fbab998f7eed026bcf
-rw-r--r-- | service/java/com/android/server/wifi/WifiServiceImpl.java | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/service/java/com/android/server/wifi/WifiServiceImpl.java b/service/java/com/android/server/wifi/WifiServiceImpl.java index 9c85eb2c8..9b759dc11 100644 --- a/service/java/com/android/server/wifi/WifiServiceImpl.java +++ b/service/java/com/android/server/wifi/WifiServiceImpl.java @@ -1112,15 +1112,21 @@ public class WifiServiceImpl extends BaseWifiService { // Never accept exclusive requests (with custom configuration) at the same time as // shared requests. - if (mActiveConfig != null) { + if (!mLocalOnlyHotspotRequests.isEmpty()) { boolean requestIsExclusive = request.getCustomConfig() != null; if (mIsExclusive || requestIsExclusive) { + mLog.trace("Cannot share with existing LOHS request due to custom config") + .flush(); return LocalOnlyHotspotCallback.ERROR_GENERIC; } } - // If a local-only AP is already active, send the current config. - if (mLohsInterfaceMode == WifiManager.IFACE_IP_MODE_LOCAL_ONLY) { + // At this point, the request is accepted. + if (mLocalOnlyHotspotRequests.isEmpty()) { + startForFirstRequestLocked(request); + } else if (mLohsInterfaceMode == WifiManager.IFACE_IP_MODE_LOCAL_ONLY) { + // LOHS has already started up for an earlier request, so we can send the + // current config to the incoming request right away. try { mLog.trace("LOHS already up, trigger onStarted callback").flush(); request.sendHotspotStartedMessage(mActiveConfig.getWifiConfiguration()); @@ -1129,11 +1135,7 @@ public class WifiServiceImpl extends BaseWifiService { } } - if (mLocalOnlyHotspotRequests.isEmpty()) { - startForFirstRequestLocked(request); - } mLocalOnlyHotspotRequests.put(pid, request); - return LocalOnlyHotspotCallback.REQUEST_REGISTERED; } } |