Merge "[JS01]Remove hidden API usage of Connectivity Sevice" into sc-dev
This commit is contained in:
@@ -1083,8 +1083,7 @@ public class ConnectivityManager {
|
||||
*
|
||||
* @return a {@link Network} object for the current default network for the
|
||||
* given UID or {@code null} if no default network is currently active
|
||||
*
|
||||
* @hide
|
||||
* TODO: b/183465229 Cleanup getActiveNetworkForUid once b/165835257 is fixed
|
||||
*/
|
||||
@RequiresPermission(android.Manifest.permission.NETWORK_STACK)
|
||||
@Nullable
|
||||
|
||||
@@ -699,4 +699,43 @@ public class NetworkRequest implements Parcelable {
|
||||
public int hashCode() {
|
||||
return Objects.hash(requestId, legacyType, networkCapabilities, type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all the capabilities set on this {@code NetworkRequest} instance.
|
||||
*
|
||||
* @return an array of capability values for this instance.
|
||||
*/
|
||||
@NonNull
|
||||
public @NetCapability int[] getCapabilities() {
|
||||
// No need to make a defensive copy here as NC#getCapabilities() already returns
|
||||
// a new array.
|
||||
return networkCapabilities.getCapabilities();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all the unwanted capabilities set on this {@code NetworkRequest} instance.
|
||||
*
|
||||
* @return an array of unwanted capability values for this instance.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
@SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
|
||||
public @NetCapability int[] getUnwantedCapabilities() {
|
||||
// No need to make a defensive copy here as NC#getUnwantedCapabilities() already returns
|
||||
// a new array.
|
||||
return networkCapabilities.getUnwantedCapabilities();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all the transports set on this {@code NetworkRequest} instance.
|
||||
*
|
||||
* @return an array of transport type values for this instance.
|
||||
*/
|
||||
@NonNull
|
||||
public @Transport int[] getTransportTypes() {
|
||||
// No need to make a defensive copy here as NC#getTransportTypes() already returns
|
||||
// a new array.
|
||||
return networkCapabilities.getTransportTypes();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user