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

Commit d64b2747 authored by Sarah Chin's avatar Sarah Chin Committed by Android (Google) Code Review
Browse files

Merge "API to get network visible network capability name" into sc-dev

parents 25546c38 334952fc
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -270,6 +270,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
@@ -711,6 +711,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 =