Merge "[FUI15] Remove networkId in NetworkState"
This commit is contained in:
@@ -41,7 +41,6 @@ public class NetworkState implements Parcelable {
|
||||
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
|
||||
public final Network network;
|
||||
public final String subscriberId;
|
||||
public final String networkId;
|
||||
public final int legacyNetworkType;
|
||||
|
||||
private NetworkState() {
|
||||
@@ -50,35 +49,33 @@ public class NetworkState implements Parcelable {
|
||||
networkCapabilities = null;
|
||||
network = null;
|
||||
subscriberId = null;
|
||||
networkId = null;
|
||||
legacyNetworkType = 0;
|
||||
}
|
||||
|
||||
public NetworkState(int legacyNetworkType, @NonNull LinkProperties linkProperties,
|
||||
@NonNull NetworkCapabilities networkCapabilities, @NonNull Network network,
|
||||
@Nullable String subscriberId, @Nullable String networkId) {
|
||||
@Nullable String subscriberId) {
|
||||
this(legacyNetworkType, new NetworkInfo(legacyNetworkType, 0, null, null), linkProperties,
|
||||
networkCapabilities, network, subscriberId, networkId);
|
||||
networkCapabilities, network, subscriberId);
|
||||
}
|
||||
|
||||
// Constructor that used internally in ConnectivityService mainline module.
|
||||
public NetworkState(@NonNull NetworkInfo networkInfo, @NonNull LinkProperties linkProperties,
|
||||
@NonNull NetworkCapabilities networkCapabilities, @NonNull Network network,
|
||||
String subscriberId, String networkId) {
|
||||
@Nullable String subscriberId) {
|
||||
this(networkInfo.getType(), networkInfo, linkProperties,
|
||||
networkCapabilities, network, subscriberId, networkId);
|
||||
networkCapabilities, network, subscriberId);
|
||||
}
|
||||
|
||||
public NetworkState(int legacyNetworkType, @NonNull NetworkInfo networkInfo,
|
||||
@NonNull LinkProperties linkProperties,
|
||||
@NonNull NetworkCapabilities networkCapabilities, @NonNull Network network,
|
||||
String subscriberId, String networkId) {
|
||||
@Nullable String subscriberId) {
|
||||
this.networkInfo = networkInfo;
|
||||
this.linkProperties = linkProperties;
|
||||
this.networkCapabilities = networkCapabilities;
|
||||
this.network = network;
|
||||
this.subscriberId = subscriberId;
|
||||
this.networkId = networkId;
|
||||
this.legacyNetworkType = legacyNetworkType;
|
||||
|
||||
// This object is an atomic view of a network, so the various components
|
||||
@@ -99,7 +96,6 @@ public class NetworkState implements Parcelable {
|
||||
networkCapabilities = in.readParcelable(null);
|
||||
network = in.readParcelable(null);
|
||||
subscriberId = in.readString();
|
||||
networkId = in.readString();
|
||||
legacyNetworkType = in.readInt();
|
||||
}
|
||||
|
||||
@@ -115,7 +111,6 @@ public class NetworkState implements Parcelable {
|
||||
out.writeParcelable(networkCapabilities, flags);
|
||||
out.writeParcelable(network, flags);
|
||||
out.writeString(subscriberId);
|
||||
out.writeString(networkId);
|
||||
out.writeInt(legacyNetworkType);
|
||||
}
|
||||
|
||||
|
||||
@@ -899,7 +899,7 @@ public class NetworkAgentInfo implements Comparable<NetworkAgentInfo> {
|
||||
? networkAgentConfig.subscriberId : null;
|
||||
return new NetworkState(new NetworkInfo(networkInfo),
|
||||
new LinkProperties(linkProperties),
|
||||
new NetworkCapabilities(networkCapabilities), network, subscriberId, null);
|
||||
new NetworkCapabilities(networkCapabilities), network, subscriberId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ class NetworkTemplateTest {
|
||||
setCapability(NetworkCapabilities.NET_CAPABILITY_NOT_ROAMING, true)
|
||||
setSSID(ssid)
|
||||
}
|
||||
return NetworkState(type, lp, caps, mock(Network::class.java), subscriberId, ssid)
|
||||
return NetworkState(type, lp, caps, mock(Network::class.java), subscriberId)
|
||||
}
|
||||
|
||||
private fun NetworkTemplate.assertMatches(ident: NetworkIdentity) =
|
||||
|
||||
@@ -1461,7 +1461,7 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {
|
||||
capabilities.setCapability(NetworkCapabilities.NET_CAPABILITY_NOT_ROAMING, true);
|
||||
capabilities.addTransportType(NetworkCapabilities.TRANSPORT_WIFI);
|
||||
capabilities.setSSID(TEST_SSID);
|
||||
return new NetworkState(TYPE_WIFI, prop, capabilities, WIFI_NETWORK, null, TEST_SSID);
|
||||
return new NetworkState(TYPE_WIFI, prop, capabilities, WIFI_NETWORK, null);
|
||||
}
|
||||
|
||||
private static NetworkState buildMobile3gState(String subscriberId) {
|
||||
@@ -1475,8 +1475,7 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {
|
||||
capabilities.setCapability(NetworkCapabilities.NET_CAPABILITY_NOT_METERED, false);
|
||||
capabilities.setCapability(NetworkCapabilities.NET_CAPABILITY_NOT_ROAMING, !isRoaming);
|
||||
capabilities.addTransportType(NetworkCapabilities.TRANSPORT_CELLULAR);
|
||||
return new NetworkState(
|
||||
TYPE_MOBILE, prop, capabilities, MOBILE_NETWORK, subscriberId, null);
|
||||
return new NetworkState(TYPE_MOBILE, prop, capabilities, MOBILE_NETWORK, subscriberId);
|
||||
}
|
||||
|
||||
private NetworkStats buildEmptyStats() {
|
||||
@@ -1486,7 +1485,7 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {
|
||||
private static NetworkState buildVpnState() {
|
||||
final LinkProperties prop = new LinkProperties();
|
||||
prop.setInterfaceName(TUN_IFACE);
|
||||
return new NetworkState(TYPE_VPN, prop, new NetworkCapabilities(), VPN_NETWORK, null, null);
|
||||
return new NetworkState(TYPE_VPN, prop, new NetworkCapabilities(), VPN_NETWORK, null);
|
||||
}
|
||||
|
||||
private long getElapsedRealtime() {
|
||||
|
||||
Reference in New Issue
Block a user