Commit graph android_packages_modules_Co.../tests/unit/java/com/android
Message SHA1
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
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
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
Format MdnsServiceCacheTest
Use the ktlint.py script to correct Kotlin code formatting errors.

Test: m
Change-Id: I587c757f3c96be7a5f6c60ec16eaf662bf148df3

Paul Hu   commited 2025-03-05 06:52:02 +00:00
47959aefd3
Merge "Adding more test cases for stacked link properties for local network." into main
Sarup Dalwani   authored and   Gerrit Code Review   commited 2025-03-01 10:03:31 -08:00
9de6f57d2d
Add 6lowpan decompression tests for invalid packets
Test: TH
Change-Id: I694cdf302a743a0a2e1bf2d821094511863a6600

Patrick Rohr   commited 2025-02-27 12:52:29 -08:00
ad43341d49
Fix linter errors
Test: TH
Change-Id: I662caff2c0ce841dbc4cea836c093a6cf6b218db

Patrick Rohr   commited 2025-02-27 12:50:35 -08:00
0026cb36c0
Merge "Never read device flag values in ConnectivityServiceTest." into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-02-25 23:40:40 -08:00
bcd092b08c
Never read device flag values in ConnectivityServiceTest.
ConnectivityServiceTest is a unit test and must never read
actual flag values from the device, because:
- If it did, its results would not be reproducible.
- At least on S and T, reading flags from device fails because
  the test lacks the READ_DEVICE_CONFIG permission.

Instead, throw a clear exception if ConnectivityService checks a
feature flag that is not explicitly set in the test.

Test: test-only change
Change-Id: Ic3855ffa944f170f5fda9c3456776f5e1f2ef388

Lorenzo Colitti   commited 2025-02-26 13:25:07 +09:00
2322bc04cb
Merge "Handling null interface in addLocalNetAccess, removeLocalNetAccess and getLocalNetAccess" into main
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2025-02-25 20:20:49 -08:00
cbd6238696
Merge changes Ic597ee91,I6a2b48aa,Ia71c79aa,I570dbff5,Ia063deea, ... into main
* changes:
  Get rid of volatile mIsAborted
  Get rid of volatile mIsRunning
  Add some more client network tests
  Add test for when BluetoothSocket#connect throws
  Add a test for when createInsecureL2capChannel throws
  Add a test that brings up an L2cap server network
  Move creating L2capIpClient to Dependencies

Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2025-02-25 14:17:58 -08:00
695779c24d
Enable NetworkCallback optimizations by default.
These optimizations are already launched to all public Pixel
devices and were in in 25Q2 beta releases as well. Enable them
by default on all supported releases. The appcompat risk is very
low (these changes are difficult even for an app to detect if
it's looking for them), the user benefits are substantial, and
there is a kill switch if any unforeseen issues do occur.

Bug: 327038794
Test: both codepaths are covered by existing tests
Change-Id: I42c7ceb71ef02d078bf4563744cb11afd412f267

Lorenzo Colitti   commited 2025-02-26 04:24:58 +09:00
2169522878
Merge "Allow mDNS on IFF_POINTOPOINT interfaces" into main
Patrick Rohr   authored and   Gerrit Code Review   commited 2025-02-24 19:09:47 -08:00
81e6bdccd3
Add some more client network tests
Test: TH
Change-Id: Ia71c79aa34c8fcfb078511543695ceddde4af53c

Patrick Rohr   commited 2025-02-24 17:02:36 -08:00
c060ffe22f
Add test for when BluetoothSocket#connect throws
Test: TH
Change-Id: I570dbff550ac1f1c167af5a25b471e41bf421dc2

Patrick Rohr   commited 2025-02-24 17:02:36 -08:00
e87e9241a0
Add a test for when createInsecureL2capChannel throws
Test: TH
Change-Id: Ia063deeaced151870138568e103a605a75813af9

Patrick Rohr   commited 2025-02-24 17:02:36 -08:00
d621b3d8aa
Add a test that brings up an L2cap server network
Test: TH
Change-Id: I9f2d750a822ce1790c9a766415ffc494a47d9287

Patrick Rohr   commited 2025-02-24 17:02:36 -08:00
1446e7a428
Handling null interface in addLocalNetAccess, removeLocalNetAccess and getLocalNetAccess
Bug: 398022752
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.BpfNetMapsTest
Change-Id: I4627fb83727d81108ed4629beb80a36e5433e140

Sarup Dalwani   commited 2025-02-24 20:13:46 +00:00
2e336acd5b
Merge changes Ib2febede,Id3752790,I7cfcc93a,I26f6669f,I5d722c0d into main
* changes:
  Add missing javadocs to satisfy linter
  Make linter happy
  Use ThreadLeakMonitor for CSL2capProviderTest
  Add some tests to ensure BluetoothExceptions are handled
  Move creating L2capPacketForwarder to dependencies

Patrick Rohr   authored and   Gerrit Code Review   commited 2025-02-21 15:04:40 -08:00
2360f4500b
Allow mDNS on IFF_POINTOPOINT interfaces
Instead of disallowing mDNS on interfaces that specify IFF_POINTOPOINT,
the code should check for the presence of IFF_MULTICAST instead. It is
perfectly valid to support mDNS on point-to-point links, such as IPv6
over BLE networks, if they support multicast.

Change-Id: I282a039483ad1d677d31e5169d53bbae25a1c9c4
Test: TH

Patrick Rohr   commited 2025-02-21 14:51:08 -08:00
33dde6b069
Make linter happy
Test: TH
Change-Id: Id3752790b0c040adbb5d08ddcb7aa2279254b7de

Patrick Rohr   commited 2025-02-21 11:57:23 -08:00
4dd26d1ad2
Use ThreadLeakMonitor for CSL2capProviderTest
This CL introduces ThreadLeakMonitor for CSL2capProviderTest.
ThreadLeakMonitor ignores threads with unique names, so all
L2capNetworkProvider related threads must specify a name.

Test: TH
Change-Id: I7cfcc93ab562a1ada2058d8c73e968a8d0005b1d

Patrick Rohr   commited 2025-02-21 11:57:23 -08:00
b4f3922c01
Add some tests to ensure BluetoothExceptions are handled
This is just the beginning.

Also fixed a bug that put(null) on the blocking queue, which apparently
is not supported.

Test: TH
Change-Id: I26f6669f483d76fcba83735bb6d32880e23dd451

Patrick Rohr   commited 2025-02-21 11:57:23 -08:00
5a5c34a679
Move SkDestroyListener to under staticlibs
Upcoming CL use SkDestroyListener from ConnectivityService

Bug: 311792075
Test: atest FrameworksNetTests
Change-Id: I96dec7e13aaa574b90e7caf3b559ee5172848e51

Motomu Utsumi   commited 2025-02-21 09:26:11 +09:00
1135975109
Update SkDestroyListner to support only monitor UDP sockets close
Bug: 311792075
Test: atest FrameworksNetTests
Change-Id: Ib7749049fb0bd6ce8218ec62bec96584106ad7c5

Motomu Utsumi   commited 2025-02-21 09:26:10 +09:00
7f86b7485a
Update SkDestroyListener to take consumer for inetDiagMessage processing
This is a no-op refactoring (except for logging) in preparation for an
upcoming CL(aosp/3502915) that will use SkDestroyListener to close quic
connections for destroyed quic sockets.

Test: atest FrameworksNetTests
Bug: 311792075
Change-Id: I41e2a16075fc9242cae19f84d1255358333744ab

Motomu Utsumi   commited 2025-02-21 09:25:39 +09:00
d159016c22
Adding more test cases for stacked link properties for local network.
Addressing feedback from previous change "Adding stacked link addresses
to local_net_access map" and adding more test cases for impact of
stacked link properties on local network prefixes.

Bug: 369815823
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.BpfNetMapsTest
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.CSLocalNetworkProtectionTest
Change-Id: I4d32d86d3e083a1a14b845583fd80a7a4b18ae5f

Sarup Dalwani   commited 2025-02-20 05:46:02 +00:00
e53faa4e84
Check local network permissions when permission changes, or when user or
packages is added or removed

Bug: 388803658
Test: atest ConnectivityCoverageTests

Change-Id: I7d098c4d9a7614d0bd40ae23869a2010ee3f0779

Jacque Li   authored and   Neha Raj   commited 2025-02-20 04:59:45 +00:00
8d5c6eae80
Merge "Wrapping Network and Traffic permissions in a class for module usage." into main
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2025-02-19 19:27:48 -08:00
37e457bd0a