The condition for deleting IPv4 forwarding rules.
1. When the tethering client has gone, deletes the client and its
rules.
2. When the upstream has gone, deletes all rules.
3. When the upstream has changed, deletes all rules.
Test: atest TetheringCoverageTests and check IPv4 offload rules
via dumpsys tethering in the following test cases.
Bug: 190783768
Test cases:
a. Loss upstream interface while tethering
1. Enable WIFI tethering
2. Disable upstream interface
3. Check the rules are removed.
b. Loss downstream interfaces while tethering
1. Enable WIFI tethering
2. Enable BT tethering
3. Disable BT tethering
4. Check the BT tether rules are removed.
5. Disable WIFI tethering
6. Check the WIFI tether rules are removed.
c. Switch upstream interface while tethering
1. Enable WIFI tethering
2. Enable BT tethering
3. Switch upstream interface from cellular to wifi.
4. Check all rules are removed.
d. Enable NAT failure (manual)
Log:
The rule deletion in each case.
- IpServer#stopIPv4: case b and case d.
- BpfCoordinator#updateUpstreamNetworkState: case a and case c.
Test case a
06-23 09:58:59.245 [...] Tethering: [BpfCoordinator]
updateUpstreamNetworkState tetherOffloadRule4Clear wlan2
Test case b
06-07 22:17:51.886 [..] Tethering: [bt-pan] cleanupUpstream bt-pan
06-07 22:17:51.888 [..] Tethering: [bt-pan] stopIPv4 bt-pan
06-07 22:18:23.769 [..] Tethering: [wlan2] cleanupUpstream wlan2
06-07 22:18:23.772 [..] Tethering: [wlan2] stopIPv4 wlan2
Test case c
06-08 11:11:48.277 [..] Tethering: [BpfCoordinator]
updateUpstreamNetworkState tetherOffloadRule4Clear bt-pan
06-08 11:11:48.396 [..] Tethering: [BpfCoordinator]
updateUpstreamNetworkState tetherOffloadRule4Clear wlan2
06-08 11:11:48.579 [..] Tethering: [wlan2] cleanupUpstreamInterface
wlan2
06-08 11:11:48.808 [..] Tethering: [bt-pan] cleanupUpstreamInterface
bt-pan
Enabling NAT failure
06-08 13:04:18.117 [..] Tethering: [wlan2] Exception enabling NAT [..]
06-08 13:04:18.234 [..] Tethering: [wlan2] cleanupUpstream wlan2
06-08 13:04:18.246 [..] Tethering: [wlan2] stopIPv4 wlan2
Original-Change: https://android-review.googlesource.com/1579873
Merged-In: Id505a3deb277bbe0f44403234d8ca8bbf01eec80
Change-Id: Id505a3deb277bbe0f44403234d8ca8bbf01eec80
Bug: 189308158
Test: This test and
run testReportNetworkInterfaceForTransports
with --rerun-until-failure 500
Original-Change: https://android-review.googlesource.com/1722770
Merged-In: I654b8920d6ea1dada782a618776b13870f7f98df
Change-Id: I654b8920d6ea1dada782a618776b13870f7f98df
* changes:
Add test for CM#setAvoidUnvalidated
Provide a way to override the avoid bad wifi configuration
Remove ConnectivityServiceTest signature perms use
The test simply verify the constructor. They only apply on S+ as
InvalidPacketException is not updatable before S.
Bug: 187935317
Test: atest InvalidPacketExceptionTest
Original-Change: https://android-review.googlesource.com/1742076
Merged-In: I33f1ee1702672204a46063e6e75c3880d5e7600b
Change-Id: I33f1ee1702672204a46063e6e75c3880d5e7600b
The tests are also useful in CTS to ensure that the
ConnectivityDiagnosticsManager class API is implemented properly
(including behavior of the DataStallReport class for example).
Bug: 187935317
Test: atest ConnectivityDiagnosticsManagerTest
Original-Change: https://android-review.googlesource.com/1742075
Merged-In: I86f39238054f43403f9a1e383dd2a935de84f06f
Change-Id: I86f39238054f43403f9a1e383dd2a935de84f06f
ConnectivityManager.setAvoidUnvalidated only works if the
config_networkAvoidBadWifi configuration is set to 0 and the
NETWORK_AVOID_BAD_WIFI setting is unset. There is no easy way
for a testing app to temporary set a test value to verify the
behavior of the API. Thus, add a mechanism to allow test app
to set a period of time to temporary unstrict the resource
configuration, i.e. Temporary simulate config_networkAvoidBadWifi
configured to 0.
Bug: 186061922
Test: atest CtsNetTestCases FrameworksNetTests
Original-Change: https://android-review.googlesource.com/1733788
Merged-In: If772078c61a9b12926f104d5dfc9c9071e844732
Change-Id: If772078c61a9b12926f104d5dfc9c9071e844732
To allow unit tests to run without platform certificates, remove
signature permission usage in ConnectivityServiceTest.
This mocks permission checks done in ConnectivityService for which the
test assumed that the permission was held, and mocks calls to
BatteryStatsManager. Calls to ActivityManagerService (through
PendingIntent) are done with shell permissions as the test uses real
PendingIntent mechanics.
Bug: 187935317
Test: atest FrameworksNetTests
Merged-In: If309d653ac2e9bbcf1b94bcee6336367289df359
Change-Id: If309d653ac2e9bbcf1b94bcee6336367289df359
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1736615
(cherry picked from commit 595dda3604)
Change-Id: Idb19b0f7cb87bb4d9de7a0b1a0e4128c2d6b9c6d
Tethering was removed from mainline-postsubmit while Connectivity was
being added to it, but it can run in postsubmit again now.
If the runs are successful, it can be added to presubmit as well.
Ignore-AOSP-First: Partial revert of change that did not go to AOSP
Bug: 177290955
Test: TH needs to test postsubmit
Change-Id: I5d5dbccd8d14be573104947412a76578b2d7a6c1
Add tests for requestNetwork and registerNetworkCallback with
PendingIntents that are equal as per PendingIntent.intentFilterEquals.
In such situations, the first request is documented to be automatically
unregistered. This means that the PendingIntent should only be fired
once, instead of being fired for both requests.
Currently this behavior is broken for network callbacks (not for network
requests).
Test: atest ConnectivityManagerTest
Bug: 174237997
Original-Change: https://android-review.googlesource.com/1742073
Merged-In: Ic636c731c71474ef09043d7a26ccfd6e2bb5c39f
Change-Id: Ic636c731c71474ef09043d7a26ccfd6e2bb5c39f
* changes:
Use assertEquals instead of assertTrue to compare the vpn type
Add CTS for systemReady() & getIpSecNetIdRange()
Call ConnectivitySettingsUtils to set/get private DNS related settings
Add CTS for isUidNetworkingBlocked & isUidRestrictedOnMeteredNetworks
Add test for CSM#[get|set]MobileDataPreferredUids
Add test for setHttpProxyConfiguration
CTS test for PacProxyManager
Add test for CM#setAcceptUnvalidated
Add test for CM#setAcceptPartialConnectivity
Skip CaptivePortalTest for wearables
Improve handling of invalid private DNS settings
This CL adds tests to verify that after setting
IpSecTunnelInterface to use a different undelying network and
re-applying IpSecTransforms with matching addresses, traffic
can be routed to/from the new underlying network.
All these new tests will be skipped if SDK < S
Bug: 169855650
Test: atest IpSecManagerTunnelTest (new tests added)
Original-Change: https://android-review.googlesource.com/1488296
Merged-In: Iab26159e5e070574e552d62e4f0780059a51a9c7
Change-Id: Iab26159e5e070574e552d62e4f0780059a51a9c7
The test verifies that system services were registered, meaning that
ConnectivityFrameworkInitializer.registerServiceWrappers ran
successfully on startup, and that calling it afterwards throws.
Bug: 171540887
Test: atest ConnectivityFrameworkInitializerTest
Original-Change: https://android-review.googlesource.com/1675598
Merged-In: I485b0dbd2e9dc557560a2b7bee2cff54c7f66c93
Change-Id: I485b0dbd2e9dc557560a2b7bee2cff54c7f66c93
ConnectivitySettingsManager and CtsNetUtils are doing the same
thing to set/get private DNS related settings.
To prevent making the duplication code in two places, move the
body to frameworks/libs/net and call it.
Bug: 185311744
Test: atest CtsNetTestCases CtsNetTestCasesLatestSdk
Original-Change: https://android-review.googlesource.com/1719017
Merged-In: I3272c825b86ec30c3d0bf4097088c653e668461b
Change-Id: I3272c825b86ec30c3d0bf4097088c653e668461b
BYPASS_INCLUSIVE_LANGUAGE_REASON=To make the change more clear,
fix the inclusive problem in a follow-up commit.
Bug: 176289731
Test: atest CtsHostsideNetworkTests:HostsideNetworkPolicyManagerTests
Original-Change: https://android-review.googlesource.com/1737395
Merged-In: Ie6bda8570979b10a28dbeb20f6db7a9c44735964
Change-Id: Ie6bda8570979b10a28dbeb20f6db7a9c44735964
The test verifies that system properties are set as expected by the
method.
Bug: 174436414
Test: atest ProxyTest
Original-Change: https://android-review.googlesource.com/1564956
Merged-In: Id15909c5e52f1042d7210cf7e416874bb01baee7
Change-Id: Id15909c5e52f1042d7210cf7e416874bb01baee7
The always bit is verified in NetworkAgentTest. There is no easy
configuration to set an explicitly selected network to accept an
unvalidated network. Verify the accepted case also in
NetworkAgentTest.
Bug: 186061922
Test: atest CtsNetTestCases:android.net.cts.ConnectivityManagerTest
Test: atest CtsNetTestCasesLatestSdk
Original-Change: https://android-review.googlesource.com/1731234
Merged-In: I803eb975fb0b6c52d55b2310293bcad407d21f42
Change-Id: I803eb975fb0b6c52d55b2310293bcad407d21f42
When private DNS mode is strict, there should always be a private DNS
specifier with the hostname.
Instead of restoring an invalid strict mode setting when set,
have tests reset private DNS mode to opportunistic and fail.
Bug: 190465704
Test: atest CtsNetTestCases
Original-Change: https://android-review.googlesource.com/1730543
Merged-In: I45adc527267aa86d52e824f426699c5a7e874f63
Change-Id: I45adc527267aa86d52e824f426699c5a7e874f63
tryCell configuration would not be force disabled UpstreamMonitor stop.
If tethering stop with using mobile upstream and swap with SIM fron no
dun to dun supported, dun request would be filed even tethering is not
active.
Bug: 173068192
Test: atest TetheringTests
Original-Change: https://android-review.googlesource.com/1715791
Merged-In: I5505655f52da9fdca2fd43a58e043a9ab727741d
Change-Id: I5505655f52da9fdca2fd43a58e043a9ab727741d
This is a op CL which prepare for refactor.
Bug: 185649441
Bug: 189410000
Bug: 178116595
Test: atest TetheringTests
Original-Change: https://android-review.googlesource.com/1730548
Merged-In: I270ff43c01736b9d18bd40a8e88e1379e9e4e863
Change-Id: I270ff43c01736b9d18bd40a8e88e1379e9e4e863
Adding the configuration to decide using rndis or ncm for usb tethering.
If ncm is configured for TETHEIRNG_USB, then TETHERING_NCM is not
available.
Bug: 162920185
Test: atest TetheringTests
manul testing usb tethering
Original-Change: https://android-review.googlesource.com/1730541
Merged-In: Ifc7eee2457a950a0e2d1c3cc89a3373a7ad23c9c
Change-Id: Ifc7eee2457a950a0e2d1c3cc89a3373a7ad23c9c
Increasing the timeout values for waiting for callbacks for the per-app
CTS tests to match the timeout value used in the waitForAvailable()
helper method.
Bug: 191230288
Test: atest CtsNetTestCases:android.net.cts.ConnectivityManagerTest
Original-Change: https://android-review.googlesource.com/1736927
Merged-in: I49e5a99f18a5651370e6914f30be659134b537ff
Change-Id: I49e5a99f18a5651370e6914f30be659134b537ff
CTS tests to validate the setOemNetworkPreference API on
ConnectivityManager. Additionally, a small bit of cleanup for
assumptions around the Wi-Fi feature.
Bug: 176496580
Bug: 176494815
Test: atest CtsNetTestCases:
android.net.cts.ConnectivityManagerTest#
testSetOemNetworkPreferenceForTestPref --iterations
atest CtsNetTestCases:
android.net.cts.ConnectivityManagerTest#
testSetOemNetworkPreferenceForTestOnlyPref --iterations
Original-Change: https://android-review.googlesource.com/1665079
Merged-in: Ia3e4b336123b60f6df1582aca2979129112afedc
Change-Id: Ia3e4b336123b60f6df1582aca2979129112afedc
Many applications use ConnectivityManager without needing
TetheringManager (or without calling legacy ConnectivityManager methods
that delegate to TetheringManager), so initializing TetheringManager
when ConnectivityManager is created wastes resources.
This is especially true considering that TetheringManager is not trivial
to initialize (worst case scenario it starts a thread and does multiple
Binder requests), and ConnectivityManager is created in ActivityThread
when setting up the app proxy on startup.
Bug: 190556328
Test: atest FrameworksNetTests CtsNetTestCases TetheringTests
Original-Change: https://android-review.googlesource.com/1736505
Merged-In: I2ba7b8f2b9e1c934cfb082776b8d643f2f2c17e5
Change-Id: I2ba7b8f2b9e1c934cfb082776b8d643f2f2c17e5