Commit graph android_packages_modules_Co.../tests/unit/java/com/android
Message SHA1
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
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
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
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
Merge "Move static IpConfiguration parsing into EthernetConfigParser" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-03-25 13:31:32 -07:00
43e8226877
Delete unused function
Test: TH
Change-Id: I1f81032ea14d87736e2c8890e9259f20aace4a0b

Patrick Rohr   commited 2025-03-25 11:56:41 -07:00
074c4934cd
Move static IpConfiguration parsing into EthernetConfigParser
For consistency.

Test: TH
Change-Id: Idefd43d5b22b8f5e02561601f3bc4142ce8a783e

Patrick Rohr   commited 2025-03-25 11:56:41 -07:00
5030594287
Merge "Removing interfaces from the InterfaceTracker when network is destroyed." into main am: 45a95e4b99
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3543880

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

Sarup Dalwani   authored and   Automerger Merge Worker   commited 2025-03-25 08:04:51 -07:00
f2500c577f
Merge "Removing interfaces from the InterfaceTracker when network is destroyed." into main
Sarup Dalwani   authored and   Gerrit Code Review   commited 2025-03-25 07:40:41 -07:00
45a95e4b99
Merge "Format MdnsUtilsTest" into main am: f0dcda3be3
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3556293

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

Treehugger Robot   authored and   Automerger Merge Worker   commited 2025-03-24 21:44:10 -07:00
bdb6c117af
Merge "Format MdnsUtilsTest" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-03-24 21:16:34 -07:00
f0dcda3be3
Removing interfaces from the InterfaceTracker when network is destroyed.
Bug: 400681214
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivity.InterfaceTrackerTest
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivityservice.CSInterfaceTrackerTest
Change-Id: Ifb3388800dec6ed208ca28dba080c5b736f09d35

Sarup Dalwani   commited 2025-03-25 01:34:05 +00:00
28c0533bf0
Format MdnsUtilsTest
Use the ktlint.py script to correct Kotlin code formatting errors.

Test: m
Change-Id: Ic3b4ff16fcaa465836c5b6653f1ab8dcc1b718b9

Paul Hu   commited 2025-03-24 10:06:56 +00:00
a16f8b8126
Merge "Fix SSID in notification for RTL languages" into main am: e1564ce3c8
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3235925

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

Remi NGUYEN VAN   authored and   Automerger Merge Worker   commited 2025-03-23 19:06:39 -07:00
878d5c1577
Merge "Fix SSID in notification for RTL languages" into main
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2025-03-23 18:35:59 -07:00
e1564ce3c8
Merge "Address linter errors" into main am: 9c163e4207
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3554882

Change-Id: Ibe47f8956e0781dede2b07610c55a8d8a1fb4684
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 17:37:59 -07:00
c7ce92394f
Merge "Address linter errors" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-03-21 17:29:50 -07:00
9c163e4207
Merge changes I1d25e5c4,I367f5377 into main am: ee58f011ed
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3554881

Change-Id: I871477ea7e232b93e00ac9adf8f813ec01f4660f
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 16:40:14 -07:00
64c00aa254
Merge changes Ie63a3583,I1354ec53,I3806750a,I48d0b0f9,I4da56735 into main am: d022fac1c2
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3554879

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

Maciej Å»enczykowski   authored and   Automerger Merge Worker   commited 2025-03-21 16:39:18 -07:00
80bc530874
Merge changes I1d25e5c4,I367f5377 into main
* changes:
  Use "*" to indicate default capabilities in config
  Move NetworkCapabilities parsing to EthernetConfigParser entirely

Treehugger Robot   authored and   Gerrit Code Review   commited 2025-03-21 16:14:26 -07:00
ee58f011ed
Merge changes Ie63a3583,I1354ec53,I3806750a,I48d0b0f9,I4da56735 into main
* changes:
  Move isAtLeastB to dependencies
  Pass nullable values to parse functions
  Rename EthernetTrackerConfig to EthernetConfigParser
  Do not support configuring test interfaces in config.xml
  Prevent mixing mutable and immutable lists

Maciej Å»enczykowski   authored and   Gerrit Code Review   commited 2025-03-21 16:08:07 -07:00
d022fac1c2
Address linter errors
Test: TH
Change-Id: I6d1fae596ea9757fe6e6b04e85b6cb8cae162a2b

Patrick Rohr   commited 2025-03-21 14:21:59 -07:00
70d98dcef2
Use "*" to indicate default capabilities in config
Instead of using an empty string, make the use of default capabilities
explicit by requiring "*" to be specified.

This behavior is more consistent and allows OEMs to explicitly configure
an interface without any capabilities (apart from those which are
hard-coded). (Technically, they could do so by specifying one of the
hardcoded capabilities in the config).

Test: TH
Change-Id: I1d25e5c4b302b0dbde5e1bb91fc1ed5a7b08be9d

Patrick Rohr   commited 2025-03-21 14:21:59 -07:00
bcb2869df1
Move NetworkCapabilities parsing to EthernetConfigParser entirely
Previously, this code path was hard to follow. EthernetConfigParser
parsed the capabilities specified in the xml, while
createDefaultNetworkCapabilities and / or createNetworkCapabilities
added additional capabilities to those specified in the xml.

This change moves the creation of the final NetworkCapabilities for
configured interfaces inside EthernetConfigParser to make it easier to
follow.

Test: TH
Change-Id: I367f53774eeee5aeca0fa7071db0403a6ce8bac5

Patrick Rohr   commited 2025-03-21 14:21:59 -07:00
00c17ed78d
Rename EthernetTrackerConfig to EthernetConfigParser
Because that's what it really is.

Test: TH
Change-Id: I3806750a87042b4ae8e816f00388d6393346d0a8

Patrick Rohr   commited 2025-03-21 10:43:48 -07:00
f0e0e2819d
Merge changes Iceacbcab,I849ab478,I145de9bf into main am: 6150ec80cc
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3554385

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

Patrick Rohr   authored and   Automerger Merge Worker   commited 2025-03-21 10:07:46 -07:00
a3cf1ded15
Merge "Only apply the early network agent creation on B" into main am: 4e2efc94f5
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3555988

Change-Id: Iba38ec6cafb3687343a7024cb41c2f22024fbd94
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 10:05:31 -07:00
986dcd0769
Merge changes Iceacbcab,I849ab478,I145de9bf into main
* changes:
  Move capability parsing to EthernetTrackerConfig
  Move transport parsing to EthernetTrackerConfig
  Delete unnecessary createEthernetTrackerConfig function

Patrick Rohr   authored and   Gerrit Code Review   commited 2025-03-21 09:37:31 -07:00
6150ec80cc
Merge "Only apply the early network agent creation on B" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-03-21 09:27:23 -07:00
4e2efc94f5
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 "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 "Make sure tests know to handle both early creation true and false" into main am: a0fa137d85
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3554646

Change-Id: I1db34d3fdd3033b59a40ef9d065e29021f1e49d7
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 05:40:31 -07:00
5f0c5ce0dc
Merge "Make sure tests know to handle both early creation true and false" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-03-21 05:02:06 -07:00
a0fa137d85
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