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

Commit 16e12abb authored by Robert Greenwalt's avatar Robert Greenwalt
Browse files

Add Trust to NetworkCapabilities.

Indicates the user has indicated implicit trust of a network.  This
generally means it's a sim-selected carrier, a plugged in ethernet,
a paired BT device or a wifi they've asked to connect to.  Untrusted
networks are probably limited to unknown wifi AP.

Change-Id: I89490bdaa3c2d63d33f876c72d8b088dc155fa3d
parent 8e5270fd
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -16487,6 +16487,7 @@ package android.net {
    field public static final int NET_CAPABILITY_NOT_RESTRICTED = 13; // 0xd
    field public static final int NET_CAPABILITY_RCS = 8; // 0x8
    field public static final int NET_CAPABILITY_SUPL = 1; // 0x1
    field public static final int NET_CAPABILITY_TRUSTED = 14; // 0xe
    field public static final int NET_CAPABILITY_WIFI_P2P = 6; // 0x6
    field public static final int NET_CAPABILITY_XCAP = 9; // 0x9
    field public static final int TRANSPORT_BLUETOOTH = 2; // 0x2
+13 −2
Original line number Diff line number Diff line
@@ -63,7 +63,8 @@ public final class NetworkCapabilities implements Parcelable {
     * Represents the network's capabilities.  If any are specified they will be satisfied
     * by any Network that matches all of them.
     */
    private long mNetworkCapabilities = (1 << NET_CAPABILITY_NOT_RESTRICTED);
    private long mNetworkCapabilities = (1 << NET_CAPABILITY_NOT_RESTRICTED) |
            (1 << NET_CAPABILITY_TRUSTED);

    /**
     * Indicates this is a network that has the ability to reach the
@@ -149,8 +150,17 @@ public final class NetworkCapabilities implements Parcelable {
     */
    public static final int NET_CAPABILITY_NOT_RESTRICTED = 13;

    /**
     * Indicates that the user has indicated implicit trust of this network.  This
     * generally means it's a sim-selected carrier, a plugged in ethernet, a paired
     * BT device or a wifi the user asked to connect to.  Untrusted networks
     * are probably limited to unknown wifi AP.  Set by default.
     */
    public static final int NET_CAPABILITY_TRUSTED        = 14;


    private static final int MIN_NET_CAPABILITY = NET_CAPABILITY_MMS;
    private static final int MAX_NET_CAPABILITY = NET_CAPABILITY_NOT_RESTRICTED;
    private static final int MAX_NET_CAPABILITY = NET_CAPABILITY_TRUSTED;

    /**
     * Adds the given capability to this {@code NetworkCapability} instance.
@@ -512,6 +522,7 @@ public final class NetworkCapabilities implements Parcelable {
                case NET_CAPABILITY_NOT_METERED:    capabilities += "NOT_METERED"; break;
                case NET_CAPABILITY_INTERNET:       capabilities += "INTERNET"; break;
                case NET_CAPABILITY_NOT_RESTRICTED: capabilities += "NOT_RESTRICTED"; break;
                case NET_CAPABILITY_TRUSTED:        capabilities += "TRUSTED"; break;
            }
            if (++i < types.length) capabilities += "&";
        }