Migrate to getNetworkSelectionStatus()
isNetworkEnabled() & isNetworkPermanentlyDisabled()
should not be formal APIs. Instead,
getNetworkSelectionStatus() with a set of constants
is sufficient as an API surface, and will be more
maintainable in the future.
Bug: 146046526
Test: atest WifiTrackerLibTests
Change-Id: Ib2986ba482b225be62466816af1e6417cd0d6136
diff --git a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java
index 44204cd..6bb1a7c 100644
--- a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java
+++ b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java
@@ -16,6 +16,8 @@
package com.android.wifitrackerlib;
+import static android.net.wifi.WifiConfiguration.NetworkSelectionStatus.NETWORK_SELECTION_ENABLED;
+import static android.net.wifi.WifiConfiguration.NetworkSelectionStatus.NETWORK_SELECTION_PERMANENTLY_DISABLED;
import static android.net.wifi.WifiInfo.sanitizeSsid;
import static androidx.core.util.Preconditions.checkNotNull;
@@ -281,10 +283,13 @@
private String getDisconnectedStateDescription() {
if (isSaved() && mWifiConfig.hasNoInternetAccess()) {
final int messageID =
- mWifiConfig.getNetworkSelectionStatus().isNetworkPermanentlyDisabled()
+ mWifiConfig.getNetworkSelectionStatus().getNetworkSelectionStatus()
+ == NETWORK_SELECTION_PERMANENTLY_DISABLED
? R.string.wifi_no_internet_no_reconnect : R.string.wifi_no_internet;
return mContext.getString(messageID);
- } else if (isSaved() && !mWifiConfig.getNetworkSelectionStatus().isNetworkEnabled()) {
+ } else if (isSaved()
+ && (mWifiConfig.getNetworkSelectionStatus().getNetworkSelectionStatus()
+ != NETWORK_SELECTION_ENABLED)) {
final WifiConfiguration.NetworkSelectionStatus networkStatus =
mWifiConfig.getNetworkSelectionStatus();
switch (networkStatus.getNetworkSelectionDisableReason()) {