From bb7edf7945cc575f4a42ac6820c3a4da3e0eaf49 Mon Sep 17 00:00:00 2001 From: Michael Plass Date: Fri, 10 May 2019 15:12:03 -0700 Subject: Do not disconnect wifi immediately due to no internet Setting DISABLED_NO_INTERNET_PERMANENT status does not need to disconnect. Bug: 130766237 Test: atest FrameworksWifiTests Change-Id: Ic8d04447044caf076d7981cf7254c3c016cb1d02 --- service/java/com/android/server/wifi/WifiConnectivityManager.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/service/java/com/android/server/wifi/WifiConnectivityManager.java b/service/java/com/android/server/wifi/WifiConnectivityManager.java index 7d34e405d..7411422e0 100644 --- a/service/java/com/android/server/wifi/WifiConnectivityManager.java +++ b/service/java/com/android/server/wifi/WifiConnectivityManager.java @@ -16,6 +16,7 @@ package com.android.server.wifi; +import static android.net.wifi.WifiConfiguration.NetworkSelectionStatus.DISABLED_NO_INTERNET_PERMANENT; import static android.net.wifi.WifiConfiguration.NetworkSelectionStatus.DISABLED_NO_INTERNET_TEMPORARY; import static com.android.internal.util.Preconditions.checkNotNull; @@ -565,6 +566,11 @@ public class WifiConnectivityManager { } @Override public void onSavedNetworkPermanentlyDisabled(int networkId, int disableReason) { + // For DISABLED_NO_INTERNET_PERMANENT we do not need to remove the network + // because supplicant won't be trying to reconnect. If this is due to a + // preventAutomaticReconnect request from ConnectivityService, that service + // will disconnect as appropriate. + if (disableReason == DISABLED_NO_INTERNET_PERMANENT) return; mConnectivityHelper.removeNetworkIfCurrent(networkId); updatePnoScan(); } -- cgit v1.2.3