Display "Sign into network" in settings when on a captive portal.

am: 1317e049f5

Change-Id: I9d15780cb49e365da98e09ba0149a8d31df4373c
This commit is contained in:
Lorenzo Colitti
2016-12-14 04:59:47 +00:00
committed by android-build-merger

View File

@@ -805,16 +805,19 @@ public class AccessPoint implements Comparable<AccessPoint> {
if (state == DetailedState.CONNECTED) {
IWifiManager wifiManager = IWifiManager.Stub.asInterface(
ServiceManager.getService(Context.WIFI_SERVICE));
Network nw;
NetworkCapabilities nc = null;
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);
nc = cm.getNetworkCapabilities(wifiManager.getCurrentNetwork());
} catch (RemoteException e) {}
if (nc != null) {
if (nc.hasCapability(nc.NET_CAPABILITY_CAPTIVE_PORTAL)) {
return context.getString(
com.android.internal.R.string.network_available_sign_in);
} else if (!nc.hasCapability(NetworkCapabilities.NET_CAPABILITY_VALIDATED)) {
return context.getString(R.string.wifi_connected_no_internet);
}
}
}
if (state == null) {