summaryrefslogtreecommitdiff
path: root/framework/src/android/net/NetworkCapabilities.java
Commit message (Collapse)AuthorAgeFilesLines
* Add @RequiresPermission for setUnderlyingNetworkslucaslin2022-03-221-3/+17
| | | | | | | | | | | | | | | | | | setUnderlyingNetworks() is mainly for the NetworkAgents who hold the NETWORK_FACTORY to set its underlying networks. And the underlying networks are only visible and useful for the caller of getNetworkCapabilities() or the receiver of onCapabilitiesChanged() who hold one of NETWORK_FACTORY, NETWORK_SETTINGS and MAINLINE_NETWORK_STACK permissions. Otherwise, the underlying networks field will be cleard before sending. Bug: 205738644 Test: atest CtsNetTestCases:ConnectivityManagerTest atest CtsHostsideNetworkTests:HostsideVpnTests atest FrameworksNetTests Change-Id: Ife7630d9676a31ee5ab977cb1b87aec3b6fd7080
* Rename setAccessUids to setAllowedUidsChalard Jean2022-03-161-31/+32
| | | | | | | Bug: 217725769 Test: ConnectivityServiceTest CtsNetTestCases Change-Id: Ic8a3f91553d1462b7f54259c467fb90a950bdd59 Merged-In: I8860fbb353eedf5d01e9dc248e4d765046bd562c
* Use int array for included and excluded uidsSooraj Sasindran2022-03-161-5/+10
| | | | | | | | | Use int array for included and excluded uids so that uses same data type as in PreferentialNetworkServiceConfig Bug: 217365439 Test: ran connectivity service unit tests Change-Id: I9ac7e6498df2fd20b8397b2c110296e019c7389e
* Merge "Allow test+other networks to have specifiers"Remi NGUYEN VAN2022-02-141-3/+6
|\
| * Allow test+other networks to have specifiersRemi NGUYEN VAN2022-01-121-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | Allow adding a network specifier to networks that have two transports, if one of them is TRANSPORT_TEST. This allows creating test ethernet networks that have a network specifier. Bug: 175199512 Test: atest NetworkCapabilitiesTest Change-Id: I2ced91926dff21fbe143258f33f3d42004a954c7
* | Merge "Fix documentation link"Treehugger Robot2022-02-041-2/+2
|\ \
| * | Fix documentation linkKweku Adams2022-01-141-2/+2
| |/ | | | | | | Change-Id: I4b5e77a9007629914af37d7ec85ecdba4f922b87
* | Use packBitList to prevent long-related mistakesChalard Jean2022-02-021-37/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | In the following expression 1L << CONSTANT it is easy to forget the L, especially where it has not been necessary historically. This has happened in capabilities where they exceeded 30, see aosp/1928394. Use the new packBitList to avoid repeats of the same mistake. Test: FrameworksNetTests Change-Id: Ic6a1aa9254bf9ad222c3e2fe4f52bb89a1f9c4e5
* | Expose access UIDs.Chalard Jean2022-01-311-6/+6
| | | | | | | | | | | | | | | | CTS already have basic tests for this since they run the common tests, which were using these hidden methods already. Test: CtsNetTestCases Change-Id: Id5e5b911f5c63bdd3b05e5ac1d3dd89c1c525ab7
* | Send access UIDs to netdChalard Jean2022-01-311-0/+7
| | | | | | | | | | Test: FrameworkNetTests CtsNetTestCases Change-Id: I8301abaddf5850071fa23d41e8e736ab7071e299
* | Add accessUids to NetworkCapabilities.Chalard Jean2022-01-311-11/+139
| | | | | | | | | | | | | | | | For now, all entry points reject this. Followup changes will allow the supported use cases. Test: new unit tests and CTS for this in this patch Change-Id: I7262811a2e46336d3bb63c80886fc0578a36da94
* | Add low latency and high bandwidth network capabilitiesSooraj Sasindran2022-01-251-1/+15
| | | | | | | | | | | | Bug: 194332512 Test: build Change-Id: I415ca1ba90ea54c4106f806fe855bcb84d3e38ba
* | Add support for Multiple enterprise sliceSooraj Sasindran2022-01-221-93/+110
|/ | | | | | | Bug: 194332512 Test: unit test CTS-Coverage-Bug: 211133973 Change-Id: Ie8be08a7cfa9155168d1da146d02fd1643248bdc
* Add enterpriseSpecifierSooraj Sasindran2021-12-231-2/+185
| | | | | | | | | Add enterpriseSpecifier to network capability Bug: 194332512 CTS-Coverage-Bug: 211133973 Test: CTS and unit test. Change-Id: If16c8e17cee71cc6788c43a8818bcca68a00bf99
* Added a new network capability MMTELJack Yu2021-12-211-1/+8
| | | | | | | | | | | | | | | Added NET_CAPABILITY_MMTEL to indicate a network support MMTEL (Multimedia telephony). This is for IMS service to request an IMS network that supports voice or PS (VoPS for 4G, VoNR for 5G). This was previously submitted as aosp/1927841, but which got reverted due to breaking the mainline build, which uses the pre-built module. Bug: 210774375 Test: atest ConnectivityServiceTest Change-Id: If8b691ff4999a4dbf54e7567d9ca74d743dc5ded
* Revert "Added a new network capability MMTEL"Martijn Coenen2021-12-211-8/+1
| | | | | | | | | | | | | | | | | Revert "Added setup/tear down data support" Revert "Added a new network capability MMTEL" Revert submission 1927643-mmtel_capability Reason for revert: b/211586152 Reverted Changes: Ifea8b1e40:Added a new network capability MMTEL I38655bef2:Added a new network capability MMTEL I837606d9e:Added setup/tear down data support I2c7b291fe:Added a new network capability MMTEL Change-Id: Ie9b0b0d9017ef8aea7fbb56dda522e7c433144b9
* Added a new network capability MMTELJack Yu2021-12-161-1/+8
| | | | | | | | | | | Added NET_CAPABILITY_MMTEL to indicate a network support MMTEL (Multimedia telephony). This is for IMS service to request an IMS network that supports voice or PS (VoPS for 4G, VoNR for 5G). Bug: 210774375 Test: atest ConnectivityServiceTest Change-Id: Ifea8b1e40f65c610e925a27be873930fee2df693
* Genericize NC#hasSameUidsChalard Jean2021-12-161-24/+2
| | | | | | | This will be used by another set of UIDs in a future patch Test: FrameworksNetTests Change-Id: I2c5d18ef93e73b702723814592ef3f3baf5dfbc4
* Mark arg to NC#appliesToUidRange non-nullChalard Jean2021-12-131-1/+1
| | | | | | | | This is always non-null, and if it's not it has a good chance to throw anyway Test: m Change-Id: I1020ab9e6eb546390325cf6aa4d30183b2e69785
* Remove NetworkCapabilities#combine*Chalard Jean2021-12-131-143/+0
| | | | | | | | | | | | | | | | This is no longer used outside of tests, and can be safely removed. Also this family of methods is fairly confusing, as while it's well defined for some members, many later additions had to be written so as to dissallow some combinations when the workings of this family of methods didn't match the semantics of some members, making them possibly dangerous to use and at least exhibit difficult to understand semantics. Test: FrameworksNetTests m Change-Id: Ia69c20afa16c2153839891f6e33331caa9da33ff
* Merge "Qualify references to WifiNetworkSuggestions"Anton Hansson2021-10-211-9/+8
|\
| * Qualify references to WifiNetworkSuggestionsAnton Hansson2021-10-201-9/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Connectivity's metalava invocation does not depend on framework-wifi, so these references fail to resolve, and as a result metalava currently removes the import. Fully qualify the references instead, to avoid both metalava trying to resolve the dependency, and having to depend on framework-wifi just for javadoc. Bug: 186197911 Test: build the sdk (with connectivity module stubs as input) Change-Id: I7129821b9a0d08d06f8e977a3c17fa5f5f6f9cee
* | Add underlying networks into NetworkAgentInfo if anylucaslin2021-10-191-2/+5
|/ | | | | | | | | | Now, VPN will set underlying networks into NetworkCapabilities directly. So the declaredUnderlyingNetworks can also be set directly when creating a NetworkAgentInfo. Bug: 191918368 Test: atest FrameworksNetTests:ConnectivityServiceTest Change-Id: I507072d00ae1eb0c391e5261ab93e359b9c4cb5c
* Add new APIs in NetworkCapabilities to set and get underlying networkslucaslin2021-10-151-2/+74
| | | | | | | | | | | | Previously, the caller can only know about the transport type of the underlying network. The information might not be enough if the device support WiFi STA+STA. Thus, provide an API for the caller to get the correct underlying network. Bug: 191918368 Test: atest FrameworksNetTests:NetworkCapabilitiesTest Change-Id: I7752b2356770f4572f6ca4cbaecaa45c09d6d72f
* Add a mode for cell radios unable to time shareChalard Jean2021-09-181-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Upon changing the default SIM card, the radio will create a new connection to the new subscription. If that subscription works correctly, the stack will prefer it to the old one as the new subscription will be marked with a Primary policy flag it its score. Normally, at this point the old network lingers to give apps an opportunity to gracefully migrate their connections. But with some radios, this may have a dramatic effect on the performance of the new connection. This patch introduces a flag so that devices with such radios can be marked. In this case the stack will move to a degraded mode and eschew the grace delay for apps and give them a hard break instead, so that the new network can reach a good performance immediately. Apps with existing connections will suffer a worse experience. If there is a request that can only be served by the old connection, still keep it, as arguably the user still expects their MMS be sent on the old connection, even if the new connection doesn't work well until it's done. Test: new test in this patch, and add relevant tests in both modes also manually change the value of the flag and run FrameworksNetTests and CtsNetTestCasesLatestSdk Bug: 200226979 Change-Id: I4ace82f90e873bf06298cc689bb1d794ed5124bd
* Separate test into reasonable multiple testsChiachang Wang2021-08-171-1/+1
| | | | | | | | | | The test actually verifies multiple behaviors and mutates the networkCapabilities. Thus, refactor the method to keep the tests easier to follow up. Bug: 191918212 Test: atest android.net.NetworkCapabilitiesTest Change-Id: Ibad1a0569d26d92f94153bee323cef5a1c30d8d4
* Fix NetworkCapabilities MTS on S, CTS on S+moduleRemi NGUYEN VAN2021-08-161-0/+13
| | | | | | | | | | | | | | | restrictCapabilitiesForTestNetwork was renamed after S release to be included in a mainline release, but this causes the MTS test to fail on S if the Connectivity module is not updated, and CTS to fail if the connectivity module is updated. Mark the test as @ConnectivityModuleTest so it can be skipped on non-connectivity module MTS tests (such as NetworkStack tests), and add back the previous method name to keep CTS passing. Bug: 196755836 Test: atest NetworkCapabilitiesTest Change-Id: Ibd6c2e62e5949ec6d93e9f6e4fc05129c29b94f8
* The net cap value should be bit shifted before &ingChiachang Wang2021-08-111-2/+2
| | | | | | | | | | | The check intends to do the bit & operation. The net cap value should be shifted against the original capabilities. Also fix the typo in the method name. Bug: 191918212 Test: atest FrameworksNetTests Change-Id: I98396b2538f36fe8b29d27a544a2dfb3060bc9c5
* Add new network capabilities to support automotive head unit via USBlucaslin2021-07-081-4/+21
| | | | | | | | | | | | | | | | | | | - Add a new transport type for USB and a new network capability to support automotive head unit. - In order to pass DnsManagerTest#testTransportTypesEqual, Android.bp needs to link to dnsresolver_aidl_interface-V8-java. That test checks whether the TRANSPORT types defined in NetworkCapabilities are the same as IDnsResolver.aidl. (clean cherry-pick of change in downstream branch history, original change ID before project move: Iec2df09a776d779108f95098e01b7ffdf6f8867a) Bug: 181742019 Test: atest FrameworksNetTests Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f Change-Id: Ie438ec68577ebdaaf990795fa27f1169b0105411
* Merge "Send a proxy broadcast when apps moved from/to a VPN"Lucas Lin2021-06-151-13/+23
|\
| * Send a proxy broadcast when apps moved from/to a VPNlucaslin2021-06-081-13/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the apps moved from/to a VPN, a proxy broadcast is needed to inform the apps that the proxy might be changed since the default network satisfied by the apps might also changed. Since the framework does not track the defautlt network of every apps, thus, this is done when: 1. VPN connects/disconnects. 2. List of uids that apply to the VPN has changed. While 1 is already covered by the current design, the CL implements 2 in order to fulfill the case that different networks have different proxies. Bug: 178727215 Test: atest FrameworksNetTests Change-Id: Ifa103dd66394026d752b407a1bee740c9fcdad2b
* | Keep subIds for Test NetworkCapabilities.Cody Kesting2021-06-091-0/+4
|/ | | | | | | | | | | | This CL updates NetworkCapabilities to retain configured subscription IDs for Test NetworkCapabilities. Previously, they were cleared in restrictCapabilitiesForTestNetwork(). Bug: 182291467 Bug: 189125789 Test: atest Ikev2VpnTest IpSecManagerTunnelTest Test: atest CtsVcnTestCases Change-Id: I0e1bc617910c9e8ac7b431572f276b1611acc1cb
* Merge "Replace clearAll with withoutDefaultCapabilities"Chiachang Wang2021-05-171-11/+15
|\
| * Replace clearAll with withoutDefaultCapabilitiesChiachang Wang2021-05-141-11/+15
| | | | | | | | | | | | | | | | | | | | | | As the feedback from API review, the clearAll method in Builder does not match the actual usage. Thus, remove it and replace with withoutDefaultCapabilities to provide clearer usage. Bug: 184735772 Test: make update-api ; m Change-Id: Ida8d25d57504864f046e3403f593cc606fbfe982 Merged-In: Ida8d25d57504864f046e3403f593cc606fbfe982
* | Do not automatically redact TransportInfo objects.Lorenzo Colitti2021-05-131-17/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, NetworkCapabilities always redacts the TransportInfo objects it contains whenever a defensive copy is made. This makes it impossible to make a defensive copy on a TransportInfo parcelled from another process without redacting it. Stop redacting by default; instead rely on ConnectivityService explicitly calling NetworkCapabilities' redacting constructor when it returns a NetworkCapabilities object to an app via a callback or synchronous call. This is currently done by - createWithLocationInfoSanitizedIfNecessaryWhenParceled, which is called from callCallbackForRequest, getNetworkCapabilities, and getDefaultNetworkCapabilitiesForUser. - getNetworkCapabilitiesWithoutUids, which is used when sending ConnectivityDiagnosticsManager callbacks. In this method, unconditionally redact all information, which is what the code did previously due to the default redaction setting for empty NetworkCapabilities objects being REDACT_ALL. Bug: 183938194 Test: atest NetworkCapabilitiesTest Test: atest FrameworksNetTests CtsNetTestCases HostsideVpnTests Change-Id: I3108ee94cb0930958e071ba678c3554525b0db82
* | Merge "Allow any transport with TEST if the network is restricted"Chalard Jean2021-05-121-4/+14
|\ \
| * | Allow any transport with TEST if the network is restrictedChalard Jean2021-05-111-4/+14
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | This will allow CTS to add the WIFI transport and others, letting them test a number of essential features of the ranking algorithm. It's relatively safe because restricted networks can never become the default, and NOT_RESTRICTED is a default capability so very few apps would be affected by the shell creating such a network. Bug: 184037351 Test: NetworkScoreTest (which is under review) Change-Id: I21055dc613fead6130adc2122f2cdd0af9b49adf
* | Merge "Rename unwanted capabilities to forbidden capabilities."Lorenzo Colitti2021-05-121-46/+46
|\ \
| * | Rename unwanted capabilities to forbidden capabilities.Lorenzo Colitti2021-05-111-46/+46
| |/ | | | | | | | | | | | | | | | | Addresses API council feedback. Bug: 184890428 Test: atest FrameworksNetTests CtsNetTestCases Test: atest CtsNetTestCasesLatestSdk:NetworkCapabilitiesTest on R device Change-Id: Id7c68fbf56ee08fcad8e8e3aacf037fa1885936b
* | Merge "Emphasize possibility of multiple networks with same transport"David Su2021-05-111-1/+2
|\ \ | |/ |/|
| * Emphasize possibility of multiple networks with same transportDavid Su2021-03-051-1/+2
| | | | | | | | | | | | Bug: 180125982 Test: compiles Change-Id: I70d312c29b7d7b773ebb8d70043f239a6c1aae15
* | [VCN19] Rename get/setSubIds to get/setSubscriptionIdsjunyulai2021-04-191-10/+10
| | | | | | | | | | | | | | | | Test: atest FrameworksNetTests FrameworksVcnTests Fix: 185215036 Merged-In: I9d90df5fc13b36d2cdc4920b456dcc87fcd2b3a7 Change-Id: I9d90df5fc13b36d2cdc4920b456dcc87fcd2b3a7 (cherry-picked from ag/14198665)
* | Merge "Remove Network, NetworkRequest metrics from jobscheduler"Aaron Huang2021-04-081-29/+0
|\ \
| * | Remove Network, NetworkRequest metrics from jobschedulerAaron Huang2021-04-071-29/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These metrics are deprecated so remove them from jobscheduler. Also remove dumpDebug method from Network, NetworkRequest and NetworkCapabilities because there's no caller anymore. This change also for connectivity mainline module. These three classes are inculded in framework-connectivity so external module cannot have dependencies on its hidden API. With this change, the dependencies can be removed. (cherry-picked from ag/13959431) Bug: 178777253 Test: FrameworksNetTests JobStoreTest adb shell dumpsys jobscheduler --proto CtsIncidentHostTestCases:JobSchedulerIncidentTest Merged-In: Ie0c540303ba06b8fba029d2b98ae753afb08c963 Change-Id: Ie0c540303ba06b8fba029d2b98ae753afb08c963
* | | Merge "Assign the bit calculation as long to prevent overflow"Chiachang Wang2021-04-071-8/+9
|\ \ \
| * | | Assign the bit calculation as long to prevent overflowChiachang Wang2021-04-071-8/+9
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The value should be assigned as a long to do the bit calculation as the mNetworkCapabilities is intended to be a long. Otherwise, the value will be temporary assigned into an integer then assigned to the target long. When the bit shift calculation is out of the integer scope, the calculation will overflow and result in unexpected bebavior. Without assigning to a long, ConnectivityServiceTest will get Out-Of-Memory in StringBuilder while generating toString() in NetworkCapabilities after updating tests to verify NET_CAPABILITY_VSIM and NET_CAPABILITY_BIP. Bug: 130869457 Test: atest FrameworksNetTests Change-Id: I4d34c1215c7efb6dc352c314107792e3fa512ad7
* | | Merge "ConnectivityManager: Address review comments from aosp/1595396"Treehugger Robot2021-04-071-1/+3
|\ \ \
| * | | ConnectivityManager: Address review comments from aosp/1595396Roshan Pius2021-04-061-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug: 156867433 Test: atest android.net Test: atest com.android.server Change-Id: I7f5d043732ae22edd14bf581b7dc676c9236b545
* | | | NetworkCapabilities: Hide copy constructorRoshan Pius2021-04-051-1/+0
| |/ / |/| | | | | | | | | | | | | | | | | | | | Only used by connectivity service, no need to mark it public. Bug: 184537591 Test: Compiles Change-Id: Ie0d515d73e30a4e15141a3d92aa739192badeb13
* | | Merge "Downgrade list of subIds in NetworkCapabilities to @SystemApi"Benedict Wong2021-04-021-0/+13
|\ \ \