diff options
author | Sanket Padawe <sanketpadawe@google.com> | 2015-05-01 16:55:00 -0700 |
---|---|---|
committer | Sanket Padawe <sanketpadawe@google.com> | 2015-05-01 16:55:00 -0700 |
commit | 7094d22022c8e0c6ad71920b101434dded8a276e (patch) | |
tree | b65b3dc819268c9d9f9eac4f8cf18cc4318dd0e7 /packages/SettingsLib/src | |
parent | 24ea865f0fd3b1ceafb3786bbed20ea345bc5cc0 (diff) | |
download | frameworks_base-7094d22022c8e0c6ad71920b101434dded8a276e.zip frameworks_base-7094d22022c8e0c6ad71920b101434dded8a276e.tar.gz frameworks_base-7094d22022c8e0c6ad71920b101434dded8a276e.tar.bz2 |
Adding "Connected, no Internet" string in Wifi nw summary.
Bug: 17380953
Change-Id: I9664bcbf33832fe722e7d2b3125939287ee98098
Diffstat (limited to 'packages/SettingsLib/src')
-rw-r--r-- | packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java b/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java index 2fde4f9..53e69e3 100644 --- a/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java +++ b/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java @@ -17,9 +17,13 @@ package com.android.settingslib.wifi; import android.content.Context; +import android.net.ConnectivityManager; +import android.net.Network; +import android.net.NetworkCapabilities; import android.net.NetworkInfo; import android.net.NetworkInfo.DetailedState; import android.net.NetworkInfo.State; +import android.net.wifi.IWifiManager; import android.net.wifi.ScanResult; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiConfiguration.KeyMgmt; @@ -27,6 +31,8 @@ import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; import android.os.Bundle; import android.text.TextUtils; +import android.os.RemoteException; +import android.os.ServiceManager; import android.util.Log; import android.util.LruCache; @@ -700,6 +706,25 @@ public class AccessPoint implements Comparable<AccessPoint> { } } + // Case when there is wifi connected without internet connectivity. + final ConnectivityManager cm = (ConnectivityManager) + context.getSystemService(Context.CONNECTIVITY_SERVICE); + if (state == DetailedState.CONNECTED) { + IWifiManager wifiManager = IWifiManager.Stub.asInterface( + ServiceManager.getService(Context.WIFI_SERVICE)); + Network nw; + + try { + nw = wifiManager.getCurrentNetwork(); + } catch (RemoteException e) { + nw = null; + } + NetworkCapabilities nc = cm.getNetworkCapabilities(nw); + if (nc != null && !nc.hasCapability(nc.NET_CAPABILITY_VALIDATED)) { + return context.getString(R.string.wifi_connected_no_internet); + } + } + String[] formats = context.getResources().getStringArray((ssid == null) ? R.array.wifi_status : R.array.wifi_status_with_ssid); int index = state.ordinal(); |