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
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
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 Colitticommited 2025-04-21 13:33:36 +09:00
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
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 Colitticommited 2025-04-21 11:20:24 +09:00
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 Colitticommited 2025-04-21 11:20:24 +09:00
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 Luongcommited 2025-04-21 10:52:54 +09:00
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
To help investigate flakes when calling awaitPrivateDnsSetting, add more
logs.
Bug: 253698734
Test: atest
Flag: TEST_ONLY
Change-Id: I224b2693b61003a723d1e67e970232c00bd94f84
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
@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 Luongcommited 2025-04-17 17:10:44 +09:00
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
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
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
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
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 Luongcommited 2025-04-16 15:02:54 +09:00
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
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 Żenczykowskicommited 2025-04-15 13:48:19 -07:00
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
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