diff options
| author | 2019-12-11 17:15:31 +0900 | |
|---|---|---|
| committer | 2019-12-12 13:10:55 +0900 | |
| commit | 7412d7aa61fc3d66ccfdb0f2a849ba1c2a23d181 (patch) | |
| tree | 30254c26647554efd43f1255497f4e839c6b5246 | |
| parent | b24e34c19b02dc82e4b38b4129d49f1b440d1345 (diff) | |
Make getNetworkSpecifier() public API.
The builder lets clients set it, and this may be useful for
unit tests of apps. It should be public.
The need arises from uses of this in WiFi and Telephony
network factories.
Test: build
Bug: 135998869
Change-Id: I57279cac139c28e8654d2066ba0c60edd1e6cd98
| -rw-r--r-- | api/current.txt | 1 | ||||
| -rw-r--r-- | core/java/android/net/NetworkRequest.java | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/api/current.txt b/api/current.txt index 23b5bc6224f1..e741629679b9 100644 --- a/api/current.txt +++ b/api/current.txt @@ -28903,6 +28903,7 @@ package android.net { public class NetworkRequest implements android.os.Parcelable { method public int describeContents(); + method @Nullable public android.net.NetworkSpecifier getNetworkSpecifier(); method public boolean hasCapability(int); method public boolean hasTransport(int); method public void writeToParcel(android.os.Parcel, int); diff --git a/core/java/android/net/NetworkRequest.java b/core/java/android/net/NetworkRequest.java index 4270740cc722..471b23e04775 100644 --- a/core/java/android/net/NetworkRequest.java +++ b/core/java/android/net/NetworkRequest.java @@ -17,6 +17,7 @@ package android.net; import android.annotation.NonNull; +import android.annotation.Nullable; import android.annotation.RequiresPermission; import android.annotation.SystemApi; import android.annotation.UnsupportedAppUsage; @@ -461,6 +462,14 @@ public class NetworkRequest implements Parcelable { return networkCapabilities.hasTransport(transportType); } + /** + * @see Builder#setNetworkSpecifier(NetworkSpecifier) + */ + @Nullable + public NetworkSpecifier getNetworkSpecifier() { + return networkCapabilities.getNetworkSpecifier(); + } + public String toString() { return "NetworkRequest [ " + type + " id=" + requestId + (legacyType != ConnectivityManager.TYPE_NONE ? ", legacyType=" + legacyType : "") + |