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

Commit 6cf91d15 authored by Lucas Lin's avatar Lucas Lin Committed by android-build-merger
Browse files

Merge "Check if network has partial connectivity"

am: 174ae058

Change-Id: I3e94029fe067a1a22acc640a0df6a87720572b94
parents 9b820621 174ae058
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -3193,6 +3193,7 @@ package android.net {
    method public int[] getTransportTypes();
    method public boolean satisfiedByNetworkCapabilities(android.net.NetworkCapabilities);
    field public static final int NET_CAPABILITY_OEM_PAID = 22; // 0x16
    field public static final int NET_CAPABILITY_PARTIAL_CONNECTIVITY = 24; // 0x18
  }
  public class NetworkKey implements android.os.Parcelable {
@@ -3341,10 +3342,12 @@ package android.net.captiveportal {
    ctor public CaptivePortalProbeResult(int, String, String);
    ctor public CaptivePortalProbeResult(int, String, String, android.net.captiveportal.CaptivePortalProbeSpec);
    method public boolean isFailed();
    method public boolean isPartialConnectivity();
    method public boolean isPortal();
    method public boolean isSuccessful();
    field public static final android.net.captiveportal.CaptivePortalProbeResult FAILED;
    field public static final int FAILED_CODE = 599; // 0x257
    field public static final android.net.captiveportal.CaptivePortalProbeResult PARTIAL;
    field public static final int PORTAL_CODE = 302; // 0x12e
    field public static final android.net.captiveportal.CaptivePortalProbeResult SUCCESS;
    field public static final int SUCCESS_CODE = 204; // 0xcc
@@ -3476,6 +3479,7 @@ package android.net.metrics {
    field public static final int NETWORK_FIRST_VALIDATION_PORTAL_FOUND = 10; // 0xa
    field public static final int NETWORK_FIRST_VALIDATION_SUCCESS = 8; // 0x8
    field public static final int NETWORK_LINGER = 5; // 0x5
    field public static final int NETWORK_PARTIAL_CONNECTIVITY = 13; // 0xd
    field public static final int NETWORK_REVALIDATION_PORTAL_FOUND = 11; // 0xb
    field public static final int NETWORK_REVALIDATION_SUCCESS = 9; // 0x9
    field public static final int NETWORK_UNLINGER = 6; // 0x6
+3 −0
Original line number Diff line number Diff line
@@ -751,10 +751,12 @@ package android.net.captiveportal {
    ctor public CaptivePortalProbeResult(int, String, String);
    ctor public CaptivePortalProbeResult(int, String, String, android.net.captiveportal.CaptivePortalProbeSpec);
    method public boolean isFailed();
    method public boolean isPartialConnectivity();
    method public boolean isPortal();
    method public boolean isSuccessful();
    field public static final android.net.captiveportal.CaptivePortalProbeResult FAILED;
    field public static final int FAILED_CODE = 599; // 0x257
    field public static final android.net.captiveportal.CaptivePortalProbeResult PARTIAL;
    field public static final int PORTAL_CODE = 302; // 0x12e
    field public static final android.net.captiveportal.CaptivePortalProbeResult SUCCESS;
    field public static final int SUCCESS_CODE = 204; // 0xcc
@@ -886,6 +888,7 @@ package android.net.metrics {
    field public static final int NETWORK_FIRST_VALIDATION_PORTAL_FOUND = 10; // 0xa
    field public static final int NETWORK_FIRST_VALIDATION_SUCCESS = 8; // 0x8
    field public static final int NETWORK_LINGER = 5; // 0x5
    field public static final int NETWORK_PARTIAL_CONNECTIVITY = 13; // 0xd
    field public static final int NETWORK_REVALIDATION_PORTAL_FOUND = 11; // 0xb
    field public static final int NETWORK_REVALIDATION_SUCCESS = 9; // 0x9
    field public static final int NETWORK_UNLINGER = 6; // 0x6
+35 −2
Original line number Diff line number Diff line
@@ -426,6 +426,16 @@ public class ConnectivityManager {
    public static final String ACTION_PROMPT_LOST_VALIDATION =
            "android.net.conn.PROMPT_LOST_VALIDATION";

    /**
     * Action used to display a dialog that asks the user whether to stay connected to a network
     * that has not validated. This intent is used to start the dialog in settings via
     * startActivity.
     *
     * @hide
     */
    public static final String ACTION_PROMPT_PARTIAL_CONNECTIVITY =
            "android.net.conn.PROMPT_PARTIAL_CONNECTIVITY";

    /**
     * Invalid tethering type.
     * @see #startTethering(int, boolean, OnStartTetheringCallback)
@@ -4018,7 +4028,7 @@ public class ConnectivityManager {
     *
     * @hide
     */
    @RequiresPermission(android.Manifest.permission.CONNECTIVITY_INTERNAL)
    @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS)
    public void setAcceptUnvalidated(Network network, boolean accept, boolean always) {
        try {
            mService.setAcceptUnvalidated(network, accept, always);
@@ -4027,6 +4037,29 @@ public class ConnectivityManager {
        }
    }

    /**
     * Informs the system whether it should consider the network as validated even if it only has
     * partial connectivity. If {@code accept} is true, then the network will be considered as
     * validated even if connectivity is only partial. If {@code always} is true, then the choice
     * is remembered, so that the next time the user connects to this network, the system will
     * switch to it.
     *
     * @param network The network to accept.
     * @param accept Whether to consider the network as validated even if it has partial
     *               connectivity.
     * @param always Whether to remember this choice in the future.
     *
     * @hide
     */
    @RequiresPermission(android.Manifest.permission.NETWORK_STACK)
    public void setAcceptPartialConnectivity(Network network, boolean accept, boolean always) {
        try {
            mService.setAcceptPartialConnectivity(network, accept, always);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Informs the system to penalize {@code network}'s score when it becomes unvalidated. This is
     * only meaningful if the system is configured not to penalize such networks, e.g., if the
@@ -4037,7 +4070,7 @@ public class ConnectivityManager {
     *
     * @hide
     */
    @RequiresPermission(android.Manifest.permission.CONNECTIVITY_INTERNAL)
    @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS)
    public void setAvoidUnvalidated(Network network) {
        try {
            mService.setAvoidUnvalidated(network);
+1 −0
Original line number Diff line number Diff line
@@ -176,6 +176,7 @@ interface IConnectivityManager
    void releaseNetworkRequest(in NetworkRequest networkRequest);

    void setAcceptUnvalidated(in Network network, boolean accept, boolean always);
    void setAcceptPartialConnectivity(in Network network, boolean accept, boolean always);
    void setAvoidUnvalidated(in Network network);
    void startCaptivePortalApp(in Network network);
    void startCaptivePortalAppInternal(in Network network, in Bundle appExtras);
+7 −0
Original line number Diff line number Diff line
@@ -32,9 +32,16 @@ oneway interface INetworkMonitor {
    // 3. a broken network (e.g. DNS failed, connect failed, HTTP request failed).
    const int NETWORK_TEST_RESULT_INVALID = 1;

    // After a network has been tested, this result can be sent with EVENT_NETWORK_TESTED.
    // The network may be used as a default internet connection, but it was found to be a partial
    // connectivity network which can get the pass result for http probe but get the failed result
    // for https probe.
    const int NETWORK_TEST_RESULT_PARTIAL_CONNECTIVITY = 2;

    void start();
    void launchCaptivePortalApp();
    void notifyCaptivePortalAppFinished(int response);
    void notifyAcceptPartialConnectivity();
    void forceReevaluation(int uid);
    void notifyPrivateDnsChanged(in PrivateDnsConfigParcel config);
    void notifyDnsResponse(int returnCode);
Loading