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. Test: atest android.net.cts.NetworkRequestTest Bug: 74945408 Change-Id: I9aacceb82c98f7881f0eb5e1106d89d469b816a7
This commit is contained in:
@@ -17,6 +17,8 @@
|
|||||||
package android.net;
|
package android.net;
|
||||||
|
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
|
import android.net.NetworkCapabilities.NetCapability;
|
||||||
|
import android.net.NetworkCapabilities.Transport;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.os.Process;
|
import android.os.Process;
|
||||||
@@ -427,6 +429,20 @@ public class NetworkRequest implements Parcelable {
|
|||||||
return type == Type.BACKGROUND_REQUEST;
|
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() {
|
public String toString() {
|
||||||
return "NetworkRequest [ " + type + " id=" + requestId +
|
return "NetworkRequest [ " + type + " id=" + requestId +
|
||||||
(legacyType != ConnectivityManager.TYPE_NONE ? ", legacyType=" + legacyType : "") +
|
(legacyType != ConnectivityManager.TYPE_NONE ? ", legacyType=" + legacyType : "") +
|
||||||
|
|||||||
Reference in New Issue
Block a user