diff options
| author | Sooraj Sasindran <sasindran@google.com> | 2022-01-25 14:49:29 -0800 |
|---|---|---|
| committer | Sooraj Sasindran <sasindran@google.com> | 2022-01-26 17:26:50 +0000 |
| commit | 7e9b25e7f9977fee51075e25d87b3d2cce61eb83 (patch) | |
| tree | c6c9f223fb4ad02eaf14f0e0326485fe419278fd /framework/src/android/net/NetworkRequest.java | |
| parent | 317be96553ec7894de5c399bcfdae023e6a28492 (diff) | |
Add getEnterpriseId api to network request
Bug: 194332512
CTS-Coverage-Bug: 216481336
Test: build
Change-Id: I1446f8eecf43f7c6d243dc82af08d04957dd60e3
Diffstat (limited to 'framework/src/android/net/NetworkRequest.java')
| -rw-r--r-- | framework/src/android/net/NetworkRequest.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/framework/src/android/net/NetworkRequest.java b/framework/src/android/net/NetworkRequest.java index afc76d664a..b7a6076c34 100644 --- a/framework/src/android/net/NetworkRequest.java +++ b/framework/src/android/net/NetworkRequest.java @@ -725,6 +725,33 @@ public class NetworkRequest implements Parcelable { } /** + * 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. * * @return an array of forbidden capability values for this instance. |
