API council requested tweaks to NetworkRequest.
If you put values into the Builder, you should be able to observe those values on the built object. Clean cherry-pick of ag/3813257 Test: atest android.net.cts.NetworkRequestTest Bug: 74945408 Change-Id: Ib28de279efb8b33ab46aa64f580e10fe5f8720e3 Merged-In: I0d090ebb7d57689a061badcf593ae9a37d88f7ce Merged-In: I539184f7385c1f288cfb77be8307e4463e07e9e6
This commit is contained in:
committed by
Chalard Jean
parent
256ac5d119
commit
77cd0408ff
@@ -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;
|
||||
@@ -426,6 +428,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 : "") +
|
||||
|
||||
Reference in New Issue
Block a user