Merge "[JS01]Remove hidden API usage of Connectivity Sevice" am: 487698b2b7 am: 647d2b66cc
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1628361 Change-Id: I7b4e289f13856f8015757d23a478fa923773d37a
This commit is contained in:
@@ -68,6 +68,7 @@ package android.net {
|
||||
method public boolean bindProcessToNetwork(@Nullable android.net.Network);
|
||||
method @NonNull public android.net.SocketKeepalive createSocketKeepalive(@NonNull android.net.Network, @NonNull android.net.IpSecManager.UdpEncapsulationSocket, @NonNull java.net.InetAddress, @NonNull java.net.InetAddress, @NonNull java.util.concurrent.Executor, @NonNull android.net.SocketKeepalive.Callback);
|
||||
method @Nullable @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) public android.net.Network getActiveNetwork();
|
||||
method @Nullable @RequiresPermission(android.Manifest.permission.NETWORK_STACK) public android.net.Network getActiveNetworkForUid(int);
|
||||
method @Deprecated @Nullable @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) public android.net.NetworkInfo getActiveNetworkInfo();
|
||||
method @Deprecated @NonNull @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) public android.net.NetworkInfo[] getAllNetworkInfo();
|
||||
method @NonNull @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) public android.net.Network[] getAllNetworks();
|
||||
@@ -387,7 +388,9 @@ package android.net {
|
||||
public class NetworkRequest implements android.os.Parcelable {
|
||||
method public boolean canBeSatisfiedBy(@Nullable android.net.NetworkCapabilities);
|
||||
method public int describeContents();
|
||||
method @NonNull public int[] getCapabilities();
|
||||
method @Nullable public android.net.NetworkSpecifier getNetworkSpecifier();
|
||||
method @NonNull public int[] getTransportTypes();
|
||||
method public boolean hasCapability(int);
|
||||
method public boolean hasTransport(int);
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
|
||||
@@ -120,6 +120,7 @@ package android.net {
|
||||
}
|
||||
|
||||
public class NetworkRequest implements android.os.Parcelable {
|
||||
method @NonNull public int[] getUnwantedCapabilities();
|
||||
method public boolean hasUnwantedCapability(int);
|
||||
}
|
||||
|
||||
|
||||
@@ -1190,8 +1190,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