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

Commit 2229a10c authored by Sarah Chin's avatar Sarah Chin Committed by Gerrit Code Review
Browse files

Merge "API to get network visible network capability name"

parents c6fa98ba 430f4a23
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -273,6 +273,7 @@ package android.net {

  public final class NetworkCapabilities implements android.os.Parcelable {
    method @NonNull public int[] getAdministratorUids();
    method @Nullable public static String getCapabilityCarrierName(int);
    method @Nullable public String getSsid();
    method @NonNull public int[] getTransportTypes();
    method public boolean isPrivateDnsBroken();
+17 −0
Original line number Diff line number Diff line
@@ -728,6 +728,23 @@ public final class NetworkCapabilities implements Parcelable {
        return ((mNetworkCapabilities & CONNECTIVITY_MANAGED_CAPABILITIES) != 0);
    }

    /**
     * Get the name of the given capability that carriers use.
     * If the capability does not have a carrier-name, returns null.
     *
     * @param capability The capability to get the carrier-name of.
     * @return The carrier-name of the capability, or null if it doesn't exist.
     * @hide
     */
    @SystemApi
    public static @Nullable String getCapabilityCarrierName(@NetCapability int capability) {
        if (capability == NET_CAPABILITY_ENTERPRISE) {
            return capabilityNameOf(capability);
        } else {
            return null;
        }
    }

    private void combineNetCapabilities(@NonNull NetworkCapabilities nc) {
        final long wantedCaps = this.mNetworkCapabilities | nc.mNetworkCapabilities;
        final long unwantedCaps =