Home
last modified time | relevance | path

Searched refs:nc (Results 1 – 25 of 152) sorted by relevance

1234567

/packages/modules/Connectivity/tests/common/java/android/net/
DNetworkCapabilitiesTest.java326 final NetworkCapabilities nc = new NetworkCapabilities(); in testSetAllowedUids() local
327 assertThrows(NullPointerException.class, () -> nc.setAllowedUids(null)); in testSetAllowedUids()
328 assertFalse(nc.hasAllowedUids()); in testSetAllowedUids()
329 assertFalse(nc.isUidWithAccess(0)); in testSetAllowedUids()
330 assertFalse(nc.isUidWithAccess(1000)); in testSetAllowedUids()
331 assertEquals(0, nc.getAllowedUids().size()); in testSetAllowedUids()
332 nc.setAllowedUids(new ArraySet<>()); in testSetAllowedUids()
333 assertFalse(nc.hasAllowedUids()); in testSetAllowedUids()
334 assertFalse(nc.isUidWithAccess(0)); in testSetAllowedUids()
335 assertFalse(nc.isUidWithAccess(1000)); in testSetAllowedUids()
[all …]
/packages/modules/Connectivity/framework/src/android/net/
DNetworkCapabilities.java334 public NetworkCapabilities(NetworkCapabilities nc) { in NetworkCapabilities() argument
335 this(nc, REDACT_NONE); in NetworkCapabilities()
346 public NetworkCapabilities(@Nullable NetworkCapabilities nc, @RedactionType long redactions) { in NetworkCapabilities() argument
347 if (nc != null) { in NetworkCapabilities()
348 set(nc); in NetworkCapabilities()
351 mTransportInfo = nc.mTransportInfo.makeCopy(redactions); in NetworkCapabilities()
385 public void set(@NonNull NetworkCapabilities nc) { in set() argument
386 mNetworkCapabilities = nc.mNetworkCapabilities; in set()
387 mTransportTypes = nc.mTransportTypes; in set()
388 mLinkUpBandwidthKbps = nc.mLinkUpBandwidthKbps; in set()
[all …]
DNetworkRequest.java248 public NetworkRequest(NetworkCapabilities nc, int legacyType, int rId, Type type) { in NetworkRequest() argument
249 if (nc == null) { in NetworkRequest()
253 networkCapabilities = nc; in NetworkRequest()
330 final NetworkCapabilities nc = new NetworkCapabilities(mNetworkCapabilities); in build() local
331 nc.maybeMarkCapabilitiesRestricted(); in build()
332 deduceNotVcnManagedCapability(nc); in build()
333 return new NetworkRequest(nc, ConnectivityManager.TYPE_NONE, in build()
377 public Builder setCapabilities(NetworkCapabilities nc) { in setCapabilities() argument
378 mNetworkCapabilities.set(nc); in setCapabilities()
598 private void deduceNotVcnManagedCapability(final NetworkCapabilities nc) { in deduceNotVcnManagedCapability() argument
[all …]
/packages/modules/Connectivity/staticlibs/device/com/android/net/module/util/
DNetworkMonitorUtils.java71 public static boolean isPrivateDnsValidationRequired(@NonNull final NetworkCapabilities nc) { in isPrivateDnsValidationRequired() argument
73 && !nc.hasCapability(NET_CAPABILITY_NOT_VCN_MANAGED); in isPrivateDnsValidationRequired()
74 final boolean isOemPaid = nc.hasCapability(NET_CAPABILITY_OEM_PAID) in isPrivateDnsValidationRequired()
75 && nc.hasCapability(NET_CAPABILITY_TRUSTED); in isPrivateDnsValidationRequired()
76 final boolean isDefaultCapable = nc.hasCapability(NET_CAPABILITY_NOT_RESTRICTED) in isPrivateDnsValidationRequired()
77 && nc.hasCapability(NET_CAPABILITY_TRUSTED); in isPrivateDnsValidationRequired()
80 if (nc.hasCapability(NET_CAPABILITY_INTERNET) in isPrivateDnsValidationRequired()
89 if (nc.hasTransport(TRANSPORT_TEST) && nc.hasCapability(NET_CAPABILITY_NOT_RESTRICTED) && ( in isPrivateDnsValidationRequired()
90 nc.hasTransport(TRANSPORT_WIFI) in isPrivateDnsValidationRequired()
91 || nc.hasTransport(TRANSPORT_CELLULAR) in isPrivateDnsValidationRequired()
[all …]
/packages/modules/NetworkStack/tests/unit/src/com/android/networkstack/metrics/
DNetworkValidationMetricsTest.java109 NetworkCapabilities nc = new NetworkCapabilities(); in testNetworkValidationMetrics_VerifyTransportTypeToEnum() local
110 nc.addTransportType(TRANSPORT_WIFI); in testNetworkValidationMetrics_VerifyTransportTypeToEnum()
111 assertEquals(TransportType.TT_WIFI, metrics.getTransportTypeFromNC(nc)); in testNetworkValidationMetrics_VerifyTransportTypeToEnum()
112 nc.addTransportType(TRANSPORT_VPN); in testNetworkValidationMetrics_VerifyTransportTypeToEnum()
113 assertEquals(TransportType.TT_WIFI_VPN, metrics.getTransportTypeFromNC(nc)); in testNetworkValidationMetrics_VerifyTransportTypeToEnum()
114 nc.addTransportType(TRANSPORT_CELLULAR); in testNetworkValidationMetrics_VerifyTransportTypeToEnum()
115 assertEquals(TransportType.TT_WIFI_CELLULAR_VPN, metrics.getTransportTypeFromNC(nc)); in testNetworkValidationMetrics_VerifyTransportTypeToEnum()
117 nc = new NetworkCapabilities(); in testNetworkValidationMetrics_VerifyTransportTypeToEnum()
118 nc.addTransportType(TRANSPORT_CELLULAR); in testNetworkValidationMetrics_VerifyTransportTypeToEnum()
119 assertEquals(TransportType.TT_CELLULAR, metrics.getTransportTypeFromNC(nc)); in testNetworkValidationMetrics_VerifyTransportTypeToEnum()
[all …]
/packages/modules/Connectivity/staticlibs/tests/unit/src/com/android/net/module/util/
DNetworkCapabilitiesUtilsTest.kt79 val nc = NetworkCapabilities() in testInferRestrictedCapability() constant
81 assertFalse(NetworkCapabilitiesUtils.inferRestrictedCapability(nc)) in testInferRestrictedCapability()
83 nc.addCapability(NET_CAPABILITY_OEM_PAID) in testInferRestrictedCapability()
84 nc.addCapability(NET_CAPABILITY_INTERNET) in testInferRestrictedCapability()
85 assertTrue(NetworkCapabilitiesUtils.inferRestrictedCapability(nc)) in testInferRestrictedCapability()
88 nc.removeCapability(NET_CAPABILITY_OEM_PAID) in testInferRestrictedCapability()
89 nc.addCapability(NET_CAPABILITY_CBS) in testInferRestrictedCapability()
90 assertFalse(NetworkCapabilitiesUtils.inferRestrictedCapability(nc)) in testInferRestrictedCapability()
93 nc.removeCapability(NET_CAPABILITY_INTERNET) in testInferRestrictedCapability()
94 assertTrue(NetworkCapabilitiesUtils.inferRestrictedCapability(nc)) in testInferRestrictedCapability()
[all …]
/packages/modules/Connectivity/tests/unit/java/com/android/server/connectivityservice/
DCSLocalAgentTests.kt65 private fun nc(transport: Int, vararg caps: Int) = NetworkCapabilities.Builder().apply { in <lambda>() method
116 Agent(nc = NetworkCapabilities.Builder() in keepScore()
122 Agent(nc = NetworkCapabilities.Builder().build(), in keepScore()
136 val agent = Agent(nc = NetworkCapabilities.Builder() in keepScore()
145 val agent2 = Agent(nc = NetworkCapabilities.Builder() in keepScore()
168 nc = nc(TRANSPORT_WIFI, NET_CAPABILITY_LOCAL_NETWORK), in keepScore()
177 nc = nc(TRANSPORT_WIFI, NET_CAPABILITY_INTERNET)) in keepScore()
209 nc = nc(TRANSPORT_THREAD, NET_CAPABILITY_LOCAL_NETWORK), in keepScore()
221 nc = nc(TRANSPORT_WIFI, NET_CAPABILITY_INTERNET)) in keepScore()
226 nc = nc(TRANSPORT_CELLULAR, NET_CAPABILITY_INTERNET)) in keepScore()
[all …]
DCSIngressDiscardRuleTests.kt110 val wifiAgent = Agent(nc = wifiNc, lp = wifiLp) in testVpnIngressDiscardRule_UpdateVpnAddress()
116 val nc = vpnNc() in testVpnIngressDiscardRule_UpdateVpnAddress() constant
118 val agent = Agent(nc = nc, lp = lp) in testVpnIngressDiscardRule_UpdateVpnAddress()
149 val nc = vpnNc() in testVpnIngressDiscardRule_UpdateInterfaceName() constant
151 val agent = Agent(nc = nc, lp = lp) in testVpnIngressDiscardRule_UpdateInterfaceName()
180 val wifiAgent = Agent(nc = wifiNc, lp = wifiLp) in testVpnIngressDiscardRule_DuplicatedIpAddress_UpdateVpnAddress()
191 val vpnAgent = Agent(nc = vpnNc, lp = vpnLp) in testVpnIngressDiscardRule_DuplicatedIpAddress_UpdateVpnAddress()
229 val vpnAgent = Agent(nc = vpnNc, lp = vpnLp) in testVpnIngressDiscardRule_DuplicatedIpAddress_UpdateNonVpnAddress()
241 val wifiAgent = Agent(nc = wifiNc, lp = wifiLp) in testVpnIngressDiscardRule_DuplicatedIpAddress_UpdateNonVpnAddress()
280 val wifiAgent = Agent(nc = wifiNc, lp = wifiLp) in testVpnIngressDiscardRule_UnregisterAfterReplacement()
[all …]
DCSDestroyedNetworkTests.kt40 val nc = NetworkCapabilities.Builder() in testDestroyNetworkNotKeptWhenUnvalidated() constant
53 val firstAgent = Agent(nc = nc) in testDestroyNetworkNotKeptWhenUnvalidated()
59 val secondAgent = Agent(nc = nc) in testDestroyNetworkNotKeptWhenUnvalidated()
DCSKeepConnectedTest.kt44 val nc = NetworkCapabilities.Builder() in testKeepConnectedLocalAgent() constant
48 val keepConnectedAgent = Agent(nc = nc, score = FromS(NetworkScore.Builder() in testKeepConnectedLocalAgent()
52 val dontKeepConnectedAgent = Agent(nc = nc, in testKeepConnectedLocalAgent()
DCSBlockedReasonsTest.kt91 val cellAgent = Agent(nc = cellNc()) in cellNc()
93 val wifiAgent = Agent(nc = wifiNc()) in cellNc()
129 val cellAgent = Agent(nc = cellNc()) in cellNc()
131 val wifiAgent = Agent(nc = wifiNc()) in cellNc()
183 val cellAgent = Agent(nc = cellNc()) in cellNc()
185 val wifiAgent = Agent(nc = wifiNc()) in cellNc()
247 val wifiAgent = Agent(nc = wifiNc()) in cellNc()
284 val wifiAgent = Agent(nc = wifiNc()) in cellNc()
324 val cellAgent = Agent(nc = cellNc()) in cellNc()
326 val wifiAgent = Agent(nc = wifiNc()) in cellNc()
[all …]
/packages/modules/Connectivity/service/src/com/android/server/connectivity/
DNetworkAgentInfo.java483 final NetworkCapabilities nc = new NetworkCapabilities(mDeclaredCapabilitiesUnsanitized); in getDeclaredCapabilitiesSanitized() local
484 if (nc.hasConnectivityManagedCapability()) { in getDeclaredCapabilitiesSanitized()
486 nc.removeAllForbiddenCapabilities(); in getDeclaredCapabilitiesSanitized()
488 if (networkCapabilities.getOwnerUid() != nc.getOwnerUid()) { in getDeclaredCapabilitiesSanitized()
490 + networkCapabilities.getOwnerUid() + " to " + nc.getOwnerUid()); in getDeclaredCapabilitiesSanitized()
491 nc.setOwnerUid(networkCapabilities.getOwnerUid()); in getDeclaredCapabilitiesSanitized()
493 restrictCapabilitiesFromNetworkAgent(nc, creatorUid, mHasAutomotiveFeature, in getDeclaredCapabilitiesSanitized()
495 return nc; in getDeclaredCapabilitiesSanitized()
632 @NonNull LinkProperties lp, @NonNull NetworkCapabilities nc, in NetworkAgentInfo() argument
642 Objects.requireNonNull(nc); in NetworkAgentInfo()
[all …]
/packages/modules/NetworkStack/src/com/android/networkstack/metrics/
DNetworkValidationMetrics.java67 public void startCollection(@Nullable NetworkCapabilities nc) { in startCollection() argument
72 mStatsBuilder.setTransportType(getTransportTypeFromNC(nc)); in startCollection()
90 public static TransportType getTransportTypeFromNC(@Nullable NetworkCapabilities nc) { in getTransportTypeFromNC() argument
91 if (nc == null) return TransportType.TT_UNKNOWN; in getTransportTypeFromNC()
93 final int trCount = nc.getTransportTypes().length; in getTransportTypeFromNC()
94 boolean hasCellular = nc.hasTransport(TRANSPORT_CELLULAR); in getTransportTypeFromNC()
95 boolean hasWifi = nc.hasTransport(TRANSPORT_WIFI); in getTransportTypeFromNC()
96 boolean hasBT = nc.hasTransport(TRANSPORT_BLUETOOTH); in getTransportTypeFromNC()
97 boolean hasEthernet = nc.hasTransport(TRANSPORT_ETHERNET); in getTransportTypeFromNC()
98 boolean hasVpn = nc.hasTransport(TRANSPORT_VPN); in getTransportTypeFromNC()
[all …]
/packages/modules/Connectivity/tests/unit/java/com/android/server/connectivityservice/base/
DCSAgentWrapper.kt73 val nc: NetworkCapabilities, in ArgumentCaptor() constant
112 nc, lp, lnc?.value, score.value, nac, provider) {} in ArgumentCaptor()
115 nc, lp, 50 /* score */, nac, provider) {} in ArgumentCaptor()
143 if (nc.transportTypes.isNotEmpty()) addTransportType(nc.transportTypes[0]) in ArgumentCaptor()
144 if (nc.hasCapability(NET_CAPABILITY_LOCAL_NETWORK)) { in ArgumentCaptor()
152 if (!nc.hasCapability(NET_CAPABILITY_NOT_SUSPENDED) && in ArgumentCaptor()
153 nc.hasTransport(TRANSPORT_CELLULAR)) { in ArgumentCaptor()
172 if (nc.transportTypes.isNotEmpty()) addTransportType(nc.transportTypes[0]) in ArgumentCaptor()
173 if (nc.hasCapability(NET_CAPABILITY_LOCAL_NETWORK)) { in ArgumentCaptor()
187 fun sendNetworkCapabilities(nc: NetworkCapabilities) = agent.sendNetworkCapabilities(nc) in ArgumentCaptor()
/packages/modules/Connectivity/service-t/src/com/android/server/ethernet/
DEthernetServiceImpl.java217 private void validateOrSetNetworkSpecifier(String iface, NetworkCapabilities nc) { in validateOrSetNetworkSpecifier() argument
218 final NetworkSpecifier spec = nc.getNetworkSpecifier(); in validateOrSetNetworkSpecifier()
220 nc.setNetworkSpecifier(new EthernetNetworkSpecifier(iface)); in validateOrSetNetworkSpecifier()
231 private void maybeValidateTestCapabilities(String iface, NetworkCapabilities nc) { in maybeValidateTestCapabilities() argument
235 if (!nc.hasTransport(TRANSPORT_TEST)) { in maybeValidateTestCapabilities()
241 private void maybeValidateEthernetTransport(String iface, NetworkCapabilities nc) { in maybeValidateEthernetTransport() argument
245 if (!nc.hasSingleTransport(TRANSPORT_ETHERNET)) { in maybeValidateEthernetTransport()
272 final NetworkCapabilities nc = request.getNetworkCapabilities(); in updateConfiguration() local
274 iface, nc != null, "updateConfiguration() with non-null capabilities"); in updateConfiguration()
275 if (nc != null) { in updateConfiguration()
[all …]
/packages/modules/Connectivity/tests/unit/java/android/net/util/
DKeepaliveUtilsTest.kt122 val nc = NetworkCapabilities() in testGetSupportedKeepalivesForNetworkCapabilities() constant
124 nc.transportTypes = intArrayOf(TRANSPORT_CELLULAR) in testGetSupportedKeepalivesForNetworkCapabilities()
125 assertEquals(3, KeepaliveUtils.getSupportedKeepalivesForNetworkCapabilities(cust, nc)) in testGetSupportedKeepalivesForNetworkCapabilities()
128 nc.transportTypes = intArrayOf(TRANSPORT_WIFI, TRANSPORT_VPN) in testGetSupportedKeepalivesForNetworkCapabilities()
129 assertEquals(0, KeepaliveUtils.getSupportedKeepalivesForNetworkCapabilities(cust, nc)) in testGetSupportedKeepalivesForNetworkCapabilities()
132 nc.transportTypes = intArrayOf(TRANSPORT_ETHERNET) in testGetSupportedKeepalivesForNetworkCapabilities()
133 assertEquals(0, KeepaliveUtils.getSupportedKeepalivesForNetworkCapabilities(cust, nc)) in testGetSupportedKeepalivesForNetworkCapabilities()
136 nc.transportTypes = intArrayOf(MAX_TRANSPORT + 1) in testGetSupportedKeepalivesForNetworkCapabilities()
138 KeepaliveUtils.getSupportedKeepalivesForNetworkCapabilities(cust, nc) in testGetSupportedKeepalivesForNetworkCapabilities()
/packages/modules/Connectivity/service/src/com/android/server/
DTestNetworkService.java193 @NonNull NetworkCapabilities nc, in TestNetworkAgent() argument
200 super(context, looper, TEST_NETWORK_LOGTAG, nc, lp, NETWORK_SCORE, config, np); in TestNetworkAgent()
263 NetworkCapabilities nc = new NetworkCapabilities(); in registerTestNetworkAgent() local
264 nc.clearAll(); // Remove default capabilities. in registerTestNetworkAgent()
265 nc.addTransportType(NetworkCapabilities.TRANSPORT_TEST); in registerTestNetworkAgent()
266 nc.addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_SUSPENDED); in registerTestNetworkAgent()
267 nc.addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED); in registerTestNetworkAgent()
268 nc.addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_VCN_MANAGED); in registerTestNetworkAgent()
269 nc.addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_VPN); in registerTestNetworkAgent()
270 nc.addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_BANDWIDTH_CONSTRAINED); in registerTestNetworkAgent()
[all …]
/packages/services/Iwlan/test/com/google/android/iwlan/
DIwlanNetworkServiceTest.java190 NetworkCapabilities nc = in testNetworkRegistrationInfoSearchingForCellularAndCstDisabled() local
192 mIwlanNetworkService.getNetworkMonitorCallback().onCapabilitiesChanged(mMockNetwork, nc); in testNetworkRegistrationInfoSearchingForCellularAndCstDisabled()
218 NetworkCapabilities nc = in testNetworkRegistrationInfoSearchingForCellularOnSameSubAndCstEnabled() local
220 mIwlanNetworkService.getNetworkMonitorCallback().onCapabilitiesChanged(mMockNetwork, nc); in testNetworkRegistrationInfoSearchingForCellularOnSameSubAndCstEnabled()
247 NetworkCapabilities nc = in testNetworkRegistrationInfoHomeForCellularOnDifferentSubAndCstEnabled() local
250 mIwlanNetworkService.getNetworkMonitorCallback().onCapabilitiesChanged(mMockNetwork, nc); in testNetworkRegistrationInfoHomeForCellularOnDifferentSubAndCstEnabled()
277 NetworkCapabilities nc = in testNetworkRegistrationInfoHomeForCellularVcnOnDifferentSubAndCstEnabled() local
279 mIwlanNetworkService.getNetworkMonitorCallback().onCapabilitiesChanged(mMockNetwork, nc); in testNetworkRegistrationInfoHomeForCellularVcnOnDifferentSubAndCstEnabled()
304 NetworkCapabilities nc = prepareWifiNetworkCapabilitiesForTest(); in testNetworkRegistrationInfoHomeForWiFiAndCstEnabled() local
305 mIwlanNetworkService.getNetworkMonitorCallback().onCapabilitiesChanged(mMockNetwork, nc); in testNetworkRegistrationInfoHomeForWiFiAndCstEnabled()
[all …]
/packages/modules/Telephony/services/QualifiedNetworksService/src/com/android/telephony/qns/
DIwlanNetworkStatusTracker.java189 final NetworkCapabilities nc = in onCrossSimEnabledEvent() local
191 if (nc != null && nc.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR)) { in onCrossSimEnabledEvent()
192 specifier = nc.getNetworkSpecifier(); in onCrossSimEnabledEvent()
193 TransportInfo transportInfo = nc.getTransportInfo(); in onCrossSimEnabledEvent()
468 NetworkCapabilities nc = mConnectivityManager.getNetworkCapabilities(network); in onAvailable() local
469 if (nc != null) { in onAvailable()
470 if (nc.hasTransport(NetworkCapabilities.TRANSPORT_WIFI)) { in onAvailable()
475 } else if (nc.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR)) { in onAvailable()
476 NetworkSpecifier specifier = nc.getNetworkSpecifier(); in onAvailable()
477 TransportInfo transportInfo = nc.getTransportInfo(); in onAvailable()
[all …]
/packages/modules/Wifi/service/java/com/android/server/wifi/
DWifiNetworkAgent.java74 @NonNull NetworkCapabilities nc, in WifiNetworkAgent() argument
79 super(context, looper, TAG, nc, lp, ConnectedScore.WIFI_INITIAL_SCORE, config, provider); in WifiNetworkAgent()
80 mCurrentNetworkCapabilities = nc; in WifiNetworkAgent()
142 public void sendNetworkCapabilitiesAndCache(@NonNull NetworkCapabilities nc) { in sendNetworkCapabilitiesAndCache() argument
143 mCurrentNetworkCapabilities = nc; in sendNetworkCapabilitiesAndCache()
144 super.sendNetworkCapabilities(nc); in sendNetworkCapabilitiesAndCache()
/packages/modules/Connectivity/tests/unit/java/com/android/server/connectivity/
DDnsManagerTest.java149 final NetworkCapabilities nc = new NetworkCapabilities(); in testTrackedValidationUpdates() local
150 nc.setTransportTypes(TEST_TRANSPORT_TYPES); in testTrackedValidationUpdates()
151 mDnsManager.updateCapabilitiesForNetwork(TEST_NETID, nc); in testTrackedValidationUpdates()
154 mDnsManager.updateCapabilitiesForNetwork(TEST_NETID_ALTERNATE, nc); in testTrackedValidationUpdates()
187 mDnsManager.updateCapabilitiesForNetwork(TEST_NETID, nc); in testTrackedValidationUpdates()
224 final NetworkCapabilities nc = new NetworkCapabilities(); in testIgnoreUntrackedValidationUpdates() local
225 nc.setTransportTypes(TEST_TRANSPORT_TYPES); in testIgnoreUntrackedValidationUpdates()
226 mDnsManager.updateCapabilitiesForNetwork(TEST_NETID, nc); in testIgnoreUntrackedValidationUpdates()
240 mDnsManager.updateCapabilitiesForNetwork(TEST_NETID, nc); in testIgnoreUntrackedValidationUpdates()
291 mDnsManager.updateCapabilitiesForNetwork(TEST_NETID, nc); in testIgnoreUntrackedValidationUpdates()
[all …]
/packages/modules/Connectivity/Tethering/src/com/android/networkstack/tethering/metrics/
DTetheringMetrics.java358 final NetworkCapabilities nc = (ns != null) ? ns.networkCapabilities : null; in transportTypeToUpstreamTypeEnum() local
359 if (nc == null) return UpstreamType.UT_NO_NETWORK; in transportTypeToUpstreamTypeEnum()
361 final int typeCount = nc.getTransportTypes().length; in transportTypeToUpstreamTypeEnum()
368 if (nc.hasTransport(TRANSPORT_CELLULAR)) return UpstreamType.UT_CELLULAR; in transportTypeToUpstreamTypeEnum()
369 if (nc.hasTransport(TRANSPORT_WIFI)) return UpstreamType.UT_WIFI; in transportTypeToUpstreamTypeEnum()
370 if (nc.hasTransport(TRANSPORT_BLUETOOTH)) return UpstreamType.UT_BLUETOOTH; in transportTypeToUpstreamTypeEnum()
371 if (nc.hasTransport(TRANSPORT_ETHERNET)) return UpstreamType.UT_ETHERNET; in transportTypeToUpstreamTypeEnum()
372 if (nc.hasTransport(TRANSPORT_WIFI_AWARE)) return UpstreamType.UT_WIFI_AWARE; in transportTypeToUpstreamTypeEnum()
373 if (nc.hasTransport(TRANSPORT_LOWPAN)) return UpstreamType.UT_LOWPAN; in transportTypeToUpstreamTypeEnum()
/packages/modules/Connectivity/Tethering/tests/unit/src/com/android/networkstack/tethering/
DTestConnectivityManager.java316 public TestNetworkAgent(TestConnectivityManager cm, NetworkCapabilities nc) { in TestNetworkAgent() argument
319 networkCapabilities = copy(nc); in TestNetworkAgent()
321 legacyType = toLegacyType(nc); in TestNetworkAgent()
332 private static int toLegacyType(NetworkCapabilities nc) { in toLegacyType() argument
334 if (matchesLegacyType(nc, type)) return type; in toLegacyType()
336 throw new IllegalArgumentException(("Can't determine legacy type for: ") + nc); in toLegacyType()
339 private static boolean matchesLegacyType(NetworkCapabilities nc, int legacyType) { in matchesLegacyType() argument
347 return typeNc.satisfiedByNetworkCapabilities(nc); in matchesLegacyType()
422 static NetworkCapabilities copy(NetworkCapabilities nc) { in copy() argument
423 return new NetworkCapabilities(nc); in copy()
/packages/modules/Connectivity/tests/unit/java/android/net/
DConnectivityManagerTest.java111 final NetworkCapabilities nc = ConnectivityManager.networkCapabilitiesForType(legacyType); in verifyNetworkCapabilities() local
112 assertNotNull(nc); in verifyNetworkCapabilities()
113 assertTrue(nc.hasTransport(transportType)); in verifyNetworkCapabilities()
115 assertTrue(nc.hasCapability(capability)); in verifyNetworkCapabilities()
118 return nc; in verifyNetworkCapabilities()
132 final NetworkCapabilities nc = verifyNetworkCapabilities( in verifyRestrictedMobileNetworkCapabilities() local
139 assertFalse(nc.hasCapability(NET_CAPABILITY_INTERNET)); in verifyRestrictedMobileNetworkCapabilities()
140 assertFalse(nc.hasCapability(NET_CAPABILITY_NOT_RESTRICTED)); in verifyRestrictedMobileNetworkCapabilities()
181 final NetworkCapabilities nc = verifyNetworkCapabilities( in testNetworkCapabilitiesForTypeMobileMms() local
188 assertFalse(nc.hasCapability(NET_CAPABILITY_INTERNET)); in testNetworkCapabilitiesForTypeMobileMms()
[all …]
/packages/apps/Settings/tests/robotests/src/com/android/settings/sim/
DSimSelectNotificationTest.java180 ArgumentCaptor<NotificationChannel> nc = ArgumentCaptor.forClass(NotificationChannel.class); in onReceiveEnableMms_notificationShouldSend() local
181 verify(mNotificationManager).createNotificationChannel(nc.capture()); in onReceiveEnableMms_notificationShouldSend()
183 assertThat(nc.getValue().getId()).isEqualTo(ENABLE_MMS_NOTIFICATION_CHANNEL); in onReceiveEnableMms_notificationShouldSend()
184 assertThat(nc.getValue().getName()).isEqualTo(mFakeNotificationChannelTitle); in onReceiveEnableMms_notificationShouldSend()
185 assertThat(nc.getValue().getImportance()).isEqualTo(IMPORTANCE_HIGH); in onReceiveEnableMms_notificationShouldSend()
289 ArgumentCaptor<NotificationChannel> nc = ArgumentCaptor.forClass(NotificationChannel.class); in onReceivePrimarySubListChange_DualCdmaWarning_notificationShouldSend() local
290 verify(mNotificationManager).createNotificationChannel(nc.capture()); in onReceivePrimarySubListChange_DualCdmaWarning_notificationShouldSend()
292 assertThat(nc.getValue().getId()).isEqualTo(SIM_WARNING_NOTIFICATION_CHANNEL); in onReceivePrimarySubListChange_DualCdmaWarning_notificationShouldSend()
293 assertThat(nc.getValue().getName()).isEqualTo(mFakeDualCdmaWarningChannelTitle); in onReceivePrimarySubListChange_DualCdmaWarning_notificationShouldSend()
294 assertThat(nc.getValue().getImportance()).isEqualTo(IMPORTANCE_HIGH); in onReceivePrimarySubListChange_DualCdmaWarning_notificationShouldSend()

1234567