Merge "Add getEnterpriseId api to network request"
This commit is contained in:
commit
71c9ca453d
2 changed files with 29 additions and 0 deletions
|
|
@ -146,7 +146,9 @@ package android.net {
|
|||
}
|
||||
|
||||
public class NetworkRequest implements android.os.Parcelable {
|
||||
method @NonNull public int[] getEnterpriseIds();
|
||||
method @NonNull public int[] getForbiddenCapabilities();
|
||||
method public boolean hasEnterpriseId(int);
|
||||
method public boolean hasForbiddenCapability(int);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -724,6 +724,33 @@ public class NetworkRequest implements Parcelable {
|
|||
return networkCapabilities.getCapabilities();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the enteprise identifiers.
|
||||
*
|
||||
* Get all the enterprise identifiers set on this {@code NetworkCapability}
|
||||
* @return array of all the enterprise identifiers.
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
|
||||
public @NonNull @NetworkCapabilities.EnterpriseId int[] getEnterpriseIds() {
|
||||
// No need to make a defensive copy here as NC#getCapabilities() already returns
|
||||
// a new array.
|
||||
return networkCapabilities.getEnterpriseIds();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests for the presence of an enterprise identifier on this instance.
|
||||
*
|
||||
* @param enterpriseId the enterprise capability identifier to be tested for.
|
||||
* @return {@code true} if set on this instance.
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
|
||||
public boolean hasEnterpriseId(
|
||||
@NetworkCapabilities.EnterpriseId int enterpriseId) {
|
||||
return networkCapabilities.hasEnterpriseId(enterpriseId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all the forbidden capabilities set on this {@code NetworkRequest} instance.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in a new issue