Merge "API council requested tweaks to NetworkRequest." into pi-dev
This commit is contained in:
commit
93fc2b5049
1 changed files with 16 additions and 0 deletions
|
|
@ -17,6 +17,8 @@
|
|||
package android.net;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.net.NetworkCapabilities.NetCapability;
|
||||
import android.net.NetworkCapabilities.Transport;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.os.Process;
|
||||
|
|
@ -427,6 +429,20 @@ public class NetworkRequest implements Parcelable {
|
|||
return type == Type.BACKGROUND_REQUEST;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Builder#addCapability(int)
|
||||
*/
|
||||
public boolean hasCapability(@NetCapability int capability) {
|
||||
return networkCapabilities.hasCapability(capability);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Builder#addTransportType(int)
|
||||
*/
|
||||
public boolean hasTransport(@Transport int transportType) {
|
||||
return networkCapabilities.hasTransport(transportType);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "NetworkRequest [ " + type + " id=" + requestId +
|
||||
(legacyType != ConnectivityManager.TYPE_NONE ? ", legacyType=" + legacyType : "") +
|
||||
|
|
|
|||
Loading…
Reference in a new issue