Commit graph

110,962 commits

Message SHA1
Add connectivity pre-check for CtsHostsideNetworkTests
Test: atest CtsHostsideNetworkTests
Flag: TEST_ONLY
Change-Id: If7f8cd614f0528248ca87be1d3aac5396b64e071

Paul Hu   commited 2025-04-30 01:14:24 -07:00
882a44f978
Merge "Add tether start/stop events to local log" into main
Quang Luong   authored and   Android (Google) Code Review   commited 2025-04-21 18:15:25 -07:00
d3f9564851
Merge "Ignore IPv6 temporary addresses in mDNS advertising." into main
Yuyang Huang   authored and   Android (Google) Code Review   commited 2025-04-21 00:48:54 -07:00
6df77e382d
Merge "Move getTestableNetworks to a common location" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-04-21 00:36:58 -07:00
cb677726c6
Merge "Style improvements to removeDefaultNetworkRequests." into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-04-21 00:19:58 -07:00
4f3632b57f
Move getTestableNetworks to a common location
Use a common code path for getTestableNetworks, which obtains Wi-Fi and
cellular from network callbacks. This avoids mixing callbacks and
synchronous calls, as getTestableNetworks may be called after
ensureWifiConnected, which uses NetworkCallbacks.

Test: atest
Bug: 253698734
Flag: TEST_ONLY
Change-Id: I8bf946b5258270554286e52b8aa3189aa2ba52e1

Remi NGUYEN VAN   commited 2025-04-21 15:18:57 +09:00
46f86934e1
Ignore IPv6 temporary addresses in mDNS advertising.
This commit modifies the mDNS advertising process to ignore IPv6
temporary addresses. These addresses are ephemeral and can lead to large
advertising packets and negatively impact mDNS offload(as RAM for doing
mDNS offload is limited), especially on devices with long internet
connections and multiple temporary addresses.  Ignoring them provides a
more stable and efficient mDNS advertising
experience.

Flag: EXEMPT mainline
Test: TH
Change-Id: I79c7f331eb29ecdd7ade4ccde1d1a22d0dbf1400

Yuyang Huang   commited 2025-04-21 14:57:12 +09:00
2184846d35
Merge "Minor refactoring of per-app fallback requests." into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-04-20 22:40:31 -07:00
9449d15813
Merge "Update enforceMeteredApnPolicy to follow the compat flag" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-04-20 22:15:06 -07:00
2c8f7b5608
Style improvements to removeDefaultNetworkRequests.
Rename the variable and add a comment to make the code clearer.

Bug: 410731080
Flag: EXEMPT refactor
Test: covered by existing tests
Change-Id: Ia5ff9754b070951948cb3edcfbe11934a2dc13ff

Lorenzo Colitti   commited 2025-04-21 13:33:36 +09:00
49ca1e7a32
Merge changes Id3a9d374,If67ebaa2 into main
* changes:
  Fix a callback leak in tests using CSAgentWrapper.
  Make dumpAllRequestInfoLogsToLogcat accessible to tests.

Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-04-20 20:56:03 -07:00
ae1b72bd80
Update enforceMeteredApnPolicy to follow the compat flag
On V+, ConnectivityService uses uid blocking state in BpfMap instead of
asking NetworkPolicyManager.
But, there was one behavior difference because NetworkPolicyManager
considers the network is always not blocked for apps without Internet
permission.
To ensure backward compatibility, the
NETWORK_BLOCKED_WITHOUT_INTERNET_PERMISSION flag was introduced in
aosp/3076606, aosp/3088285.

This CL updates enforceMeteredApnPolicy to respect this flag for
backward compatibility.

Test: CSEnforceMeteredApnPolicy
Bug: 404428733
Bug: 370383309
Flag: EXEMPT bugfix
Change-Id: I631f4f840818e1d40f20fccae1ec1a2cbbb6a166

Motomu Utsumi   commited 2025-04-21 12:19:45 +09:00
5759bf45a5
Merge "Format MdnsRecordRepositoryTest with ktlint" into main
Yuyang Huang   authored and   Android (Google) Code Review   commited 2025-04-20 19:49:05 -07:00
eae525f200
Minor refactoring of per-app fallback requests.
1. Add a utility method to create per-app fallback requests.
   The new method only has one caller, but another caller will be
   added in an upcoming CL.

2. Extract code from removeDefaultNetworkRequestsForPreference to
   a more generic method that takes a predicate and that will be
   used elsewhere.

Bug: 410731080
Flag: EXEMPT refactor
Test: refactor covered by existing tests
Change-Id: I13facc0f3fff1d4e76d5e8117cfcc182aa049d29

Lorenzo Colitti   commited 2025-04-21 11:20:24 +09:00
a211521618
Fix a callback leak in tests using CSAgentWrapper.
The method above this one (connect) unregisters the callback, but
disconnect doesn't. Looks like it was just missed in code review.

Flag: TEST_ONLY
Test: test-only change
Change-Id: Id3a9d3748554275fd28d8bf2ff2b6fa42be24ddc

Lorenzo Colitti   commited 2025-04-21 11:20:24 +09:00
7a0a9dd096
Make dumpAllRequestInfoLogsToLogcat accessible to tests.
This could be useful for debugging in tests.

Flag: TEST_ONLY
Test: test-only code
Change-Id: If67ebaa26a297fcf6afecf7ee3c0e8027da3f40f

Lorenzo Colitti   commited 2025-04-21 11:20:24 +09:00
19a3d815fc
Add tether start/stop events to local log
Add tether start/stop events along with their TetheringRequests to keep
track of which uid/package made the request.

Flag: EXEMPT logging change

Bug: 409564618
Test: start/stop tethering and verify the new logs show up in dumpsys
Change-Id: Iab16b16208f0ede90d7119709f7ff4888c8b86df

Quang Anh Luong   commited 2025-04-21 10:52:54 +09:00
72db4fe19f
Merge "Have updateVpnUids do nothing if the network is not a VPN" into main
Jean Chalard   authored and   Android (Google) Code Review   commited 2025-04-20 17:14:03 -07:00
96cc8b4f79
Format MdnsRecordRepositoryTest with ktlint
Test: TH
Flag: EXEMPT test only
Change-Id: I9d39a2927df5d09183c30140ed2e2b22f457a5bf

Yuyang Huang   commited 2025-04-20 14:50:12 +09:00
ecdc5d7743
Merge "Avoid excessive allocation churn in network stats." into main
Richard Uhler   authored and   Android (Google) Code Review   commited 2025-04-18 09:43:32 -07:00
5b75837cc2
Merge "Clean up the CtsNetTestCasesMaxTargetSdk filters" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-04-18 01:09:38 -07:00
298954da0d
Merge "Remove @JvmSerializableLambda usage in CarrierConfigRule" into main
Quang Luong   authored and   Android (Google) Code Review   commited 2025-04-17 15:04:06 -07:00
f0a44a9a23
Merge "Add logs for awaitPrivateDnsSetting" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-04-17 13:30:22 -07:00
6ffc2751e7
Fix memory leak in NetBpfLoad
The lambda was capturing btf by value instead of reference. This meant
that btf__free was never called, because at the time of capture btf was
null.

This changes the lambda to capture btf by reference instead of by value.

Test: TH
Flag: EXEMPT mainline
Bug: 411323352
Change-Id: I6c6637b10f16d48f9ae5b702e44883046b46e252

Patrick Rohr   commited 2025-04-17 08:38:01 -07:00
03b974321b
Add logs for awaitPrivateDnsSetting
To help investigate flakes when calling awaitPrivateDnsSetting, add more
logs.

Bug: 253698734
Test: atest
Flag: TEST_ONLY
Change-Id: I224b2693b61003a723d1e67e970232c00bd94f84

Remi NGUYEN VAN   commited 2025-04-17 18:15:35 +09:00
2d9d1d129c
CSTest: overload Agent with the given parameters.
CSTest already has an Agent function helper. Instead of using a new
function to create a network agent based on the given parameters,
it's better to overload the existing Agent function.

Flag: EXEMPT test-only change
Bug: 368416967
Test: atest ConnectivityCoverageTests
Change-Id: I134a96f564111ba65ddd5f8ec7878aeeab340dee

Xiao Ma   commited 2025-04-17 17:28:45 +09:00
926df9a9ab
Merge "CSTest: move nc function helper to CSTestHelpers." into main
Xiao Ma   authored and   Android (Google) Code Review   commited 2025-04-17 01:21:46 -07:00
dc0b81df62
Remove @JvmSerializableLambda usage in CarrierConfigRule
@JvmSerializableLambda was used in NetworkAgentTest to get around the
link error caused by JUnit enumerating through lambda methods that
referenced classes that weren't available on older platform versions.

Since this code was ported from NetworkAgentTest to CarrierConfigRule
whose lambda methods are not enumerated by JUnit, this workaround isn't
necessary anymore.

Flag: EXEMPT test only change

Bug: 409710349
Test: atest TetheringManagerTest
Change-Id: Ib876e237b239661548ae3c1d23fcb52f389f6254

Quang Anh Luong   commited 2025-04-17 17:10:44 +09:00
5db5a47144
CSTest: move nc function helper to CSTestHelpers.
Flag: EXEMPT test-only change
Bug: 368416967
Test: atest ConnectivityCoverageTests
Change-Id: I022bb5ab026fefec82a4b2a260b9167ef7891e96

Xiao Ma   commited 2025-04-17 15:56:43 +09:00
4eb7a669e5
Merge "Create the TetheringFeatureFlags class" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-04-16 23:55:52 -07:00
ac67e2cc51
Merge "Build net-tests-utils-host-device-common with module_current" into main
Motomu Utsumi   authored and   Android (Google) Code Review   commited 2025-04-16 23:20:14 -07:00
897c69ddaf
Merge changes I2f7af95e,I5a1716f8 into main
* changes:
  Rename FdWrapper to TunWrapper
  Remove unnecessary shutdown() calls

Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-04-16 20:25:34 -07:00
3f8792c694
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 "Test Tethering/NetworkStack package existence for SYSTEM and FULL users." into main
Junyu Lai   authored and   Android (Google) Code Review   commited 2025-04-16 17:59:55 -07:00
7eb06e32ab
Merge "Fix carrier privilege race condition" into main
Quang Luong   authored and   Android (Google) Code Review   commited 2025-04-16 15:19:02 -07:00
fae887a44b
Rename FdWrapper to TunWrapper
For clarity, as it doesn't support wrapping any fd. If the fd is a
connected socket, it must be shutdown() to interrupt blocking
operations. Tun doesn not require shutdown(), so TunWrapper is a better
name.

Test: TH
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: I2f7af95ef8d9ebceefdfc479c04e0272b2cb7311

Patrick Rohr   commited 2025-04-16 15:16:05 -07:00
18ec5811ec
Remove unnecessary shutdown() calls
For some reason, I used to believe shutdown() was required for tun
interface fds. As it turns out, it isn't and throws an error every time
it is called:

    shutdown failed: ENOTSOCK (Socket operation on non-socket)

This change removes all calls to shutdown() including the shutdownRead()
and shutdownWrite() interface methods.

Test: TH
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: I5a1716f82426b24db9e05367f82dc4080762e288

Patrick Rohr   commited 2025-04-16 15:16:05 -07:00
48ac9543c3
Test Tethering/NetworkStack package existence for SYSTEM and FULL users.
Follow-up from aosp/3405539, it is possible that OEMs do not
install Tethering/NetworkStack for certain user types.
This is undesirable. Therefore, enforce this with CTS test cases.

Flag: TEST_ONLY
Test: m CtsTetheringTest && atest \
      CtsTetheringTest:android.tethering.test.TetheringManagerTest
Fix: 400836850

Change-Id: I176d4930040d288846bde43beda9e30519ecd513

Junyu Lai   commited 2025-04-16 06:57:18 -07:00
90c80840d8
Merge "Add unit test for ThreadNetworkControllerService#SetEnabled" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-04-16 02:35:29 -07:00
e52162f683
Fix carrier privilege race condition
CarrierConfigRule cleanup does not wait for carrier privilege value
to change before continuing to the next test, which may cause test
failures if the value isn't fully reset on time.

Make sure the value has time to properly be reset by waiting for
onCarrierPrivilegesChanged before proceeding.

Flag: EXEMPT test only change.

Bug: 409710349
Test: atest TetheringManagerTest#testCarrierPrivilegedIsTetheringSupported TetheringManagerTest#testCarrierPrivilegedStopTetheringWifiWithConfigSucceeds

Change-Id: If67884514a2c1678834ab9ff67947e75e37db0a7

Quang Anh Luong   commited 2025-04-16 15:02:54 +09:00
9bd526d7d4
Build net-tests-utils-host-device-common with module_current
Allow module with "sdk_version: module_current" to depend on
net-tests-utils-host-device-common.
This CL also makes this module visible to cronet

Bug: 311792075
Test: TH
Flag: EXEMPT Android.bp sdk_version and visibility change
Change-Id: I3b1068e12d4abbd34006aae69bbd314fcf05d060

Motomu Utsumi   commited 2025-04-16 08:58:33 +09:00
788ce2fa37
NetBpfLoad: remove dead code
This code requires
  !isArm()
  isUserspace32bit()
  isAtLeastKernelVersion(6, 7, 0)
which implies
  isAtLeastKernelVersion(6, 2, 0)
meaning we match the condition in 1801,
and don't match the isArm() conditions in 1803/1806/1810,
thus we'd have already 'returned 1' in line 1815.

Test: TreeHugger
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I234ba91b9bdbfeaf1077eac64248d3ebfe2f2cd2

Maciej Żenczykowski   commited 2025-04-15 13:48:19 -07:00
a627d77127
Merge "Wait for the clat interface to be created" into main
Maciej Żenczykowski   authored and   Android (Google) Code Review   commited 2025-04-15 11:33:36 -07:00
4330ba0a80
Avoid excessive allocation churn in network stats.
Getting the network stats required making 3 full copies of all the
network stats since boot. Reorganize the code so we only have to
allocate incremental network stats objects.

Flag: EXEMPT bugfix
Bug: 399154099
Test: atest ConnectivityCoverageTests
Test: atest NetworkStatsIntegrationTest
Change-Id: Id531c4ffd6e0d127b8aaac38bda6a89a3d700c64

Richard Uhler   commited 2025-04-15 10:46:35 -07:00
5ed47754aa
Wait for the clat interface to be created
Clat interface creation is not always part of the second
LinkPropertiesChanged callback. This change processes
LinkPropertiesChanged callbacks until the clat interface has been
created, or no more LinkPropertiesChanged callbacks are received.

Test: atest ClatTest
Flag: EXEMPT mainline
Bug: 410685868
Change-Id: I8ff2dd95efef8dab9dfde99a1617895317c728d5

Patrick Rohr   commited 2025-04-15 09:40:25 -07:00
97ae103e4e
Add unit test for ThreadNetworkControllerService#SetEnabled
Bug: 321853291
Test: atest ThreadNetworkUnitTests
Flag: TEST_ONLY

Change-Id: Ifa74a629a20c87bf45d3d3e0693033d8e28b4e8f

Yang Sun   commited 2025-04-15 09:44:12 +00:00
3fa3ca8e5b
Merge "Update TetheringWifiP2pTest to check for tethering support" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-04-14 21:09:35 -07:00
0e8e9f2079
Merge "Add SLLAO support to RaPkt" into main
Patrick Rohr   authored and   Android (Google) Code Review   commited 2025-04-14 19:58:40 -07:00
ff4adce964
Merge "Use HexDump instead of Kotlin Experimental API" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-04-14 19:30:24 -07:00
5756619d77
Merge changes I286c4398,If446cde9 into main
* changes:
  Rename lifetime params for brevity
  Align UdpPkt with scapy

Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-04-14 19:28:13 -07:00
11a0a20ede