Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5625d486 authored by Lorenzo Colitti's avatar Lorenzo Colitti Committed by Android (Google) Code Review
Browse files

Merge "Display "Sign into network" in settings when on a captive portal." into nyc-mr2-dev

parents 3a39fe6b 1317e049
Loading
Loading
Loading
Loading
+11 −8
Original line number Original line Diff line number Diff line
@@ -790,18 +790,21 @@ public class AccessPoint implements Comparable<AccessPoint> {
        if (state == DetailedState.CONNECTED) {
        if (state == DetailedState.CONNECTED) {
            IWifiManager wifiManager = IWifiManager.Stub.asInterface(
            IWifiManager wifiManager = IWifiManager.Stub.asInterface(
                    ServiceManager.getService(Context.WIFI_SERVICE));
                    ServiceManager.getService(Context.WIFI_SERVICE));
            Network nw;
            NetworkCapabilities nc = null;


            try {
            try {
                nw = wifiManager.getCurrentNetwork();
                nc = cm.getNetworkCapabilities(wifiManager.getCurrentNetwork());
            } catch (RemoteException e) {
            } catch (RemoteException e) {}
                nw = null;

            }
            if (nc != null) {
            NetworkCapabilities nc = cm.getNetworkCapabilities(nw);
                if (nc.hasCapability(nc.NET_CAPABILITY_CAPTIVE_PORTAL)) {
            if (nc != null && !nc.hasCapability(nc.NET_CAPABILITY_VALIDATED)) {
                    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);
                    return context.getString(R.string.wifi_connected_no_internet);
                }
                }
            }
            }
        }
        if (state == null) {
        if (state == null) {
            Log.w(TAG, "state is null, returning empty summary");
            Log.w(TAG, "state is null, returning empty summary");
            return "";
            return "";