Loading core/java/android/net/NetworkState.java +5 −10 Original line number Diff line number Diff line Loading @@ -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() { Loading @@ -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 Loading @@ -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(); } Loading @@ -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); } Loading services/core/java/com/android/server/connectivity/NetworkAgentInfo.java +1 −1 Original line number Diff line number Diff line Loading @@ -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); } } Loading services/tests/servicestests/src/com/android/server/net/NetworkPolicyManagerServiceTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -2043,7 +2043,7 @@ public class NetworkPolicyManagerServiceTest { final NetworkCapabilities networkCapabilities = new NetworkCapabilities(); networkCapabilities.addTransportType(TRANSPORT_WIFI); networkCapabilities.setSSID(TEST_SSID); return new NetworkState(TYPE_WIFI, prop, networkCapabilities, null, null, TEST_SSID); return new NetworkState(TYPE_WIFI, prop, networkCapabilities, null, null); } private void expectHasInternetPermission(int uid, boolean hasIt) throws Exception { Loading @@ -2067,7 +2067,7 @@ public class NetworkPolicyManagerServiceTest { new NetworkState(TYPE_MOBILE, buildLinkProperties(TEST_IFACE), buildNetworkCapabilities(TEST_SUB_ID, roaming), new Network(TEST_NET_ID), TEST_IMSI, null) new Network(TEST_NET_ID), TEST_IMSI) }); } Loading tests/net/java/android/net/NetworkTemplateTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -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) = Loading tests/net/java/com/android/server/net/NetworkStatsServiceTest.java +3 −4 Original line number Diff line number Diff line Loading @@ -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) { Loading @@ -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() { Loading @@ -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() { Loading Loading
core/java/android/net/NetworkState.java +5 −10 Original line number Diff line number Diff line Loading @@ -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() { Loading @@ -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 Loading @@ -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(); } Loading @@ -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); } Loading
services/core/java/com/android/server/connectivity/NetworkAgentInfo.java +1 −1 Original line number Diff line number Diff line Loading @@ -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); } } Loading
services/tests/servicestests/src/com/android/server/net/NetworkPolicyManagerServiceTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -2043,7 +2043,7 @@ public class NetworkPolicyManagerServiceTest { final NetworkCapabilities networkCapabilities = new NetworkCapabilities(); networkCapabilities.addTransportType(TRANSPORT_WIFI); networkCapabilities.setSSID(TEST_SSID); return new NetworkState(TYPE_WIFI, prop, networkCapabilities, null, null, TEST_SSID); return new NetworkState(TYPE_WIFI, prop, networkCapabilities, null, null); } private void expectHasInternetPermission(int uid, boolean hasIt) throws Exception { Loading @@ -2067,7 +2067,7 @@ public class NetworkPolicyManagerServiceTest { new NetworkState(TYPE_MOBILE, buildLinkProperties(TEST_IFACE), buildNetworkCapabilities(TEST_SUB_ID, roaming), new Network(TEST_NET_ID), TEST_IMSI, null) new Network(TEST_NET_ID), TEST_IMSI) }); } Loading
tests/net/java/android/net/NetworkTemplateTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -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) = Loading
tests/net/java/com/android/server/net/NetworkStatsServiceTest.java +3 −4 Original line number Diff line number Diff line Loading @@ -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) { Loading @@ -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() { Loading @@ -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() { Loading