summaryrefslogtreecommitdiff
path: root/Tethering/tests/unit/src
Commit message (Collapse)AuthorAgeFilesLines
* Prepare for refactoring wifi ipserver start/stopmarkchien2022-05-171-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a preparing change. 1) In enableWifiIpServing, replace ensureIpServerStarted(ifname) + changeInterfaceState(ifname, ipServingMode) with enableIpServing(TETHERING_WIFI, ifname, ipServingMode). And checking whether corresponding wifi or p2p feature is avaialble before enableWifiIpServing. Note: If the wifi or p2p feature wasn't supported before, it would still call changeInterfaceState without ipServer created but changeInterfaceState would be no-op because there is no corresponding ipServer for changing state. 2) Splitting enableWifiIpServing into enableWifiIpServing and enableWifiP2pIpServing. 3) No longer guess the interface name after T. WIFI_AP_STATE_CHANGED intent should always include ifname and it should be tracked by mTetherStates. If OEM have modification in wifi framework to send empty ifname, tethering no longer support this after T. 4) After T, tethering always trust the ifname which pass by wifi or p2p intent broadcast and treat it as TETHERING_WIFI or TETHERING_WIFI_P2P. This allow tethering to deprecate wifi/p2p regexs after T. Bug: 189410000 Bug: 178116595 Bug: 185451791 Bug: 190145323 Bug: 176048959 Test: atest TetheringTests Change-Id: Ia5f69ddf2d842536ce0df75eeae57866f56df571 (cherry picked from commit f2e9409f55a71846d5ec2dd120ba83e3b3773d09) Merged-In: Ia5f69ddf2d842536ce0df75eeae57866f56df571
* Merge "[Tetheirng] Refactor carrier config to EntitlementManager"Tom Hsu2022-04-212-29/+61
|\
| * [Tetheirng] Refactor carrier config to EntitlementManagertom hsu2022-04-212-29/+61
| | | | | | | | | | | | | | | | | | | | - To reduce CarrierConfigManager access times, move CarrierManager to TetheringConfiguration. Bug: 225900149 Test: atest EntitlementManagerTest pass Test: atest TetheringConfigurationTest pass Change-Id: I5b206e2bc012cbbca26fb1e5c72558383981f183
* | Merge "Add onSupportedTetheringType callback"Mark Chien2022-04-201-17/+59
|\ \
| * | Add onSupportedTetheringType callbackmarkchien2022-04-201-17/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This new callback could tell caller Tethering is supported for what tethering types. Bug: 184996041 Test: atest TetheringTests atest EthernetTetheringTest CTS-Coverage-Bug: 223340235 Change-Id: Ib80ed8d7f73f4a098b8965db186d24d8cf1884d3
* | | Merge "Move TetherStatsKey and TetherStatsValue to common libs"Treehugger Robot2022-04-192-2/+4
|\ \ \ | |/ / |/| |
| * | Move TetherStatsKey and TetherStatsValue to common libsHungming Chen2022-04-042-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | EthernetTetheringTest needs to parse BPF map content for bpf stats tests. Move the struct class files to common libs. Compare TetherStats{Key, Value}.java between frameworks/libs/net/common and packages/modules/Connectivity/Tethering. There is only the package name change as expected. $ diff packages/modules/Connectivity/Tethering/src/com/android/networkstack/tethering/TetherStatsKey.java frameworks/libs/net/common/device/com/android/net/module/util/bpf/TetherStatsKey.java 17c17 < package com.android.networkstack.tethering; Bug: 227159997 Test: atest TetheringCoverageTests Change-Id: I87193cb6409b4d19c72184011d7e99275800dab1
* | | Merge "Add config_p2p_leases_subnet_prefix_length configuration"Mark Chien2022-04-062-0/+40
|\ \ \ | |/ / |/| |
| * | Add config_p2p_leases_subnet_prefix_length configurationmarkchien2022-03-312-0/+40
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add new rro configuration which can be used to make the p2p dhcp prefix length larger to reserve the address range outside of leases subnet prefix length for EAPOL-Key feature. This configuration only valid if its value larger than dhcp server address prefix length and config_tether_enable_legacy_wifi_p2p_dedicated_ip is true. E.g.:leaseSubnetPrefixLength = 25, p2p static address = 192.168.49.1/24 dhcp range: 192.168.49.0 ~ 192.168.49.127 (192.168.49.1/25), reserved 192.168.49.128 ~ 192.168.49.255 for EAPOL-Key feature. Bug: 170056953 Test: atest TetheringTests Change-Id: I1319efd871796da7234383a29ab64a1623101ae7
* | Add test for tetherOffloadClient{Add, Remove, Clear}Hungming Chen2022-03-301-11/+90
| | | | | | | | | | | | | | | | also remove the redundant constructor definition in test key/value class builder. Test: atest TetheringCoverageTests Change-Id: Icf93d4f196846c82c3a1c2b2b8697f4a5156ea92
* | Add test for tetherOffloadRule4ClearHungming Chen2022-03-301-0/+190
|/ | | | | | | Test that clear IPv4 offload rules once tethering stopped Test: atest TetheringCoverageTests Change-Id: I107b15bef2a15f7c85236f2801c43288fe7d0f4d
* Merge "[DU04-4]Appropriate changes to the NetworkPolicyManager API"Frank Li2022-03-161-4/+11
|\
| * [DU04-4]Appropriate changes to the NetworkPolicyManager APIFrank2022-03-161-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | Divide the NetworkPolicyManager API notifyStatsProviderWarningOrLimitReached into the following two APIs: 1. notifyStatsProviderWarningReached() 2. notifyStatsProviderLimitReached() Bug: 216474563 Test: atest NetworkStatsServiceTest NetworkPolicyManagerTest NetworkPolicyManagerServiceTest OffloadControllerTest Change-Id: I473b8b677d492a7076e63f445b3a3be24d25e14d
* | Merge "Add a carrier config to block tethering."Tom Hsu2022-03-161-11/+115
|\ \ | |/ |/|
| * Add a carrier config to block tethering.Meng Wang2022-03-161-11/+115
| | | | | | | | | | | | | | | | | | | | When KEY_CARRIER_SUPPORTS_TETHERING_BOOL=false, it will behave as if entitlement check failed and a system notifcation shows up if user tries to turn on tethering from Settings UI. Bug: 161206517 Test: manual Change-Id: I78da390ecb0c8f4f68285ef16da80653f136c11e
* | Merge changes I5af6ce96,Ibc1f6813Nucca Chen2022-03-111-150/+326
|\ \ | |/ |/| | | | | | | * changes: Refactor make{Tether4Key, Tether4Value ConntrackEvent} helper BpfCoordinatorTest: refactor upstream and downstream setup functions
| * Refactor make{Tether4Key, Tether4Value ConntrackEvent} helperHungming Chen2022-02-221-95/+216
| | | | | | | | | | | | | | | | | | | | | | | | Used for reducing the increasing amount of helper in the follow-up commits. Tether4Key, Tether4Value ConntrackEvent need many arguments to build a testing instance. Any new argument combination may require a new helper. It is hard to compare the difference while reading the code. Test: atest BpfCoordinatorTest Change-Id: I5af6ce9609b97d124227750cd1c5337796982c58
| * BpfCoordinatorTest: refactor upstream and downstream setup functionsHungming Chen2022-02-221-65/+120
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is preparation for tetherOffloadRule4Clear test. - Upstream interface can be set {null, cellular (rawip), wifi (ether)} - Allow that add up to two downstream interfaces which has one client on each of them. - Change mBpfDownstream4Map and mBpfUpstream4Map from mocked instance to TestBpfMap for further rule check. - Remove startPolling() from initBpfCoordinatorForRule4() because upstream information is updated by updateUpstreamNetworkState now. Test: atest TetheringCoverageTests Change-Id: Ibc1f68131410b7cec379ab4e310b90ad85f25d31
* | Merge "Make isTetheringSupported respect all tethering downstreams"Mark Chien2022-03-071-6/+56
|\ \
| * | Make isTetheringSupported respect all tethering downstreamsmarkchien2022-03-071-6/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently if wifi, usb and bluetooth tethering is not supported, isTetheringSupported would return false. Then ethernet, ncm tethering and wifi p2p would also not be supported anymore. Make isTetheringSupported respect all tethering downstreams after T. Also remove redundant code: 1. tethering always has upstream configuration, checking whether has upstream configuration for isTetheringSupported is useless. 2. Remove TetheringDependencies#isTetheringSupported because it don't have any caller. Test: atest TetheringTests Change-Id: I3db5ce410c064d37c9e9e704fce2a2b68705834e
* | | Merge changes from topic "dedup-interfaceparams"Maciej Żenczykowski2022-03-053-3/+3
|\ \ \ | |/ / |/| | | | | | | | | | | * changes: Remove unused InterfaceParams jarjar rule Deduplicate InterfaceParams
| * | Deduplicate InterfaceParamsPatrick Rohr2022-03-043-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | CS should use InterfaceParams from frameworks/libs/net. Test: builds Bug: 222448728 Change-Id: I1f45d3171b265461a8724b4be7b212c030b63fe9
* | | Merge "Pass whole TetheringConfiguration to IpServer"Mark Chien2022-03-032-9/+10
|\ \ \
| * | | Pass whole TetheringConfiguration to IpServermarkchien2022-03-032-9/+10
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | This is a no-op CL that passing whole TetheringConfiguration to IpServer to reduce the number of IpServer constructor parameters. Bug: 170056953 Test: atest TetheringTests Change-Id: I4ec17f7ecaefd7f275139ad9c7f7551635b192c9
* / / Remove tether_enable_select_all_prefix_ranges flagmarkchien2022-03-022-28/+0
|/ / | | | | | | | | | | | | | | | | | | The tether_enable_select_all_prefix_ranges is added from M2020-12 for quick roll back the feature. Since feature is landed over a year without any problem, remove the flag now. Bug: 171269957 Test: atest TetheringTests Change-Id: I3ef414a47dd0a1f80ea2d378601ccd7c14067318
* / Notify linkproperties change in all scenariosPavan Kumar M2022-02-252-0/+71
|/ | | | | | | | | | | | | | | | | | | | In scenarios where linkproperties event is received on default internet callback, linkproperties are cached and network state is updated with new link properties but Tethering class is notified about the change. Later when event is received on mobile request or listen all cb, since the network state is already updated with these linkproperties, change in link properties will not be notified. This results in tethering failures where the ip addresses of the tethering interface will not be updated. This change handles this issue by triggering the link properties change in all scenarios. Update the correponding test case as well. Tests: Builds, Boots, TetheringTests Bug: 216281561 Change-Id: I7452ed07d2665843c86141764b71aab0c00417fe
* Move Tether4Key and Tether4Value to common libsHungming Chen2022-02-092-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | EthernetTetheringTest needs to parse BPF map content for IPv4 forwarding rule tests. Move the struct class files to common libs. Compare Tether4{Key, Value}.java between frameworks/libs/net/common and packages/modules/Connectivity/Tethering. There is only the package name change as expected. $ diff packages/modules/Connectivity/Tethering/src/com/android/networkstack/tethering/Tether4Key.java frameworks/libs/net/common/device/com/android/net/module/util/bpf/Tether4Key.java 17c17 < package com.android.networkstack.tethering; --- > package com.android.net.module.util.bpf; $ diff packages/modules/Connectivity/Tethering/src/com/android/networkstack/tethering/Tether4Value.java frameworks/libs/net/common/device/com/android/net/module/util/bpf/Tether4Value.java 17c17 < package com.android.networkstack.tethering; --- > package com.android.net.module.util.bpf; Test: atest TetheringCoverageTests Change-Id: I73c180fa4129aefde1e64ecbafe928f388b061d6
* Extract TestBpfMap from BpfCoordinatorTest.Lorenzo Colitti2022-02-031-59/+1
| | | | | | | | The class is being moved to a common test utils location in another CL in this topic. Test: atest BpfCoordinatorTest Change-Id: Ibf8dae3e05aacaea4f7c3fe8229d87e1ad6a68d5
* Use new bluetooth API to enable/disable bt tethering after Tmarkchien2022-01-172-17/+124
| | | | | | | | | | | | | This change only apply to the device after T. Use new bluetooth API to change bluetooth tethering settings and the new API provide the callback to to notify Tethering when bluetooth interface is ready. Tethering doesn't use bluetooth interface status change event from netlink to add/remove IpServer anymore. Tag: #feature Bug: 190438212 Test: TetheringTest Change-Id: Iae92d98d500f83b116da7282cf1130fb8fecf53d
* Reuse BluetoothPan object and use it under tethering handler threadmarkchien2021-12-161-21/+81
| | | | | | | | | | | 1. Instead of create BluetoothPan every time when tethering need to use it, store it with mBluetoothPan and resue it. 2. Call BluetoothPan function under tethering handler thread. Bug: 190438212 Test: atest TetheringTests Change-Id: I40adece59960ec44a02dc438d6bd95483a0788af
* Rename tethering util folder and its package namemarkchien2021-11-096-7/+8
| | | | | | | | | | | | | | Move tethering util files from android.net.util into com.android.networkstack.tethering.util. The goal is move all of tethering internal files into its own namespace com.android.networkstack.tethering.util. Bug: 205088391 Test: atest TetheringTests atest CtsTetheringTest atest TetheringPrivilegedTests Change-Id: I6559fb4f873b3cad5b210b10e49df1b6c6914a70
* Merge "bpfmap: Move to Common Location"Maciej Żenczykowski2021-11-042-1/+2
|\
| * bpfmap: Move to Common LocationTyler Wear2021-10-292-1/+2
| | | | | | | | | | | | | | Move bpfmap to frameworks/libs/net/common/native. Bug: 179733303 Change-Id: Id08b216ec6a64968d66d7990f91ea7ce222a1154
* | Unregister the tethering internal callback in finalizemarkchien2021-10-201-2/+1
| | | | | | | | | | | | | | | | Bug: 177265744 Bug: 191798390 Bug: 187972579 Test: atest TetheringServiceTest Change-Id: Ie7f9535b923db5073a59329ead22546a54e6ef47
* | Test TetheringManager could be GC after getting connectormarkchien2021-10-201-8/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | There is pollingConnector thread which start polling connector if TetheringManager is created earlier than TetheringService started(during device boot up). TetheringManager won't be GCed if pollingConnector thread do not finish its task yet. Bug: 177265744 Bug: 191798390 Bug: 187972579 Test: atest TetheringServiceTest Change-Id: Id8c7d10c5172e1d5de460c5311ff9c20261facef
* | Fix TetheringManager memory leakmarkchien2021-10-142-4/+47
|/ | | | | | | | | | | | | | | | | | | | | TetheringCallbackInteranl is inner class which explicitly reference TetheringManager object. This causes TetheringManager can't be GC. Using static nested class which has its own lifecycle and weak reference TetheringManager object. Still have a leak inside Tethering that TetheringCallbackInternal is never unregistered. Currently it rely on binder died to remove the reference, which usually happen in kill process. If process keep alive, the TetheringCallbackInternal would not be freed even TetheringManager is gone. Will have follow CL to fix this. Bug: 177265744 Bug: 191798390 Bug: 187972579 Test: 1. lunch Settings with ON/OFF tethering, dump java heap. 2. close Settings and restart Settings again, dump java heap. 3. Compare java heap between step 1 and step 2. Change-Id: I0e2a21b7988115098a033a581cd98da8bffe2791
* Merge "Replace inexact alarm setRepeasting with setExact alarm"Treehugger Robot2021-08-301-1/+50
|\
| * Replace inexact alarm setRepeasting with setExact alarmmarkchien2021-08-121-1/+50
| | | | | | | | | | | | | | | | | | Use exact alarm to fix entilement recheck delay problem while device asleep. Bug: 195370891 Test: atest TehteringTests Change-Id: I409e603bf2b990657551e1140b50f69640c328d8
* | Refactor the offload permission check and add testsHungming Chen2021-08-261-6/+49
|/ | | | | | | | | | | - Rename the conntrack destination port check function - Use CollectionUtils.contains to check the denied ports - Add tests for the streams with ftp and pptp tcp port are not able to be offloaded Bug: 195914327 Test: atest TetheringCoverageTests Change-Id: I7e2591bea1f6db46271efb0c30970fb8d4efe1e4
* Merge "Import net-utils-device-common-netlink instead of netlink-client."Xiao Ma2021-08-043-17/+18
|\
| * Import net-utils-device-common-netlink instead of netlink-client.Xiao Ma2021-07-213-17/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | After moving all netlink-client stuff to frameworks/libs/net/common and build it as an individual library, deprecate the netlink-client lib and use net-utils-device-common-netlink instead. Due to that the package name of netlink lib has changed, also update the package name used in Tethering and ConnectivityService module. Bug: 192535368 Test: atest TetheringTests TetheringIntegrationTests Change-Id: Ic2078caf67a640836d98c5a2e4ca89939adcb896
* | Remove hidden ArrayUtils usage in TetheringTestRemi NGUYEN VAN2021-07-281-2/+3
|/ | | | | | | | | | | | | Use CollectionUtils instead, which avoids using a hidden API. Avoiding hidden API usage in tests is good in general, but this also helps avoid jarjar problems where the com.android.internal.util package is jarjared to some other package as some of its classes are included in the module, and ArrayUtils cannot be found in the renamed package. Bug: 192535368 Test: atest TetheringTest Change-Id: I54dc8f6429d132a953ab1a674fe349fba4335936
* Merge changes I6e6b40b0,I6a0d93e0,Ie26f6e52Treehugger Robot2021-07-201-73/+41
|\ | | | | | | | | | | | | * changes: Revert "[CTT-5] Stop update TCP conntrack entry timeout" Revert "[CTT-6] Update TCP conntrack entry timeout while adding rules" Revert "[CTT-7] Delete the rules while half-closing tcp state entered"
| * Revert "[CTT-5] Stop update TCP conntrack entry timeout"Nucca Chen2021-07-201-65/+40
| | | | | | | | | | | | | | | | | | | | | | | | This reverts commit a5c742be69c9a5e786b5fd6af60d84598196ae9a. Reason for revert: Stop releasing this commit because it needs more test coverage. Bug: 190783768 Bug: 192804833 Change-Id: I6e6b40b0f6207ed197d01bfabb616f1afa31fb70 Test: atest TetheringCoverageTests
| * Revert "[CTT-6] Update TCP conntrack entry timeout while adding rules"Nucca Chen2021-07-201-9/+2
| | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 299a81157c257a6b6bc9d41aef094fdfe8aadde7. Reason for revert: Stop releasing this commit because it needs more test coverage. Bug: 190783768 Bug: 192804833 Change-Id: I6a0d93e04814ae73e1ec7d6fd4df19e1d2787207 Test: atest TetheringCoverageTests
* | Merge "Skip bpf offload if upstream interface is VCN"Treehugger Robot2021-07-132-0/+33
|\ \
| * | Skip bpf offload if upstream interface is VCNmarkchien2021-07-132-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | Bpf offload do not support VCN network yet, don't start bpf offload if the interface is ipsec*. Bug: 191178945 Test: atest TetheringTests Change-Id: I1ad8cededddec42f45b08aaa31d583c548d105f0
* | | Merge "[CTT-6] Update TCP conntrack entry timeout while adding rules"Nucca Chen2021-07-131-2/+9
|\ \ \ | | |/ | |/|
| * | [CTT-6] Update TCP conntrack entry timeout while adding rulesHungming Chen2021-07-131-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Needed because a payload data packet may have gone through non-offload path, before we added offload rules, and that this may result in in-kernel conntrack state being in ESTABLISHED but pending ACK (ie. UNACKED) state. But the in-kernel conntrack might never see the ACK because we just added offload rules. As such after adding the rules we need to force the timeout back to the normal ESTABLISHED timeout of 5 days. Issue: the timeout is set to unacknowledged 300s (countdwon to 298s) $ adb shell cat /proc/net/nf_conntrack ipv4 2 tcp 6 298 ESTABLISHED src=192.168.244.128 dst=140.112.8.116 sport=45694 dport=443 .. Test: atest TetheringCoverageTests Manual check: $ adb shell cat /proc/net/nf_conntrack ipv4 2 tcp 6 431988 ESTABLISHED src=192.168.40.162 dst=140.112.8.116 sport=40774 dport=443 .. Bug: 190783768 Bug: 192804833 Change-Id: I8c34e85e26c9d976e5e2b85473db75ff46d8abd4
* | | Merge "[CTT-5] Stop update TCP conntrack entry timeout"Nucca Chen2021-07-131-40/+65
|\| |