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

Commit e76e4323 authored by Paul Jensen's avatar Paul Jensen
Browse files

Add captive portal sign-in actions.

Change-Id: I70a6c2efc4f3fa48d5b65e8d630682fe74abfe2c
parent be55c0d2
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -16285,6 +16285,11 @@ package android.net {
    field public static final java.lang.String EXTRA_NO_CONNECTIVITY = "noConnectivity";
    field public static final java.lang.String EXTRA_OTHER_NETWORK_INFO = "otherNetwork";
    field public static final java.lang.String EXTRA_REASON = "reason";
    field public static final java.lang.String ACTION_CAPTIVE_PORTAL_DETECTED = "android.net.conn.CAPTIVE_PORTAL_DETECTED";
    field public static final java.lang.String ACTION_CAPTIVE_PORTAL_SIGN_IN = "android.net.conn.CAPTIVE_PORTAL_SIGN_IN";
    field public static final java.lang.String EXTRA_NETWORK = "network";
    field public static final int CAPTIVE_PORTAL_SIGNED_IN = 1;
    field public static final int CAPTIVE_PORTAL_DISCONNECT = 2;
    field public static final int TYPE_BLUETOOTH = 7; // 0x7
    field public static final int TYPE_DUMMY = 8; // 0x8
    field public static final int TYPE_ETHERNET = 9; // 0x9
+92 −0
Original line number Diff line number Diff line
@@ -283,6 +283,98 @@ public class ConnectivityManager {
     */
    public static final String EXTRA_IS_CAPTIVE_PORTAL = "captivePortal";

    /**
     * Broadcast Action: A connection has been established to a new network
     * but a captive portal has been detected preventing internet connectivity.
     * This broadcast is sent out prior to providing the user with a
     * notification allowing them to sign into the network, as such it should
     * only be used by apps that can automatically and silently (without user
     * interaction) log into specific captive portals.  It should not be used
     * by apps that prompt the user to sign in, as the user has not yet
     * indicated they want to proceed with signing in.
     * The new network is not the default network so it can only be accessed via
     * the {@link Network} extra {@link #EXTRA_NETWORK}.
     * This is an ordered broadcast and so it is perfectly acceptable for
     * multiple receivers to in turn consider whether they are best suited to
     * address the captive portal.
     * A receiver should abort the broadcast if they are sure they are the
     * appropriate handler of the captive portal.  If the broadcast is aborted,
     * the result code must be set to one of the following:
     * <ul>
     *   <li>{@link #CAPTIVE_PORTAL_SIGNED_IN} The receiver has signed into the
     *       captive portal.  After being verified to provide internet
     *       connectivity, this network will be made the default (assuming
     *       it is preferred over all other active networks).
     *   </li>
     *   <li>{@link #CAPTIVE_PORTAL_DISCONNECT} The receiver is familiar with
     *       this captive portal and knows sign-in is impossible or the user
     *       has indicated they do not want to pursue sign-in.  No other apps
     *       will be given the option of signing in to the network.
     *   </li>
     * </ul>
     */
    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
    public static final String ACTION_CAPTIVE_PORTAL_DETECTED =
            "android.net.conn.CAPTIVE_PORTAL_DETECTED";

    /**
     * Broadcast Action: A connection has been established to a new network,
     * a captive portal has been detected preventing internet connectivity,
     * the user was notified, and elected to sign into the captive portal.
     * It may be used by apps that prompt the user to sign in.
     * The new network is not the default network so it can only be accessed via
     * the {@link Network} extra {@link #EXTRA_NETWORK}.
     * This is an ordered broadcast and so it is perfectly acceptable for
     * multiple receivers to in turn consider whether they are best suited to
     * address the captive portal.
     * A receiver should abort the broadcast if they are sure they are the
     * appropriate handler of the captive portal.  If the broadcast is aborted,
     * the result code must be set to one of the following:
     * <ul>
     *   <li>{@link #CAPTIVE_PORTAL_SIGNED_IN} The receiver has signed into the
     *       captive portal.  After being verified to provide internet
     *       connectivity, this network will be made the default (assuming
     *       it is preferred over all other active networks).
     *   </li>
     *   <li>{@link #CAPTIVE_PORTAL_DISCONNECT} The user has indicated they do
     *       not want to pursue sign-in.  No other apps will be given the
     *       option of signing in to the network.
     *   </li>
     * </ul>
     */
    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
    public static final String ACTION_CAPTIVE_PORTAL_SIGN_IN =
            "android.net.conn.CAPTIVE_PORTAL_SIGN_IN";

    /**
     * The lookup key for a {@link Network} object passed along with a
     * {@link #ACTION_CAPTIVE_PORTAL_DETECTED} or
     * {@link #ACTION_CAPTIVE_PORTAL_SIGN_IN} intent.  This network is not the
     * default network and must be accessed using this {@link Nework} object.
     * Retrieve with {@link android.content.Intent#getParcelableExtra(String)}.
     */
    public static final String EXTRA_NETWORK = "network";

    /**
     * Specified as a result code of a {@link #ACTION_CAPTIVE_PORTAL_DETECTED} or
     * {@link #ACTION_CAPTIVE_PORTAL_SIGN_IN} receiver to indicate
     * the receiver has signed into the
     * captive portal.  After being verified to provide internet
     * connectivity, this network will be made the default (assuming
     * it is preferred over all other active networks).
     */
    public static final int CAPTIVE_PORTAL_SIGNED_IN = 1;

    /**
     * Specified as a result code of a {@link #ACTION_CAPTIVE_PORTAL_DETECTED} or
     * {@link #ACTION_CAPTIVE_PORTAL_SIGN_IN} receiver to indicate
     * the receiver is familiar with
     * this captive portal and knows sign-in is impossible or the user
     * has indicated they do not want to pursue sign-in.  No other apps will
     * be given the option of signing in to the network.
     */
    public static final int CAPTIVE_PORTAL_DISCONNECT = 2;

    /**
     * The absence of a connection type.
     * @hide