Merge "API to get network visible network capability name" am: aac4d3242a

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1653200

Change-Id: I7f8b909ec061d8bb875ff2688e2fb9a4cea54318
This commit is contained in:
Sarah Chin
2021-04-02 17:45:29 +00:00
committed by Automerger Merge Worker
2 changed files with 18 additions and 0 deletions

View File

@@ -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();

View File

@@ -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 =