From ccfd0e3566181b97b06456c90a5fe2b715bb2c64 Mon Sep 17 00:00:00 2001 From: markchien Date: Fri, 19 Jul 2019 17:28:04 +0800 Subject: [PATCH] Fix the race between entitlement start/stop For very quickly hotspot OFF/ON, there is race between tethering start entitlement from Settings and stop entitlement from wifi's intent broadcast. Entitlement would only be started when Settings call #startTethering(). But there are two points that tethering would stop entitlement. One is #stopTethering() from Settings. Another one is wifi tell tethering that it is shuting down. In this change, second point of stop entitlement is removed to avoid this race problem. Entitlement may have chance that do not be stopped (e.g. network reset). This is not great but the behavior is the same as P. TODO: Don't reply on caller to stop entitlement. Refactor the design to call #stopProvisioningIfNeeded when IpServer leaving TETHERED state. TODO: mWifiTetherRequested may also suffer this race condition. Bug: 137034691 Test: -build, flash, boot -atest FrameworkNetTests -Enable hotspot with entitlement supported SIM, then changing the AP band. Change-Id: I63f858356b4543b5bdda41d03e45adc944b86da3 Merged-In: I63f858356b4543b5bdda41d03e45adc944b86da3 --- .../core/java/com/android/server/connectivity/Tethering.java | 1 - 1 file changed, 1 deletion(-) diff --git a/services/core/java/com/android/server/connectivity/Tethering.java b/services/core/java/com/android/server/connectivity/Tethering.java index 4957eed21c70e..73d160d8c444b 100644 --- a/services/core/java/com/android/server/connectivity/Tethering.java +++ b/services/core/java/com/android/server/connectivity/Tethering.java @@ -772,7 +772,6 @@ public class Tethering extends BaseNetworkObserver { case WifiManager.WIFI_AP_STATE_FAILED: default: disableWifiIpServingLocked(ifname, curState); - mEntitlementMgr.stopProvisioningIfNeeded(TETHERING_WIFI); break; } }