Commit graph android_packages_modules_Co.../tests
Message SHA1
Merge "Increase timeout for ApfIntegrationTest#testReadWriteProgram()" into main
Maciej Żenczykowski   authored and   Android (Google) Code Review   commited 2025-04-07 14:27:02 -07:00
ccc56e4141
Use scope_guard and unique_fd in MultinetworkApiTest_runDatagramCheck
Test: TH
Flag: no
Bug: 1000001
Change-Id: Icaf5cc553ceedc0ed5a0a0e1241c8cf6acf25a91

Patrick Rohr   commited 2025-04-07 11:01:07 -07:00
4e8098fcb0
Prevent use-after-free
This test could really benefit from using scope guards instead.

Test: TH
Bug: 406263334
Flag: no
Change-Id: I508c9843a8980767b4c25f86a6ca399276cb14c8

Patrick Rohr   commited 2025-04-07 09:34:36 -07:00
00abef4936
Increase timeout for ApfIntegrationTest#testReadWriteProgram()
This commit increases the timeout for the
ApfIntegrationTest#testReadWriteProgram() test case from 15 minutes to
20 minutes. This change ensures that the test does not timeout on slower
devices.

Bug: 407721406
Flag: EXEMPT bug fix
Test: TH
Change-Id: I8c2b5d36aebc2f2fa66f2d72cccd88bf74f50b68

Yuyang Huang   commited 2025-04-07 18:42:43 +09:00
4de8b4443a
Merge "Ensure PacketHandler is removed from sockets" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-04-06 19:37:26 -07:00
a45c2e8cda
Merge "Temporarily disable low power standby during ApfIntegrationTest" into main
Maciej Żenczykowski   authored and   Android (Google) Code Review   commited 2025-04-06 16:25:18 -07:00
7ecabd1bea
Temporarily disable low power standby during ApfIntegrationTest
ApfIntegrationTest includes test cases that require turning off the
screen and waiting before sending packets. On devices with low power
standby capabilities, such as Android TVs, the packets sent by these CTS
test cases can be blocked. To prevent this interference, this commit
temporarily disables the low power standby policy during test execution.

Bug: 407698167
Flag: EXEMPT bug fix
Test: manually test on TV and Phone
Change-Id: I7312626b4d1939847e5bf5267da5e81dab241a64

Yuyang Huang   commited 2025-04-06 12:10:59 +09:00
6b24c93fe4
Merge changes Ia1e08c43,Ifbca38e6 into main
* changes:
  Delete RouterAdvertisementResponder
  Rewrite RouterAdvertisementResponder in Kotlin

Maciej Żenczykowski   authored and   Android (Google) Code Review   commited 2025-04-04 11:02:03 -07:00
8ca69b3028
Delete RouterAdvertisementResponder
And move all other tests over to NdResponder.

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

Patrick Rohr   commited 2025-04-03 22:09:47 -07:00
d107a1692f
Rewrite RouterAdvertisementResponder in Kotlin
And integrate into EthernetManager. So it can make proper use of
PacketBuilderUtils.

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

Patrick Rohr   commited 2025-04-03 21:59:21 -07:00
75a83c51ad
Ensure PacketHandler is removed from sockets
When MdnsMultinetworkSocketClient stops using a socket (when
isSocketActive starts returning false), the packet handler should be
removed from that socket. The code only removed it from the
mSocketPacketHandlers map without clearing it from the socket.

This caused packets to be handled potentially many times, affecting
performance.

Bug: 406623719
Bug: 408324621
Test: atest
Flag: EXEMPT bugfix
Change-Id: I3d1117a4b847f3b95a01fc8a5997a53655ef608a

Remi NGUYEN VAN   commited 2025-04-04 13:34:45 +09:00
b5fbc0143a
Allow tagging sockets with a specified tag
Address the TODO to allow tagging sockets, which was done before the
code was imported to the Android codebase.

Also remove the comment in MdnsSocket, as the tagging is already done by
setting the thread tag, and tagSocket in the original code actually did
nothing for DatagramSockets.

The option is unset in the Android repository, so this code is unused
there.

Test: atest
Flag: EXEMPT unused in Android repo
Change-Id: Ifccc4ec2f0b63bf2caabe1d9ef4f57f08731a2b1

Remi NGUYEN VAN   commited 2025-04-04 09:30:36 +09:00
766451a785
Merge "Temporarily raise the number of system requests to 375" into main
Jean Chalard   authored and   Android (Google) Code Review   commited 2025-04-03 16:57:15 -07:00
48c667e43a
Merge "Avoid unnecessary lost callbacks" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-04-03 04:15:34 -07:00
0da2789931
Merge changes from topic "Optimized ESR" into main
* changes:
  Optimized Expired Service Removal
  Exclude expired services in response retrieval
  Update cached service first query time

Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-04-03 04:13:22 -07:00
6fa69e9935
Merge "De-duplicate the keepScore func in the CS unit test." into main
Xiao Ma   authored and   Android (Google) Code Review   commited 2025-04-03 04:03:01 -07:00
933e62d145
Avoid unnecessary lost callbacks
The lost callback should be skipped if the service has not been
previously notified. Otherwise, the listener could inadvertently
initiate the service removal process for the incorrect service.

Bug: 387910548
Test: atest ConnectivityCoverageTests NsdManagerTest
Flag: EXEMPT legacy flag nsd_optimized_expired_service_removal
Change-Id: I7fdf31f0b15f19becc10fcb35c7b1f47dcc38c27

Paul Hu   commited 2025-04-03 09:32:28 +00:00
1cba7f04ca
Optimized Expired Service Removal
This commit introduces a new feature to optimize the removal of
expired services. After the query is sent, a task is scheduled
with a 2-second delay to wait for responses. During this delay,
if a service response is received, the service information is
updated, and the service is removed from the removal list. After
the delay, services that are expired, have sent a query, and for
which the query time was 2 seconds ago are removed, and listeners
are notified.

Bug: 387910548
Test: atest ConnectivityCoverageTests NsdManagerTest
Flag: EXEMPT legacy flag nsd_optimized_expired_service_removal
Change-Id: I498747839664eed8fe5b73a6f6d002deb9167271

Paul Hu   commited 2025-04-03 09:32:01 +00:00
1fd85ef1db
Exclude expired services in response retrieval
Update MdnsServiceCache to enhance its ability to retrieve
responses and manage expired services effectively. Introduce an
argument `excludeExpiredServices` to control whether expired
services should be excluded when retrieving responses. And add a
new method `markExpiredServices` to mark services as expired
based on their TTL and current time.

Bug: 387910548
Test: atest ConnectivityCoverageTests NsdManagerTest
Flag: EXEMPT legacy flag nsd_optimized_expired_service_removal
Change-Id: Ifa30fbe75a72ea400a69ab258d67381a54faf9b5

Paul Hu   commited 2025-04-03 09:27:14 +00:00
14c515562a
Update cached service first query time
Updated the MdnsServiceCache to maintain the first query time
after the last update of cached services, allowing for more
accurate expired service management.

Bug: 387910548
Test: atest ConnectivityCoverageTests NsdManagerTest
Flag: EXEMPT legacy flag nsd_optimized_expired_service_removal
Change-Id: I6da0691ece239b3b2e5dc5198a656cf21b30e953

Paul Hu   commited 2025-04-03 09:27:01 +00:00
60488fea83
Merge "Only flush records with matching rrtype" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-04-03 00:43:25 -07:00
1d2828a993
Only flush records with matching rrtype
MdnsResponseDecoder flushed all address records when receiving an
address record with the the cache-flush bit is set. However as per
RFC6762 10.2, only records with a matching rrtype should be
flushed, which means that AAAA records should not be flushed when an A
record is received, and vice-versa.

Fix the logic and include a default-on flag to allow turning it off if
needed.

Test: atest
Flag: EXEMPT bugfix
Bug: 407698496
Change-Id: I6142f9996362dd7c16b4e80c8019f0cb1caef174

Remi NGUYEN VAN   commited 2025-04-03 15:14:46 +09:00
d66c016ca1
Temporarily raise the number of system requests to 375
This is a stopgap to palliate a bad interaction between
ConnectivityService and JobScheduler.

To help developers find request leaks and protect against OOMs
in the system server, ConnectivityService is enforncing a maximum
number of network requests/callbacks per UID. It has a higher
value for system UIDs because some system components need to
file requests on behalf of apps, most prominently JobScheduler.

The count is increased on entry in ConnectivityService, on the
Binder thread ; this is when CS can throw TooManyRequestsException
to the caller, it could not do that later when the request is
actually registered on the handler thread.
Conversely it only decreases the count on the handler thread,
because until then it doesn't know whether the request was
actually registered, and it can't look at that data structure on
the Binder thread.
This leads to a slightly confusing result where a UID can register
a request immediately after it unregisters one, and it will receive
TooManyRequestsException, because the unregister hasn't been
processed yet and the count not decremented yet.
This is arguably a bug, but if your app is treading on that last
request, you almost certainly had a leak anyway, and you should
not be trying to play with the exact count of requests either.
The remaining case is when an app would unregister and register
requests again in a tight loop, but there is no valid use case for
that, right ? Right !?

Enter JobScheduler. Because the limit for system UIDs is 250
requests but there can be more than 250 UIDs (especially on
devices with multiple users), JobScheduler has its own limit of
requests (which is set to 125). It has heuristics to choose which
are the most important 125 UIDs to file requests for.

When the request count exceeds 125, or when something
happens that may change which are the most important 125
UIDs, JobScheduler will re-evaluate which are the most important
ones. Upon doing this, it will unregister all requests and file
again the important ones in a tight loop. At worst, it will
therefore remove 125 requests and add 125 requests again,
taking up at most all 250 requests allowed for system UIDs ;
if the system server has any other request outstanding (and
it does), it may hit the issue where CS doesn't know yet that
requests have been unregistered, and crashes and hilarity ensue.

To palliate the issue above, this patch increases the allowed
request count for system UIDs by 125. This immediately should
fix the issue where all 250 requests are taken up by JobScheduler.

For a long-term fix, we should instead make at least one of the
following fixes :
- Have JobScheduler be smarter, and make sure it only unregisters
  the requests that it no longer needs instead of all of them.
- Make CS only throw when the requests are really full, by using
  some combination of locking, making the caller wait or similar.
- Have a separate pool of requests for JobScheduler that is
  dimensioned so it knows it can file all the necessary requests
  and no longer has to limit itself, and simplify the JS code.

Flag: EXEMPT bugfix
Bug: 391114053
Test: ConnectivityServiceTest
Change-Id: I4c4702e2d0c5d03eb5f3d6fe0f1578a210b188e8

Chalard Jean   commited 2025-04-03 15:02:20 +09:00
ff3222ce51
Skip testMobileDataPreferredUids on automotive
Test: android.net.cts.ConnectivityManagerTest#testMobileDataPreferredUids
Bug: 404186833
Flag: TEST_ONLY
Change-Id: I71843f9cfd0692f1ad1e5d55b9559a1a3f5d3919

Tomasz Wasilczyk   commited 2025-04-02 18:39:22 -07:00
9236a3e6bf
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
Merge "Improve stability of APFv{4,6} multi-device tests" into main
Yuyang Huang   authored and   Android (Google) Code Review   commited 2025-04-02 06:42:36 -07:00
1843442d0a
Improve stability of APFv{4,6} multi-device tests
This commit enhances the stability of the APFv{4,6} multi-device tests by addressing several sources of flakiness and improving the test setup and validation.

Specifically, this commit:

* Increased sleep time in the test setup. This ensures APF is activated before each test, preventing unexpected behavior.
* Added sleep time in `ApfV4Test` to ensure APF remains enabled and is not disabled due to high throughput scenarios.
* Changed the validation order to first check received packets and then APF counters. This helps to more easily identify the root cause of test failures.
* Changed the Ethernet destination address from multicast to unicast in `ApfV6Test` to prevent packets from being filtered due to DTIM skip.
* Removed the `test_broadcast_arp_request_offload()` test, which was flaky due to DTIM skip and is adequately covered by the `test_unicast_arp_request_offload()` test.

Bug: 406570694
Flag: TEST_ONLY
Test: atest CtsConnectivityMultiDevicesTestCases:ApfV4Test
Test: atest CtsConnectivityMultiDevicesTestCases:ApfV6Test
Test: run cts -m CtsConnectivityMultiDevicesTestCases --skip-preconditions -t ApfV4Test --shard-count 2
Test: run cts -m CtsConnectivityMultiDevicesTestCases --skip-preconditions -t ApfV6Test --shard-count 2
Change-Id: I053509459078d0bd94e16a6bf7349b948f930e6c

Jimi Chen   authored and   Yuyang Huang   commited 2025-04-02 04:31:01 -07:00
744a17443a
Add integration test for Wifi P2p Group Owner Network Agent
This exercise tests the flow from WifiP2pManager APIs to the
network callbacks fired by the ConnectivityService, on a
single device.

This change also makes utilities under
com.google.snippet.connectivity into a java library so they
can be reused by other modules.

Flag: TEST_ONLY
Test: m CtsTetheringTest && atest \
      CtsTetheringTest:android.tethering.cts.TetheringWifiP2pTest
Bug: 406172997
Change-Id: I32095316a5deadee7acba94c318fee666cd1303d

Junyu Lai   commited 2025-04-02 16:12:55 +08:00
35d2c6a7f3
Merge "Add hostapd callstack to TetheringManagerTest dump" into main
Quang Luong   authored and   Android (Google) Code Review   commited 2025-04-01 19:07:45 -07:00
60f27c974f
Merge "Let MdnsSocket guess networks of incoming packets" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-04-01 17:05:14 -07:00
c4ed32bc86
Let MdnsSocket guess networks of incoming packets
When using MdnsSocketClient (unused in the platform, may be used as a
library), allow guessing the Network of incoming packets based on their
source address.

This is flawed as there may be races between LinkProperties updates,
interfaces going up/down, and packets being received, and the source
address can not always be mapped 1:1 to an interface prefix, but it
should improve the situation for legacy code that currently assumes the
Network is the last one that was used for sending, which is often wrong.

Test: atest
Flag: EXEMPT: dead code in Android repo
Change-Id: I885c741d3d40b1b128a06b6d7a7aff8e0551ffea

Remi NGUYEN VAN   commited 2025-04-02 09:02:36 +09:00
bdc48fcc63
Clean up allowMultipleSrvRecordsPerHost
This is hardcoded to true, and there is no use-case for setting it to
false.

Test: atest
Flag: EXEMPT refactor
Change-Id: I1c1b8f8ac4015adfa9900012c576312b5193433a

Remi NGUYEN VAN   commited 2025-04-01 18:43:29 +09:00
ce737da8af
De-duplicate the keepScore func in the CS unit test.
Flag: EXEMPT test-only change
Bug: 368416967
Test: atest CSSatelliteNetworkTest
Test: atest CSCaptivePortalAppTest
Test: atest CSLocalAgentTests
Change-Id: I0739f4524e5dd5ec0d5f3c170c82120ca30e8730

Xiao Ma   commited 2025-04-01 17:02:42 +09:00
315cf7110c
Add hostapd callstack to TetheringManagerTest dump
TetheringManagerTest may fail on T devices in rare cases due to hostapd
hanging. Log the hostapd callstack upon failure in #testStopAllTethering
so we can analyze it the next time the failure happens.

Flag: EXEMPT test-only change

Bug: 299687365
Test: atest TetheringManagerTest
Change-Id: I59ce9dc98be7eb3689dae4863078360534edc802

Quang Anh Luong   commited 2025-04-01 16:49:26 +09:00
97e205cf0c
Merge "Move EthernetTestInterface to testutils" into main
Patrick Rohr   authored and   Android (Google) Code Review   commited 2025-03-28 11:37:09 -07:00
89714bbae0
Move EthernetTestInterface to testutils
To make it usable for integration tests not in CTS.

Test: TH
Change-Id: If243997f086c442d4f0ef8f3c77760fada769448

Patrick Rohr   commited 2025-03-28 10:06:13 -07:00
f23f6ae45b
Merge "Move responseMatchesOptions() to MdnsUtils" into main
Paul Hu   authored and   Android (Google) Code Review   commited 2025-03-28 03:29:30 -07:00
1f1b6995fa
Move responseMatchesOptions() to MdnsUtils
Move utility method responseMatchesOptions() to MdnsUtils, where
it can be used by other mDNS classes.

Bug: 387910548
Test: atest ConnectivityCoverageTests NsdManagerTest
Change-Id: Idecd5e7d4c2c4dcf108c42e07a7befd97b68b5a7

Paul Hu   commited 2025-03-28 01:47:06 +00:00
3dc5357c0b
Merge changes from topic "revert-3561690-revert-3538339-SNUWWZJNJZ-BUWEOGUTIT" into main am: 2519a78731
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3563843

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

Treehugger Robot   authored and   Automerger Merge Worker   commited 2025-03-27 01:14:42 -07:00
480d443869
Merge changes from topic "revert-3561690-revert-3538339-SNUWWZJNJZ-BUWEOGUTIT" into main
* changes:
  Add TargetApi annotation to ConnectivityService and QuicConnectionCloser
  Revert "Revert "Remove unnecessary ifindex arg from destroyUdpSo..."
  Revert "Revert "Add hidden API to register/unregister QUIC conne..."

Treehugger Robot   authored and   Gerrit Code Review   commited 2025-03-27 00:41:36 -07:00
2519a78731
Merge "Fix transport override" into main am: c20c1224bc
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3561446

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

Patrick Rohr   authored and   Automerger Merge Worker   commited 2025-03-26 19:38:19 -07:00
29b3dfebd0
Revert "Revert "Add hidden API to register/unregister QUIC conne..."
Revert submission 3561690-revert-3538339-SNUWWZJNJZ

Reason for revert: NewAPI error will be fixed by separate CL

Reverted changes: /q/submissionid:3561690-revert-3538339-SNUWWZJNJZ

Change-Id: Ia7367e9332f4d376bd0be4c03c095ee00de9177a

Motomu Utsumi   commited 2025-03-27 08:49:00 +09:00
e8e28f6236
Fix transport override
The EthernetConfigParser was adding the transportType on top of the
TRANSPORT_ETHERNET of DEFAULT_CAPABILITIES, causing multiple transport
types to be added.

This was causing an IllegalStateException when trying to set the
NetworkSpecifier within the EthernetNetworkFactory.

This only applies for when isAtLeastB && capabilitiesString.equals("*")
is true (as the parsed capability is equal to DEFAULT_CAPABILITIES).

Flag: TEST_ONLY
Bug: 405172885
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.ethernet.EthernetTrackerTest
Change-Id: I6678a52ddc87b8ad66c602c68335f3e2073d7231

Chris Desir   authored and   Patrick Rohr   commited 2025-03-26 15:51:04 -07:00
65a26519c0
Merge changes from topic "revert-3538339-SNUWWZJNJZ" into main am: 86961c4b73
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3561690

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

Chaitanya Cheemala (xWF)   authored and   Automerger Merge Worker   commited 2025-03-26 04:08:27 -07:00
3d3b87b4f9
Merge changes I0eb70c12,I6cd727bd into main am: ebdcd9e199
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3538339

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

Treehugger Robot   authored and   Automerger Merge Worker   commited 2025-03-26 03:11:15 -07:00
fdb5ac536f
Revert "Add hidden API to register/unregister QUIC connection cl..."
Revert submission 3538339

Reason for revert: Likely culprit for b/406432012 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.

Reverted changes: /q/submissionid:3538339

Change-Id: I61b02f2b1b667e9a41b677f8062e8e96aac09f6e

Chaitanya Cheemala (xWF)   commited 2025-03-26 03:07:07 -07:00
947b53b0d3
Add hidden API to register/unregister QUIC connection close payload
QUIC stack running on the app process will call this API and register
QUIC UDP socket and UDP payload that can close QUIC connection.

When the app loses network access (e.g. due to freezer or firewall
chain), ConnectivityService 1)destroys the registered UDP socket by
sending a SOCK_DESTROY netlink message and 2)sends the registered UDP
payload to the server. This prevents unnecessary modem wakeups caused
by packets from the server after the apps lose network access.

Additionally, to close QUIC connection for apps that crash or are
killed, ConnectivityService sends the registered UDP payload when it
receives a socket destroy diag message for the registered socket.

Bug: 311792075
Test: CSDestroySocketTest CtsNetTestCases
Change-Id: I6cd727bd8bb0fe1d17360edfa395f73d24da6920

Motomu Utsumi   commited 2025-03-26 16:48:28 +09:00
627b8c6d34
Merge "Delete unused function" into main am: 45173f74d3
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3561187

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

Patrick Rohr   authored and   Automerger Merge Worker   commited 2025-03-25 15:56:25 -07:00
2b0899c009
Merge "Delete unused function" into main
Patrick Rohr   authored and   Gerrit Code Review   commited 2025-03-25 15:36:12 -07:00
45173f74d3
Merge "Move static IpConfiguration parsing into EthernetConfigParser" into main am: 43e8226877
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3561186

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

Treehugger Robot   authored and   Automerger Merge Worker   commited 2025-03-25 13:54:16 -07:00
66d75a648c