summaryrefslogtreecommitdiffstats
path: root/libs/WifiTrackerLib/src
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2020-08-07 11:49:39 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-08-07 11:49:39 +0000
commit3b1a02c2069beee74324a89c41eed3054e904c79 (patch)
treee51b958dc9540b94052feee0d9fa6929c9a7e71f /libs/WifiTrackerLib/src
parente01612049a8309af263e9036a1e2bb05dd29a264 (diff)
parentc6cf047d1d9c1d7627790b48383bfd44c39cf75d (diff)
downloadframeworks_opt_net_wifi-3b1a02c2069beee74324a89c41eed3054e904c79.tar.gz
frameworks_opt_net_wifi-3b1a02c2069beee74324a89c41eed3054e904c79.tar.bz2
frameworks_opt_net_wifi-3b1a02c2069beee74324a89c41eed3054e904c79.zip
Merge "[WifiTrackerLib] Hide Connect button if there is no active SIM of the carrier ID" into rvc-qpr-dev am: c6cf047d1d
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/opt/net/wifi/+/12168004 Change-Id: Ie7fd586d8ae9e49d961e23a4fa8d9526dee5c5ee
Diffstat (limited to 'libs/WifiTrackerLib/src')
-rw-r--r--libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java34
1 files changed, 32 insertions, 2 deletions
diff --git a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java
index 19c2619bc..6fef5e961 100644
--- a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java
+++ b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java
@@ -54,6 +54,9 @@ import android.net.wifi.WifiManager;
import android.net.wifi.WifiNetworkScoreCache;
import android.os.Handler;
import android.os.SystemClock;
+import android.telephony.SubscriptionInfo;
+import android.telephony.SubscriptionManager;
+import android.telephony.TelephonyManager;
import android.text.TextUtils;
import androidx.annotation.GuardedBy;
@@ -357,8 +360,35 @@ public class StandardWifiEntry extends WifiEntry {
@Override
public boolean canConnect() {
- return mLevel != WIFI_LEVEL_UNREACHABLE
- && getConnectedState() == CONNECTED_STATE_DISCONNECTED;
+ if (mLevel == WIFI_LEVEL_UNREACHABLE
+ || getConnectedState() != CONNECTED_STATE_DISCONNECTED) {
+ return false;
+ }
+ // Allow connection for EAP SIM dependent methods if the SIM of specified carrier ID is
+ // active in the device.
+ if (getSecurity() == SECURITY_EAP && mWifiConfig != null
+ && mWifiConfig.enterpriseConfig != null) {
+ if (!mWifiConfig.enterpriseConfig.isAuthenticationSimBased()) {
+ return true;
+ }
+ List<SubscriptionInfo> activeSubscriptionInfos = ((SubscriptionManager) mContext
+ .getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE))
+ .getActiveSubscriptionInfoList();
+ if (activeSubscriptionInfos == null || activeSubscriptionInfos.size() == 0) {
+ return false;
+ }
+ if (mWifiConfig.carrierId == TelephonyManager.UNKNOWN_CARRIER_ID) {
+ // To connect via default subscription.
+ return true;
+ }
+ for (SubscriptionInfo subscriptionInfo : activeSubscriptionInfos) {
+ if (subscriptionInfo.getCarrierId() == mWifiConfig.carrierId) {
+ return true;
+ }
+ }
+ return false;
+ }
+ return true;
}
@Override