Commit graph android_packages_modules_Co.../Tethering/tests
Message SHA1
Merge "Increase WAIT_RA_TIMEOUT_MS" into main
Patrick Rohr   authored and   Android (Google) Code Review   commited 2025-06-04 16:17:57 -07:00
4b799ef007
Merge "Remove pending BT request when service disconnects" into main
Patrick Rohr   authored and   Android (Google) Code Review   commited 2025-06-04 13:41:49 -07:00
dacf22f4c2
Increase WAIT_RA_TIMEOUT_MS
EthernetTethering tests on auto devices are flaky waiting for RA. Increased timeout will give a more generous window to receive RA.

Flag: EXEMPT bugfix
Bug: 418010532
Test: atest android.net.EthernetTetheringTest#testLocalOnlyTethering --iterations 50
Test: atest android.net.EthernetTetheringTest --iterations 20
Change-Id: I6092ee805267a6d50fa2842d3131eeae544c3443

Chris Desir   commited 2025-06-04 10:39:15 -07:00
f3245684d5
Remove pending BT request when service disconnects
If the PAN service disconnects before the BT iface is available, the BT
TetheringRequest will be stuck pending and prevent any new BT
startTethering attempts. This may happen if the user turns BT tethering
on and turns off BT without connecting to any device.

Fix this by always removing the pending BT request when the PAN service
disconnects.

Flag: EXEMPT minor bugfix

Bug: 420412916
Test: atest TetheringTest, manually verify turning BT tethering on,
turning off BT, and turning BT tethering on again.

Change-Id: I6bc96d6e4016d83af6cfd8e549d474ce651a44fc

Quang Anh Luong   commited 2025-06-04 09:46:51 +09:00
1a2b238bc1
Fix NullPointerException in waitForRouterAdvertisement
The failure is caused by a RA packet read race condition. The test
receives a callback that local-only tethering has started and
immediately begins listening for an RA. However, the system's RA daemon
may not have finished initializing.

The test's packet reader times out waiting for an RA and returns a null
packet. The waitForRouterAdvertisement then uses the null packet
checking for RA, causing NPE. Change modifies waitForRouterAdvertisement
to check if a packet is null before processing it.

Flag: EXEMPT bugfix
Bug: 418010532
Test: atest android.net.EthernetTetheringTest#testLocalOnlyTethering
Change-Id: Ic534c53766958ae48a82687a9bd6d09297f074f2

Chris Desir   commited 2025-05-30 12:33:34 -07:00
6fecb23808
Remove RecorderCallback.
This class doesn't actually serve a purpose, it only makes
TestableNetworkCallbck more complex.

Test: CtsNetTestCases ConnectivityCoverageTests
Flag: EXEMPT test-only
Change-Id: I39a598b82a3215384bdfe04980f4b280ab2c2716

Chalard Jean   commited 2025-05-19 16:35:53 +09:00
f2994122c1
Merge changes I380d649c,I64734ee7,Ie6f3859e into main
* changes:
  Remove ensureIpServerStartedLegacy.
  Never create IpServers based on interface up for WIFI and WIFI_P2P.
  Rename the methods in the legacy codepath for clarity.

Patrick Rohr   authored and   Android (Google) Code Review   commited 2025-05-16 02:15:46 -07:00
ceb9f3e819
Never create IpServers based on interface up for WIFI and WIFI_P2P.
This is not necessary because creating the IpServer based on
interface events is only necessary for the tether() API, and
field metrics indicate that that API is unused for WIFI and
WIFI_P2P.

Also add comments to clarify when the legacy codepath is taken.

Bug: 408087033
Test: updated unit tests
Flag: EXEMPT refactor
Change-Id: I64734ee710e9782903d4422efb0370d6fec77dd7

Lorenzo Colitti   commited 2025-05-16 15:06:36 +09:00
981a4f35c5
Remove deprecated SC_V2 constant
Test: TH
Flag: EXEMPT test-only
Change-Id: I3444fad305f49294ed8c3a850b631f385678c117

Chalard Jean   commited 2025-05-15 09:03:59 +09:00
9373e3442e
Disallow the legacy tether API for Wi-Fi.
AOSP code has never used this API, and metrics from production
show no usage either. Removing it will allow simplifying the
code.

This CL removes testRequestStaticIpLegacyTether because it makes
legacyTether a no-op and there is already a test for static IP
request right above it.

Bug: 408087033
Flag: EXEMPT dead code
Test: updated existing tests
Change-Id: Ib94ed0860ab57abfd9fc7bdfdc911f5ab57003ed

Lorenzo Colitti   commited 2025-05-13 19:43:58 +09:00
bec4b5b8d4
Create the TetheringFeatureFlags class
Currently, Tethering feature flags are located in
TetheringConfiguration or other classes. However,
not all flags are truly related to the tethering configuration.
Therefore, create the TetheringFeatureFlags class to centralize
and manage these feature flags more easily.

Test: m
Flag: EXEMPT refactor
Change-Id: Iadca476aba57019776061102cb2a6d8226a70200

Paul Hu   commited 2025-04-16 20:18:04 -07:00
3e88b748ef
Merge changes I32095316,I709082c0 into main
* changes:
  Add integration test for Wifi P2p Group Owner Network Agent
  Support Wifi P2P Group Owner local network agent

Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-04-02 18:09:33 -07:00
6f3cf21daa
Support Wifi P2P Group Owner local network agent
Flag: EXEMPT Flagged by DeviceCongfig wifip2pgo_local_network_agent
Test: atest ConnectivityCoverageTests:android.net.ip.IpServerTest \
      --update-device
Test: atest TetheringIntegrationTests:android.net.EthernetTetheringTest \
      --update-device
Bug: 406172997
Change-Id: I709082c05b576c17fd2823e687d63028b9b8a309

Junyu Lai   commited 2025-04-01 21:08:04 +08:00
6c6128081f
Enable TETHER_FORCE_RANDOM_PREFIX_BASE_SELECTION by default
Since the feature was fully rolled out via experiment without
regression, this commit replaced with a
kill switch.

Flag: EXEMPT refactor
Test: atest ConnectivityCoverageTests:PrivateAddressCoordinatorTest
Fix: 312647670
Fix: 406955982
Change-Id: I18adcca45fa5f698adc80cea044d8006de097977

Junyu Lai   commited 2025-03-31 02:48:52 -07:00
db75d68801
Revert "Enable TETHER_FORCE_RANDOM_PREFIX_BASE_SELECTION by default on 25Q2+"
This reverts commit 44f2eb6e42.

Reason for revert: Networking mainline release council review feedback at b/406955982

Flag: EXEMPT bugfix
Test: TH
Bug: 406955982
Change-Id: I89bc8f5863c3acb72b5c4af5aadc40d34f2380ce

Junyu Lai   commited 2025-03-31 14:51:42 +08:00
121a4f90ba
Merge "Address aosp/3541181 leftover comments" into main am: bd1703ff4f
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3555993

Change-Id: I5b6a7126ff771f27a7d74b48ae4eb947243138dc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Paul Hu   authored and   Automerger Merge Worker   commited 2025-03-25 22:25:41 -07:00
22ffcebc41
Merge "Address aosp/3541181 leftover comments" into main
Paul Hu   authored and   Gerrit Code Review   commited 2025-03-25 22:06:01 -07:00
bd1703ff4f
Address aosp/3541181 leftover comments
Test: atest TetheringTests CtsTetheringTest
Change-Id: Iee9c1eec33403c95e29656b3dfb1bfefea81108e

Paul Hu   commited 2025-03-25 10:02:37 +00:00
3f81aec099
Merge "Disable non-thread local network matching" into main am: e0051cdeb9
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3550880

Change-Id: I5716a377ab8fc96c129d5605f984fcbc08ae5014
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Treehugger Robot   authored and   Automerger Merge Worker   commited 2025-03-21 08:28:55 -07:00
bf03e7f8c8
Merge changes from topic "tetherlocalagent" into main am: 0b7d710ba0
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3421099

Change-Id: I874999307ccf6eba6ad7af91db7f1137e159fac5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Treehugger Robot   authored and   Automerger Merge Worker   commited 2025-03-21 08:28:29 -07:00
dc0b261462
Merge "Disable non-thread local network matching" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-03-21 08:08:56 -07:00
e0051cdeb9
Merge changes from topic "tetherlocalagent" into main
* changes:
  Add integration test of tethering local network agent feature
  Add unit test of tethering local network agent feature
  Support LocalNetworkAgent for Tethering

Treehugger Robot   authored and   Gerrit Code Review   commited 2025-03-21 07:42:40 -07:00
0b7d710ba0
Disable non-thread local network matching
Currently, apps targeting V can see thread local network.

This change introduces a mechanism to make existing
apps unable to see non-thread local networks to ensure minimal
impact on existing devices and applications while adopting this
behavior. Apps targeting B+ Sdk and run on V+ devices can see
non-thread local networks.

Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.CSLocalAgentTests \
      --update-device
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server --update-device
      (on next/trunk_staging release config)
Bug: 349487600
Change-Id: I6aa43cebc20a9017c2d8a8a90ebb1d53040a27bb

Junyu Lai   commited 2025-03-21 19:34:49 +08:00
0b806fd931
Merge changes I7fae1964,Ic7cc9e1d into main am: d5743b9795
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3512874

Change-Id: Ia6de0e7d6033918e5cdf6d0a9ab76638fc0e1487
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Treehugger Robot   authored and   Automerger Merge Worker   commited 2025-03-21 03:54:29 -07:00
aa737d2a76
Add integration test of tethering local network agent feature
Test: atest TetheringIntegrationTests:android.net.EthernetTetheringTest#testLocalAgent_networkCallbacks \
      --update-device
Bug: 349487600
Change-Id: I3a173f7441a766c33844f89c13ef3cc7930167f1

Junyu Lai   commited 2025-03-21 17:59:00 +08:00
1775349555
Add unit test of tethering local network agent feature
Test: atest TetheringTests:android.net.ip.IpServerTest \
      ConnectivityCoverageTests:android.net.ip.IpServerTest \
      ConnectivityCoverageTests:com.android.networkstack.tethering \
      --update-device
      (Also on the next release config)
Bug: 349487600
Change-Id: I56e0ec106f9398225b162fa94e3ccdb94f413049

Junyu Lai   commited 2025-03-21 17:59:00 +08:00
396dd9b1e0
Add carrier-privileged app bypass for start/stopTethering
Allow carrier-privileged apps to call startTethering and stopTethering
for wifi tethering with a non-null SoftApConfiguration.

Bug: 295979433
Test: atest TetheringTests CtsTetheringTests

Change-Id: I7fae1964c44902b1d500729794fc59e5bdd185e5

Quang Anh Luong   commited 2025-03-21 18:25:28 +09:00
72d9102ab7
Merge "Add DO app bypass for start/stopTethering" into main am: 038fd312fe am: f13ae6e021
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3395339

Change-Id: I608ceee99b9b72c781671a67a322dd5a4ef4bfa5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Quang Luong   authored and   Automerger Merge Worker   commited 2025-03-19 07:42:05 -07:00
049e15574b
Add DO app bypass for start/stopTethering
Allow DO apps to call startTethering and stopTethering for wifi
tethering with a non-null SoftApConfiguration.

Bug: 295979433
Test: atest TetheringTests CtsTetheringTests

Change-Id: Ie5836e9e30afb2df1de0640645d696e185aa2191

Quang Anh Luong   authored and   Quang Luong   commited 2025-03-19 03:30:48 -07:00
3f22173b75
Merge "Force TETHER_ENABLE_SYNC_SM to be enabled by default on 25Q2+" into main am: 811db343cd am: 553e1884d4
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3541181

Change-Id: I622c3177e0e985b84f5660a3b4d76230bfc2b487
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Treehugger Robot   authored and   Automerger Merge Worker   commited 2025-03-19 00:41:07 -07:00
42c06f3046
Merge "Force TETHER_ENABLE_SYNC_SM to be enabled by default on 25Q2+" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-03-18 23:56:52 -07:00
811db343cd
Merge "Start tethered hotspot with TetheringRequest" into main am: 8594562526 am: 6ae0b1e92c
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3161517

Change-Id: I9635420400de643767d4446cf6e04295381ddee1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Quang Luong   authored and   Automerger Merge Worker   commited 2025-03-17 16:01:02 -07:00
cc039d78ab
Start tethered hotspot with TetheringRequest
Use WifiManager.startTetheredHotspot(TetheringRequest, Executor,
SoftApCallback) to start softap. This allows for passing in the
requested SoftApConfiguration via TetheringRequest.

Bug: 216524590
Test: atest TetheringTest TetheringManagerTest
Change-Id: Ie4fb851e8b2243d233f9a8b3e18e2fa335cec307

Quang Anh Luong   commited 2025-03-17 21:13:47 +09:00
f7b6434a65
Fix WifiManager.startTetheredHotspot mocking am: db7fdac6d9 am: 507df2bbee
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3545540

Change-Id: Ie68f3d16a0d47c80ea1bab58cb0756918df5f053
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Quang Anh Luong   authored and   Automerger Merge Worker   commited 2025-03-17 02:50:35 -07:00
462346d5f8
Replace isTetheringWithSoftApConfig flag with B SDK check am: a10437f133 am: d2d93b35cb
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3543708

Change-Id: Id554516ce91a48d5030fefab532b4ed5a6d57db5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Quang Anh Luong   authored and   Automerger Merge Worker   commited 2025-03-17 00:55:37 -07:00
f983567bd6
[Revert^2] Stop tethering request only if fuzzy-matched to existing request am: d093ea69b0 am: 56e0b93e4c
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3543707

Change-Id: Id903f95fe071f63b4d19585ec26e4c4eca5bcfe3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Quang Luong   authored and   Automerger Merge Worker   commited 2025-03-17 00:55:32 -07:00
e380f71d2f
[Revert^2] Reject TetheringRequests that fuzzy-match existing ones am: 8b29d287f5 am: f4191218f8
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3543706

Change-Id: Ib1ec4f02684d570610cee3cb934aefeefbdcc322
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Quang Luong   authored and   Automerger Merge Worker   commited 2025-03-17 00:55:27 -07:00
45b71c7d1b
Fix WifiManager.startTetheredHotspot mocking
TetheringTest has several tests that rely on starting Wifi tethering,
but do not mock WifiManager.startTetheredHotspot. This causes the
pending Wifi request to be removed, even though the test continues
thinking that the call succeeded and continues mocking Wifi AP events.

Fix this by making sure the mock returns true in setUp(), and only set
it to false when we expect that the call should fail.

Bug: 216524590
Test: atest TetheringTest
Change-Id: Iaf076b9ae64d737a8591c7f41a5552757b47999b

Quang Anh Luong   commited 2025-03-17 15:18:29 +09:00
db7fdac6d9
Replace isTetheringWithSoftApConfig flag with B SDK check
isTetheringWithSoftApConfig flag is finalized, replace it with a simple
SdkLevel.isAtLeastB() check. This also fixes any issues with reading the
flag during boot.

Bug: 216524590
Test: covered by existing tests
Change-Id: I6c2717a68fa4f3c664c9948ec19b246db5afdb8b

Quang Anh Luong   commited 2025-03-17 15:18:29 +09:00
a10437f133
[Revert^2] Stop tethering request only if fuzzy-matched to existing request
stopTethering with a TetheringRequest should only stop tethering if
there is an existing request (pending or serving) that fuzzy-matches the
input and whose UID matches the caller (unless the caller is Settings,
which is allowed to remove any request).

If there is no existing fuzzy-matched request, return
TETHER_ERROR_UNKNOWN_REQUEST.

Note: This was originally merged as aosp/3527440 but was reverted due to
a dependency CL being reverted. Remerging this on top of the fix for the
dependency CL.

Reverted changes: /q/submissionid:3541662-revert-3527440-JRJJTQBUFC

Bug: 216524590
Test: atest TetheringTest RequestTrackerTest TetheringManagerTest

Change-Id: I99dd2433efbb82f3721aa708ab50d198f6fbcb10

Quang Luong   authored and   Quang Anh Luong   commited 2025-03-17 15:18:29 +09:00
d093ea69b0
[Revert^2] Reject TetheringRequests that fuzzy-match existing ones
Legacy behavior will return success results to multiple startTethering
calls of the same type, even though the link layer can only support one
of those requests at a time (other than tethered AP + LOHS).

For B+, clean up this behavior by only allowing the amount of requests
that the link layer can concurrently support. To do this, we'll
introduce the concept of "fuzzy-matching" such that if a new request
fuzzy-matches an existing request (either pending or serving), this
indicates that the link layer cannot support the new request
concurrently, and we'll fail the new request with
TETHER_ERROR_DUPLICATE_REQUEST.

To keep track of serving requests, we'll store the request and it's
IpServer in RequestTracker when we call IpServer.enable(), and we'll
remove it (indexed by IpServer) when
1) Calling IpServer.onStop()
2) Calling IpServer.unwanted()
3) We detect an IpServer transition to AvailableState with error code

Note: This was originally merged as aosp/3529632 but was reverted due to
a crash when reading aconfig flags at boot. That issue has been fixed
here.

Reverted changes: /q/submissionid:3541662-revert-3527440-JRJJTQBUFC

Bug: 216524590
Test: atest TetheringTest RequestTrackerTest TetheringManagerTest

Change-Id: I87a1ed31927cda27d3b7fdd7c823b8f828f8d777

Quang Luong   authored and   Quang Anh Luong   commited 2025-03-17 15:18:29 +09:00
8b29d287f5
Merge "Fix TetheringTest.failureEnablingIpForwarding verification count" into main am: 856f57a0ce am: e40624389f
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3543699

Change-Id: I70c3a1d8a922ca4523c876d7e22f4655edbfaed6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Quang Luong   authored and   Automerger Merge Worker   commited 2025-03-14 20:45:01 -07:00
c1a2eaae64
Fix TetheringTest.failureEnablingIpForwarding verification count
failureEnablingIpForwarding verifies that TetheringMetrics sends one
more error report than it should. This extra verification is caused by
any(class) being passed into the mock WifiManager.startTetheredHotspot,
which does not match null even though the actual code passes in a
null. This results in an extra failure that causes the extra error
report call.

Fix this by replacing any(class) with null, and removing the extra error
verification.

Bug: 216524590
Test: atest TetheringTest
Change-Id: I93986a999d573a186696e54793563e2be8405f39

Quang Anh Luong   commited 2025-03-15 10:42:22 +09:00
3b6ee54cf6
Merge changes from topic "revert-3527440-JRJJTQBUFC" into main am: 99ef00112e am: f61ad4c724
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3541663

Change-Id: I88008871cc11c276dc9caaa7e5c9d556708054ed
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Priyanka Advani (xWF)   authored and   Automerger Merge Worker   commited 2025-03-13 12:45:05 -07:00
340bdc52a7
Merge changes from topic "revert-3527440-JRJJTQBUFC" into main
* changes:
  Revert "Reject TetheringRequests that fuzzy-match existing ones"
  Revert "Stop tethering request only if fuzzy-matched to existing..."

Priyanka Advani (xWF)   authored and   Gerrit Code Review   commited 2025-03-13 11:43:21 -07:00
99ef00112e
Revert "Reject TetheringRequests that fuzzy-match existing ones"
Revert submission 3527440

Reason for revert: Droidmonitor created revert due to b/403261952. Will be verifying through ABTD before submission.

Reverted changes: /q/submissionid:3527440

Change-Id: Ife596c639899528778f53fef797749fa88596dd6

Priyanka Advani (xWF)   commited 2025-03-13 10:22:16 -07:00
01b6b070ad
Revert "Stop tethering request only if fuzzy-matched to existing..."
Revert submission 3527440

Reason for revert: Droidmonitor created revert due to b/403261952. Will be verifying through ABTD before submission.

Reverted changes: /q/submissionid:3527440

Change-Id: I31ae861d5151c9db7e559ba19db7f07c9545d422

Priyanka Advani (xWF)   authored and   Gerrit Code Review   commited 2025-03-13 10:22:16 -07:00
e72faa10ed
Force TETHER_ENABLE_SYNC_SM to be enabled by default on 25Q2+
Test: atest TetheringTests CtsTetheringTest
Change-Id: Id63b4535aaebe90d5fa663ad4584cfd987c3b06b

Paul Hu   commited 2025-03-13 08:44:37 +00:00
133d806627
Merge changes Ia8a8eab7,I1e193f35 into main am: a4b6164304 am: 4f521b4bdf
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3527440

Change-Id: Ife6167630674c0ab4e6e3657227054a6419d05b2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Quang Luong   authored and   Automerger Merge Worker   commited 2025-03-13 00:17:51 -07:00
18457dafbb
Merge changes Ia8a8eab7,I1e193f35 into main
* changes:
  Stop tethering request only if fuzzy-matched to existing request
  Reject TetheringRequests that fuzzy-match existing ones

Quang Luong   authored and   Gerrit Code Review   commited 2025-03-12 23:20:13 -07:00
a4b6164304