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

Commit 89d16f75 authored by Wink Saville's avatar Wink Saville Committed by Android Git Automerger
Browse files

am 9b7b4450: am 02eab434: am 4d87d91d: Merge "If in a mobile captive portal is...

am 9b7b4450: am 02eab434: am 4d87d91d: Merge "If in a mobile captive portal is detected enable fail fast." into jb-mr2-dev

* commit '9b7b4450':
  If in a mobile captive portal is detected enable fail fast.
parents 292a92e3 9b7b4450
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -152,6 +152,11 @@ public class BluetoothTetheringDataTracker implements NetworkStateTracker {
        // not implemented
    }

    @Override
    public void captivePortalCheckCompleted(boolean isCaptivePortal) {
        // not implemented
    }

    /**
     * Re-enable connectivity to a network after a {@link #teardown()}.
     */
+5 −0
Original line number Diff line number Diff line
@@ -101,6 +101,11 @@ public abstract class BaseNetworkStateTracker implements NetworkStateTracker {
        // not implemented
    }

    @Override
    public void captivePortalCheckCompleted(boolean isCaptivePortal) {
        // not implemented
    }

    @Override
    public boolean setRadio(boolean turnOn) {
        // Base tracker doesn't handle radios
+15 −0
Original line number Diff line number Diff line
@@ -303,6 +303,7 @@ public class CaptivePortalTracker extends StateMachine {
                        } else {
                            if (DBG) log("Not captive network " + mNetworkInfo);
                        }
                        notifyPortalCheckCompleted(mNetworkInfo, captive);
                        if (mDeviceProvisioned) {
                            if (captive) {
                                // Setup Wizard will assist the user in connecting to a captive
@@ -333,12 +334,26 @@ public class CaptivePortalTracker extends StateMachine {
            return;
        }
        try {
            if (DBG) log("notifyPortalCheckComplete: ni=" + info);
            mConnService.captivePortalCheckComplete(info);
        } catch(RemoteException e) {
            e.printStackTrace();
        }
    }

    private void notifyPortalCheckCompleted(NetworkInfo info, boolean isCaptivePortal) {
        if (info == null) {
            loge("notifyPortalCheckComplete on null");
            return;
        }
        try {
            if (DBG) log("notifyPortalCheckCompleted: captive=" + isCaptivePortal + " ni=" + info);
            mConnService.captivePortalCheckCompleted(info, isCaptivePortal);
        } catch(RemoteException e) {
            e.printStackTrace();
        }
    }

    private boolean isActiveNetwork(NetworkInfo info) {
        try {
            NetworkInfo active = mConnService.getActiveNetworkInfo();
+19 −0
Original line number Diff line number Diff line
@@ -1323,6 +1323,25 @@ public class ConnectivityManager {
        }
    }

    /**
     * Signal that the captive portal check on the indicated network
     * is complete and whether its a captive portal or not.
     *
     * @param info the {@link NetworkInfo} object for the networkType
     *        in question.
     * @param isCaptivePortal true/false.
     *
     * <p>This method requires the call to hold the permission
     * {@link android.Manifest.permission#CONNECTIVITY_INTERNAL}.
     * {@hide}
     */
    public void captivePortalCheckCompleted(NetworkInfo info, boolean isCaptivePortal) {
        try {
            mService.captivePortalCheckCompleted(info, isCaptivePortal);
        } catch (RemoteException e) {
        }
    }

    /**
     * Supply the backend messenger for a network tracker
     *
+6 −0
Original line number Diff line number Diff line
@@ -120,10 +120,16 @@ public class DummyDataStateTracker implements NetworkStateTracker {
        return true;
    }

    @Override
    public void captivePortalCheckComplete() {
        // not implemented
    }

    @Override
    public void captivePortalCheckCompleted(boolean isCaptivePortal) {
        // not implemented
    }

    /**
     * Record the detailed state of a network, and if it is a
     * change from the previous state, send a notification to
Loading