Commit graph android_packages_modules_Co.../tests/unit/java/com/android
Message SHA1
Merge "Creating interface name to index tracking for Bpf Maps." into main am: 9e15d35d01 am: 08c6a5f51b
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3528430

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

Sarup Dalwani   authored and   Automerger Merge Worker   commited 2025-03-13 17:50:53 -07:00
e14d845c3f
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 am: ec2a5cc5c5 am: f461ec9757
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3530432

Change-Id: I089024510345ec2eb7b2c8cef42a33a1ca3247cd
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-11 19:48:00 -07:00
bb427abe1c
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
Merge "packages/modules/Connectivity: remove usages of Mockito.verifyZeroInteractions" into main
Adrian Roos   authored and   Android (Google) Code Review   commited 2025-03-11 04:57:42 -07:00
c982228563
Merge "packages/modules/Connectivity: remove usages of deprecated Mockito matchers" into main
Adrian Roos   authored and   Android (Google) Code Review   commited 2025-03-10 09:37:09 -07:00
e43941eedd
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
packages/modules/Connectivity: remove usages of deprecated Mockito matchers
Test: m checkbuild
Flag: TEST_ONLY
Bug: 310268946
Change-Id: Icef421511b6fed6dc7912a9b703773ba5700c62a

Adrian Roos   commited 2025-03-10 02:16:21 +01:00
6cc971daab
packages/modules/Connectivity: remove usages of Mockito.verifyZeroInteractions
The method has been replaced by verifyNo(More)Interactions
in later Mockito versions.

Test: m checkbuild
Flag: TEST_ONLY
Bug: 310268946
Change-Id: I57faa43a5f158bb131f64c19d93de99e04f257ca

Adrian Roos   commited 2025-03-09 23:32:11 +01:00
133f347e80
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
Merge "Adding stacked link addresses to local_net_access map" into main
Sarup Dalwani   authored and   Gerrit Code Review   commited 2025-02-19 19:01:55 -08:00
c42f5fc47f
Merge changes I77101952,I399631c6,I5ea98a06,I0b243f45,I5554cd42, ... into main
* changes:
  Fix test comment
  Enable header compression when requested
  Implement 6lowpan header compression
  Add a basic CSTest for L2capNetworkProvider
  Release network reservations in tearDown
  Start L2capNetworkProvider in CS
  Revert "Join HandlerThread if BLE is not supported"

Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2025-02-18 21:39:41 -08:00
90a2f97e4c
Fix test comment
Change-Id: I77101952b24825b2c3983ccc5ac384e369a97148

Patrick Rohr   commited 2025-02-18 19:41:15 -08:00
d6bcc2c5e0
Implement 6lowpan header compression
This implements 6lowpan header compression per rfc 6282. While the
decompression logic is full-fledged (to accept almost any 6lowpan
compressed packet on ingress), the compression logic does *not* actually
compress the packet.

Fully fledged compression might be submitted in a follow up, to make
integration testing possible.

Test: TH
Change-Id: I5ea98a06e502fe0752cfe827dbdf8ee4a7dfb24c

Patrick Rohr   commited 2025-02-18 19:41:15 -08:00
a1430bbb11
Add a basic CSTest for L2capNetworkProvider
This moves the tests that used to be in L2capNetworkProviderTest into a
CSTest based CSL2capProviderTest; however, it still only tests that
reservation offers are created in response to reservation requests.

More thorough tests will be added in follow ups.

Test: TH
Change-Id: I0b243f4517ee41376716cf4930f90657c4bc77b0

Patrick Rohr   commited 2025-02-18 19:41:15 -08:00
16093391f3
Start L2capNetworkProvider in CS
Starts L2capNetworkProvider in ConnectivityService. Alternatively, this
could be moved to ConnectivityServiceInitializer instead in a follow up.

When L2capNetworkProvider is created, it starts a handler thread, so
makeL2capNetworkProvider must return null in tests as otherwise the
thread leaks.

Test: atest NetworkReservationTest
Change-Id: I35c14815b1a71f0739c1bf63ad466763d611434c

Patrick Rohr   commited 2025-02-18 19:19:22 -08:00
611ce3f57c