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