Commit graph android_packages_modules_Co.../tests/unit/java/com/android
Message SHA1
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
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-03-21 17:29:50 -07:00
9c163e4207
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
* 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
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
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
Only apply the early network agent creation on B
...and if the feature is not killed.

For devices on V and below, this feature should be subject
to a rollout. That rollout should be done in mainline beta
if possible at all, meaning the flags can be defined later.

If beta isn't possible after all, a legacy rollout can happen
starting in M2025-06 too.

Test: manual
Change-Id: I941762bf759ce25b4bd1f908e971ceaf4f49f671

Chalard Jean   commited 2025-03-21 19:29:07 +09:00
3d0e3121d9
Make sure tests know to handle both early creation true and false
This is necessary to pass tests whatever the values of the features are.

NetworkAgentTest was updated assuming the feature was true, so
this patch revives the old code for when it's false.

TestableNetworkAgent reads the feature directly from
ConnectivityManager when it's not mocked.

Test: CtsNetTestCases
Change-Id: Ia556fbb1d1b6a38a4995b021981e2693d778bfff

Chalard Jean   commited 2025-03-21 19:29:06 +09:00
0cc8d81cc7
Merge changes I1707d28e,Ibb4a2916 into main
* changes:
  Dump top distinct tag counts per uid
  Support per uid tag throttling to NetworkStats

Treehugger Robot   authored and   Gerrit Code Review   commited 2025-03-21 03:21:36 -07:00
04271629cc
Support per uid tag throttling to NetworkStats
Introduced filtering of NetworkStats based on the number of
distinct tags per UID, to prevent excessive memory usage.

This feature is default enabled with a kill switch
per_uid_tag_throttling. And a DeviceConfig that allows
customization of throttling threshold.

Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.net.NetworkStatsFactoryTest
Bug: 364353020
Change-Id: Ibb4a2916306153d229ab996247eb6e78009f0fb0

Junyu Lai   commited 2025-03-21 16:52:23 +08:00
2a451ea222
Reapply "Always disconnect agents immediately."
Now that the faulty test is fixed,
This reverts commit 19dcc447c4.

Test: ConnectivityCoverageTests CtsNetTestCases FrameworksTelephonyTests
Change-Id: I30fa35cef1729e6ecd4140c52fabfa2da1a9bb4b

Chalard Jean   commited 2025-03-21 14:57:25 +09:00
9fdc988dc8
Move capability parsing to EthernetTrackerConfig
Test: EthernetTrackerTest
Change-Id: Iceacbcabb21ec4227b485a0f97e10cb78c7551aa

Patrick Rohr   commited 2025-03-20 15:06:16 -07:00
e0fd64321d
Move transport parsing to EthernetTrackerConfig
Test: EthernetTrackerTest
Change-Id: I849ab478a101955c71e7881eb6609f5630a0062a

Patrick Rohr   commited 2025-03-20 15:06:16 -07:00
c28cd83cee
Delete unnecessary createEthernetTrackerConfig function
Test: TH
Change-Id: I145de9bfc4b3c57a18a652eebfe6c668920e7851

Patrick Rohr   commited 2025-03-20 11:44:34 -07:00
3a4c4c593a
Merge changes from topic "revert-3548747-TOVIIQGWFJ" into main
* changes:
  Revert "Make iterating over mNetworkAgentInfos safer."
  Revert "Always disconnect agents immediately."
  Revert "Immediately create networks unless chickened out"

ESWAR MAGATAPALLI (xWF)   authored and   Gerrit Code Review   commited 2025-03-20 00:52:25 -07:00
5a3a51eb7a
Revert "Always disconnect agents immediately."
Revert submission 3548747

Reason for revert: Droidmonitor created revert due to b/404956859. Will be verified through ABTD for standard investigation.

Reverted changes: /q/submissionid:3548747

Change-Id: I44affb742ca066406e93fc75056b4d3d1298eadb

Satish Yalla   commited 2025-03-19 20:18:37 -07:00
19dcc447c4
Release ClientNetworkRequest before marking request unfulfillable
Otherwise, the tear down code that unregisters the NetworkAgent runs
after calling declareNetworkRequestUnfulfillable() which surpresses the
onLost() callback.

Test: CSL2capProviderTest
Change-Id: I447881bd4bd76ba492abf6cc3177143db626749e

Patrick Rohr   commited 2025-03-19 17:12:07 -07:00
512b789a8d
Merge changes I65763a52,Ib1d77da3,I5d8b3850 into main
* changes:
  Immediately create networks unless chickened out
  Always disconnect agents immediately.
  Make iterating over mNetworkAgentInfos safer.

Jean Chalard   authored and   Gerrit Code Review   commited 2025-03-19 15:09:28 -07:00
451f2dd39d
Always disconnect agents immediately.
This relands aosp/2623893 now that the underlying timing
issues have been fixed. It also addresses the two outstanding
comments that had not been fixed. It conditions it on the
"queue in system server" feature.

Currently, various codepaths in ConnectivityService disconnect
networks using NetworkAgentInfo#disconnect. This posts a message
to the NetworkAgent to disconnect and also posts a message to
ConnectivityService to call disconnectAndDestroyNetwork, which
performs all cleanup in ConnectivityService. These two messages
race and the order is non-deterministic.

Instead, always disconnect using disconnectAndDestroyNetwork,
and have disconnectAndDestroyNetwork post the message to the
agent to disconnect.

This fixes a bug where if wifi uses unregisterAfterReplacement
twice in quick succession, when the third agent connects it
doesn't work because the interface is still being used by the
second network.

Bug: 286649301
Test: covered by existing tests
Change-Id: Ib1d77da39232c02060a7a7c016ffd3a969e2356d

Lorenzo Colitti   authored and   Chalard Jean   commited 2025-03-19 21:03:23 +09:00
0e9f5e626b
Fix kotlin lint errors
This change is a no-op which only fix lint errors.
This is necessary to make the subsequent changes easier to review.

Test: TH
Bug: 349487600
Change-Id: Ief867009db6aaabd9d0759048cdd7c3318991b02

Junyu Lai   commited 2025-03-19 10:52:36 +08:00
c3717cf502
Fix SSID in notification for RTL languages
Use the BidiFormatter for the SSID in the notification, as it may need
to be printed differently from the enclosing sentence in RTL languages.

Bug: 316498718
Test: atest
Change-Id: Ibac72235a19e1dc4304bd1e63fc75d019e1a2c19

Remi NGUYEN VAN   commited 2025-03-18 18:00:07 +09:00
51ca5c6a14
Reapply "Add a queue system server-side for NetworkAgent"
Now that faulty Telephony tests have been disabled temporarily
to allow for this bugfix, this can be reverted.
This reverts commit a5ec9b4112.

Test: FrameworksTelephonyTests CtsNetTestCases
Change-Id: I71abf9d02bdd34a4de80157a3f42bdfee6f6617e

Chalard Jean   commited 2025-03-18 14:42:54 +09:00
3c040009c5
Merge "Add CachedService Class" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-03-17 09:59:20 -07:00
ac1af41d42
Merge changes from topic "revert-3535182-EBVRAQTHFS" into main
* changes:
  Revert "Return the registry in registerNetworkAgent."
  Revert "Unify registration and NM assignment in NAI"
  Revert "Add a queue system server-side for NetworkAgent"

Pechetty Sravani (xWF)   authored and   Gerrit Code Review   commited 2025-03-17 02:23:26 -07:00
67cc745550
Add CachedService Class
This is a no-op refactoring. A new CachedService class is
introduced to better represent cached services and their expired
status. This class will be used to optimize expired service
removal in subsequent changes.

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

Paul Hu   commited 2025-03-17 07:58:59 +00:00
b6339349a4
Revert "Add a queue system server-side for NetworkAgent"
Revert submission 3535182

Reason for revert: <Droidmonitor created revert due to b/404070202.Will be verified through ABTD for standard investigation.>

Reverted changes: /q/submissionid:3535182

Change-Id: Id48ef1cf44911cb291bcd8db349934751297718b

Pechetty Sravani (xWF)   authored and   Gerrit Code Review   commited 2025-03-17 00:48:05 -07:00
a5ec9b4112
Merge changes I4bc29b10,I94a56b2b,I9ca025b1 into main
* changes:
  Add a queue system server-side for NetworkAgent
  Unify registration and NM assignment in NAI
  Return the registry in registerNetworkAgent.

Jean Chalard   authored and   Gerrit Code Review   commited 2025-03-16 15:57:51 -07:00
f04de0efc1
Merge changes I0b3ac7b4,I90385146 into main
* changes:
  Add Abstract Class for RealtimeScheduler
  Implement RealtimeScheduler in DiscoveryExecutor

Treehugger Robot   authored and   Gerrit Code Review   commited 2025-03-16 09:27:17 -07:00
7d1b5b56ce
Add Abstract Class for RealtimeScheduler
Because some APIs in RealtimeScheduler are higher than the min
SDK version for the standalone MDNS build, an abstract class is
required to allow the standalone MDNS build to pass.

Bug: 366373064
Test: atest FrameworksNetTests NsdManagerTest
      m service-connectivity-mdns-standalone-build-test
Change-Id: I0b3ac7b4f8dfceeb3dd81e6a5f368b5d57927c41

Paul Hu   commited 2025-03-16 14:46:14 +00:00
b84bb3b448
Implement RealtimeScheduler in DiscoveryExecutor
This provides more accurate delay callbacks, thereby enhancing
the executor's overall functionality.

Bug: 366373064
Test: atest FrameworksNetTests NsdManagerTest
Change-Id: I903851464a92427b6e256573d693bb89a96d013f

Paul Hu   commited 2025-03-16 14:45:00 +00:00
0f4d1ab4d9
Add a queue system server-side for NetworkAgent
The intent is to remove the queue on the NetworkAgent side.
This queue is triggered with the same conditions as the
existing one.

Test: ConnectivityCoverageTests, CtsNetTests
Change-Id: I4bc29b10e48e13cdf3c3a8a15a7c8d15954d2457

Chalard Jean   commited 2025-03-14 13:23:50 +09:00
34ccc71462
Creating interface name to index tracking for Bpf Maps.
Adding mechanism to track interaface name to interface index, this map
would be used by BpfNetMaps for storing interface index.

Bug: 400681214
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivity.InterfaceTrackerTest
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.BpfNetMapsTest
Change-Id: I2a65cac908d9c4d10714e3fe26be20322d4a1db3

Sarup Dalwani   commited 2025-03-13 17:04:54 +00:00
53ecd95072
Merge "Use non-extended mockito for net-tests-utils" into main
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2025-03-11 19:00:20 -07:00
ec2a5cc5c5
Use non-extended mockito for net-tests-utils
Mockito extended tends to cause all kinds of issues due to the way it
injects itself into the bytecode of framework classes instead of
creating subclasses.

Use non-extended mockito as it is not actually necessary for current
tests.

Test: atest
Change-Id: Id2874309cce2778c4405b852df9a3ae816c4abcb

Remi NGUYEN VAN   commited 2025-03-10 17:59:19 +09:00
05c376a4c5
Merge "Enable early native network creation for local network" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-03-09 20:53:11 -07:00
daa1f52b02
Enable early native network creation for local network
This is needed by tethering local network feature, given that
the IpServer needs to setup forwarding after native network
creation and before signaling network availability.

Test: atest CtsNetTestCases:android.net.cts.NetworkAgentTest \
      ConnectivityCoverageTests:android.net.EthernetTetheringTest \
      ConnectivityCoverageTests:android.net.connectivity.com.android.server.ConnectivityServiceTest \
      --update-device
Bug: 349487600
Change-Id: I2bc2ec355e01be661b587406bd127dff11665047

Junyu Lai   commited 2025-03-10 10:31:11 +08:00
91ef9d38e3
Merge "Create the DiscoveryExecutor Class" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-03-06 19:02:14 -08:00
b153713418
Merge "Revert^2 "Use timerfd to improve the accuracy of query timing"" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-03-06 12:52:13 -08:00
c23d94f2cc
Create the DiscoveryExecutor Class
This is a no-op refactor. Move the DiscoveryExecutor from
MdnsDiscoveryManager to a standalone class for subsequent
changes.

Bug: 366373064
Test: atest FrameworksNetTests NsdManagerTest
Change-Id: Idbfbbb423ddfe78a37db1b189aef945401b0a1e9

Paul Hu   commited 2025-03-06 15:13:44 +00:00
bca2d037a9
Revert^2 "Use timerfd to improve the accuracy of query timing"
This reverts commit a481dc184f.

Reason for revert: Update this change to ensure proper closure of the timerfd object.

Change-Id: I14530ba77a39c77b4c7af6855ec77ba4907ab9f9

Paul Hu   commited 2025-03-06 15:13:12 +00:00
a3a34058fe
Merge "Add config_nsdOffloadServicesDenyList to NsdService" into main
Yuyang Huang   authored and   Gerrit Code Review   commited 2025-03-06 06:10:06 -08:00
648d01b9f4
Add config_nsdOffloadServicesDenyList to NsdService
This commit introduces the config_nsdOffloadServicesDenyList to
NsdService to allow OEMs to specify services that should not be
offloaded. This feature addresses potential memory limitations by
enabling selective offloading, providing OEMs with greater control over
resource management.

Test: TH
Change-Id: I846e7cfc37c3a71c50853707884cf0c0a9a6f971

Yuyang Huang   commited 2025-03-06 21:30:21 +09:00
9b0f749723
Merge "Format MdnsServiceCacheTest" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-03-05 00:02:42 -08:00
15ae8bb8f7