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

Commit 68457bfc authored by Lorenzo Colitti's avatar Lorenzo Colitti Committed by android-build-merger
Browse files

Display "Sign into network" in settings when on a captive portal. am: 1317e049

am: 38938279

Change-Id: I3f836ff459850e48def89be69b6c7cda4986907b
parents 4539fb18 38938279
Loading
Loading
Loading
Loading
+11 −8
Original line number Diff line number Diff line
@@ -839,18 +839,21 @@ 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)) {
                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) {
            Log.w(TAG, "state is null, returning empty summary");
            return "";