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
This commit is contained in:
Chalard Jean
2019-12-11 17:15:31 +09:00
parent 05cbe97f28
commit 294ebbbad8

View File

@@ -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 : "") +