Commit graph android_packages_modules_Co.../staticlibs/tests
Message SHA1
Refactor: apply pyformat for coding style consistency
add pyformat for presubmit hook

Flag: EXEMPT mainline
Bug: 419423721
Test: atest CtsConnectivityMultiDevicesTestCases
Change-Id: I9abc5cee454e8c8e21ce7e3c134145857680251f

Jimi Chen   commited 2025-05-28 12:44:57 +00:00
dcbe9b403d
Replace get_apf_counter from apf shell command instead of dumpsys
Flag: EXEMPT mainline
Bug: 419423721
Test: atest NetworkStaticLibHostPythonTests
Change-Id: I6f5f93acb13503ce23066b1541c0843f6d7951d2

Jimi Chen   commited 2025-05-28 04:55:33 +00:00
5e69785de3
Fix a bug in poll(from)
Test: new test in this patch
Flag: EXEMPT test-only
Change-Id: I00d367ce9db47e3fd30d27816b68280ab418f988

Chalard Jean   commited 2025-05-19 16:35:54 +09:00
f0252b1cf4
Remove RecorderCallback.
This class doesn't actually serve a purpose, it only makes
TestableNetworkCallbck more complex.

Test: CtsNetTestCases ConnectivityCoverageTests
Flag: EXEMPT test-only
Change-Id: I39a598b82a3215384bdfe04980f4b280ab2c2716

Chalard Jean   commited 2025-05-19 16:35:53 +09:00
f2994122c1
Remove deprecated SC_V2 constant
Test: TH
Flag: EXEMPT test-only
Change-Id: I3444fad305f49294ed8c3a850b631f385678c117

Chalard Jean   commited 2025-05-15 09:03:59 +09:00
9373e3442e
Change creation methods in RtNetlinkLinkMessage to take index(1/2)
Currently methods to create netlink message in RtNetlinkLinkMessage
take interface name, while interface index is a more deterministic way
to define an interface.

This patch changes these methods from taking interface name to taking
interface index.

Bug: 404378068
Test: NetworkStaticLibTests
Flag: EXEMPT mainline
Change-Id: I0754ee53eb0160e67f24e36340abf91b1e87d0e7

Chuwei He   commited 2025-05-13 12:06:54 +09:00
b1110454bb
Adding IpAddress Struct type to store ip v4 and v6 addresses.
IPv4 addresses will be converted as v4-mapped-v6 address while
writting it to byte form. v4-mapped-v6 addresses in byte form will be
parsed to Inet4Address while converting it back.

Bug: 392509494
Test: atest NetworkStaticLibTests:com.android.net.moduletests.util.StructTest
Flag: EXEMPT refactor
Change-Id: Ia906d2cae7bb7402ff937da267c2552431b2d0f7

Sarup Dalwani   commited 2025-04-30 07:42:25 -07:00
746540b874
File the per-app request for opted-in satellite-optimized apps
Test: ConnectivityCoverageTest
Bug: 410731080
Flag: EXEMPT controlled in counter-part change ag/33220291
Change-Id: I0307f697a441c2810cafd4643d381e66a0ac9243

Chalard Jean   commited 2025-04-27 02:12:44 +09:00
76a60c1654
Replace Message with related arguments in RealtimeScheduler
This change ensures that the Message object is created and
obtained within RealtimeScheduler, preventing modification
by the caller.

Fix: 386274963
Test: atest ConnectivityCoverageTests NetworkStaticLibTests
Flag: EXEMPT bug fix
Change-Id: I4c919857bcaa2d49717859dca9c88a243cbb7a41

Paul Hu   commited 2025-04-22 01:45:13 -07:00
1dea0d630e
Correct race condition in RealtimeSchedulerTest
This commit corrects a race condition in the RealtimeSchedulerTest. The
fix ensures that when the TestHandler processes a message, it first adds
the message to the executionTimes before calling cv.open(). This change
guarantees the correct order of operations and prevents potential
synchronization issues.

Test: TH
Bug: 403413950
Flag: EXEMPT bugfix
Change-Id: I16dee5475db315b1b40d0779db4ff31407bf54b5

Yuyang Huang   commited 2025-04-08 18:21:12 +09:00
428d25ceac
Merge "Use scapy to generate ARP packet in multi-device test" into main am: 4703e17d98
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3549447

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

Yuyang Huang   authored and   Automerger Merge Worker   commited 2025-03-20 17:02:27 -07:00
e9726e8983
Use scapy to generate ARP packet in multi-device test
Test: m connectivity_multi_devices_snippet && atest CtsConnectivityMultiDevicesTestCases
Test: atest NetworkStaticLibHostPythonTests
Change-Id: I30adfe7ca2fef83ed4ef2ea3e5bc2291b9016530

Jimi Chen   commited 2025-03-20 12:25:57 +00:00
f0343a65d1
Merge "Add get exclude all host IPv6 multicast addresses function to apf_utils" into main am: b3add265bc
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3549123

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

Jimi Chen   authored and   Automerger Merge Worker   commited 2025-03-20 00:24:54 -07:00
d9d6eec8ce
Add get exclude all host IPv6 multicast addresses function to apf_utils
Test: atest NetworkStaticLibHostPythonTests
Change-Id: Ib05eaf6ac94e9511a43b4b494eb5935746f50aa7

Jimi Chen   commited 2025-03-19 13:41:41 +00:00
ceefdceafd
Merge "Fix missing function in NetworkStaticLibHostPythonTests" into main am: d492666256 am: 58b5b18514
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3547922

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

Maciej Å»enczykowski   authored and   Automerger Merge Worker   commited 2025-03-18 02:56:16 -07:00
33e4070cc6
Fix missing function in NetworkStaticLibHostPythonTests
This change corrects a missing function error, which was renamed in aosp/3545962.

Test: atest NetworkStaticLibHostPythonTests
Change-Id: I2f51702adfa48f2207ef4dd79f641c8f57d15ac7

Jimi Chen   commited 2025-03-17 23:56:23 -07:00
e6c9b28c2b
Merge "Use non-tentative IPv6 addresses in multi-device test" into main am: d1cbad238c am: 0054a2627f
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3545962

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

Jimi Chen   authored and   Automerger Merge Worker   commited 2025-03-17 23:14:55 -07:00
c93e762867
Use non-tentative IPv6 addresses in multi-device test
This update ensures multi-device offload tests retrieve only non-tentative IPv6 addresses,
preventing test caused by tentative addresses undergoing duplicate address detection.

Test: atest NetworkStaticLibHostPythonTests
Change-Id: Id2f61a34eda01a6e8e0457647229fe438a85c232

Jimi Chen   commited 2025-03-17 06:31:46 +00:00
2bfe2654d1
Merge "Use NLM_F_REQUEST_ACK in createGetLinkMessage()" into main am: 9981725b18 am: 3bc13845a9
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3475690

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

Chuwei He   authored and   Automerger Merge Worker   commited 2025-03-13 19:00:30 -07:00
7bc8681d88
Use NLM_F_REQUEST_ACK in createGetLinkMessage()
This rtnl message is used with sendOneShotKernelMessage() which expects
that kernel returns an ACK. We need to set NLM_F_ACK explicitly for
that.

Bug: 379021505
Test: Manually run and no more exception with EAGAIN.
Change-Id: Iba21fedf60f5eca63eceee9362e252952bb805c1

Chuwei He   commited 2025-03-12 18:30:04 -07:00
03a10fd14d
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
Merge "Stop using Mockito static mocking in BpfDumpTest" into main
Motomu Utsumi   authored and   Gerrit Code Review   commited 2025-03-06 19:50:26 -08:00
1d1cc3a36d
Use 'ip link' to prevent permission errors in non-root environments
The 'ip link show' requires root permissions, causing errors.
This change replaces 'ip link show' with 'ip link'.

Bug: 401123634
Test: atest NetworkStaticLibHostPythonTests
Change-Id: I82b219ae9179f23e3233f797aeb4aa3740e6d3ec

Jimi Chen   commited 2025-03-07 00:25:34 +00:00
c471fc945c
Stop using Mockito static mocking in BpfDumpTest
Test: NetworkStaticLibTests
Bug: 399571370
Bug: 397721725
Change-Id: I0d183378b08261ff24485aff4ad636cdae1851c9

Motomu Utsumi   commited 2025-03-06 09:00:18 +09:00
d27097f585
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
Merge "Use netlink to set MTU in IpClient(1/2)" into main
Chuwei He   authored and   Gerrit Code Review   commited 2025-02-12 17:44:20 -08:00
4940e0b869
Use NLM_F_REQUEST_ACK in createSetFlagsMessage()
This rtnl message is used with sendOneShotKernelMessage() which expects
that kernel returns an ACK. We need to set NLM_F_ACK explicitly for
that.

Bug: 390722214
Bug: 392491075
Test: Manually run the affected test, no more exception with EAGAIN.
Change-Id: I7ef9497461a8e89e9f7f7fe399562b2d8ede14a9

Jie Jiang   commited 2025-01-27 22:10:31 +09:00
b61913bbb6
Use netlink to set MTU in IpClient(1/2)
Currently IpClient uses netd to set MTU for interfaces while the
usage of netd can bring some unexpected side effects and execute in
slower speed.

This change moves forward with one less usage of netd to use netlink
directly set MTU in IpClient.

This patch adds support in netlink utils to set MTU for interfaces.

Bug: 383663804
Test: Manually call and make sure interface MTU is updated
Test: atest NetworkStaticLibTests

Change-Id: Id73d78156d1a560262e42540a3503d059a172e34

Chuwei He   commited 2025-01-22 17:31:34 -08:00
530db3143a
Rename net_utils_device_common_timerfdjni to serviceconnectivityjni
Test: builds and boots
Change-Id: I432da644ab6d212df736913089ff3b52d286ea0e

Patrick Rohr   commited 2025-01-16 14:28:13 -08:00
08bf056370
Move TimerFdUtils JNI functionality into ServiceConnectivityJni
Test: build and boots
Change-Id: Idb9f8c9979aff43e6e5351d190329e823112e005

Patrick Rohr   commited 2025-01-16 13:04:42 -08:00
4971556451
Rename TimerFileDescriptor to RealtimeScheduler
Test: TH
Change-Id: I756cb84425e7701b9340d4f6589da364b7c515f7

Yuyang Huang   commited 2025-01-09 19:38:39 +09:00
1ed836c30f
Enhance TimerFileDescriptor to schedule multiple tasks
Improved the class to allow scheduling and execution of multiple tasks
concurrently.

Test: TH
Change-Id: I79b63c6846e0e0a934f257d4a38d9cab08bd13e8

Yuyang Huang   commited 2025-01-09 19:38:35 +09:00
4d46630219
Log and report terrible errors for improved debugging and tracking
When a terrible error occurs, this change ensures that it is both logged
using Log.wtf() and reported via a dedicated metric. This dual approach
provides comprehensive error information for debugging in dogfood
environments (Log.wtf()) and tracks the occurrence of these errors in
production (via metrics).

Test: TH
Change-Id: Ic376f3789ab0cc9b094e79301849492143ed777c

Yuyang Huang   commited 2025-01-07 16:18:55 +09:00
77f29fc343
Merge "Use netlink to set interface up/down in EthernetTracker(1/2)" into main
Chuwei He   authored and   Gerrit Code Review   commited 2024-12-16 20:10:32 -08:00
51478aa9da
Use netlink to set interface up/down in EthernetTracker(1/2)
Currently EthernetTracker uses netd to interact with interfaces, such as
retrieving all interfaces, updating interface configurations etc.
However, the usage of netd can bring some unexpected side effects, such
as clearing v4 address when toggling on/off interface.

This change moves forward with one less usage of netd to use netlink
directly to set interface up/down in EthernetTracker.

This patch adds support in netlink utils to get/set interface flags and
added related unit test.

Bug: 379021505
Test: atest NetworkStaticLibTests
Change-Id: I5f82781663ba340588450cceea55caec4e3991a8

Chuwei He   commited 2024-12-17 11:04:19 +09:00
0daa52affd
Add helper methods for array manipulation
Introduced new helper methods to simplify common array operations:

* Concatenation: Combine multiple arrays into a single array.
* Prepend: Add elements to the beginning of an array.
* Append: Add elements to the end of an array.

Test: TH
Change-Id: I6d9e19d7152c2ae3e75c3d521b4ee994347c4d2e

Yuyang Huang   commited 2024-12-10 17:44:39 +09:00
aee67c1e8f
Merge changes from topic "trafficstats-client-cache" into main
* changes:
  Introduce client-side rate limiting for TrafficStats APIs
  Unit test for TrafficStats Rate Limit Cache
  Add `putIfAbsent` method to LruCacheWithExpiry

Junyu Lai   authored and   Gerrit Code Review   commited 2024-12-10 01:55:44 +00:00
8a2862bd92
Merge changes from topic "update-ipv4-multicast" into main
* changes:
  Throw `IllegalArgumentException` instead of `RuntimeException` in hexStringToByteArray()
  Add IPv4 all host address definition

Jimi Chen   authored and   Gerrit Code Review   commited 2024-12-09 12:30:40 +00:00
3ffdc0b516
Throw IllegalArgumentException instead of RuntimeException in hexStringToByteArray()
Test: atest NetworkStaticLibTests
Change-Id: I7bc033e771b175c9941147972a1b778536a76c2a

Jimi Chen   commited 2024-12-09 05:18:41 +00:00
2c60124e10
Add putIfAbsent method to LruCacheWithExpiry
This commit introduces a new `putIfAbsent` method to the
`LruCacheWithExpiry` class. The `putIfAbsent` method
creates a new entry if the key is absent or returning the
existing value if the key is already present. This addition
enhances the cache's functionality and flexibility.

Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.net.module.util.LruCacheWithExpiryTest
Bug: 343260158

Change-Id: Iff03ce2b6c27fedd71510edaa6bd86885f6df122

Junyu Lai   commited 2024-12-06 08:13:08 +00:00
9ac087d962
Merge "Update TimerFileDescriptor to support different task types" into main
Paul Hu   authored and   Gerrit Code Review   commited 2024-12-06 03:20:36 +00:00
97a4977f83
Merge "Build the timerfd wrapper class" into main
Paul Hu   authored and   Gerrit Code Review   commited 2024-12-05 08:54:25 +00:00
e8e32ab330
Update TimerFileDescriptor to support different task types
Introduced ITask and its concrete implementations (e.g.
MessageTask, RunnableTask) for TimerFileDescriptor to enable more
flexible task scheduling.

Bug: 366373064
Test: atest NetworkStaticLibTests
Change-Id: I3a5177b66916f50f3f943d8b63b0c760bece60e4

Paul Hu   commited 2024-12-04 08:32:59 +00:00
2bb40d2849
Build the timerfd wrapper class
Build a wrapper class that allows users to easily use the timerfd
object and trigger delayed callbacks through this class.

Bug: 366373064
Test: atest NetworkStaticLibTests
Change-Id: I8081d29e4874df8b9e59f7fc845b20cbd29aec40

Paul Hu   commited 2024-12-04 08:32:59 +00:00
50c14402f6
Merge "Add RtmNetlinkPrefixMessage class to represent RTM_NEWPREFIX message." into main
Xiao Ma   authored and   Gerrit Code Review   commited 2024-12-04 04:41:43 +00:00
7dd2525646
Add RtmNetlinkPrefixMessage class to represent RTM_NEWPREFIX message.
Bug: 315069348
Test: atest NetworkStaticLibTests
Change-Id: I566fa6fcc85a19dab8edf2dccb356a53fdc8e6b2

Xiao Ma   commited 2024-12-03 19:53:43 +09:00
cb0aabd14c
Merge "Remove unnecessary semicolon" into main
Yuyang Huang   authored and   Gerrit Code Review   commited 2024-12-02 13:39:40 +00:00
2fa511bdc2
Remove unnecessary semicolon
Test: TH
Change-Id: Icfb415f9ba60860b2c066275d7936adfbb37e30f

Yuyang Huang   commited 2024-12-02 20:04:25 +09:00
fb2425d173
Only report tryTest errors when not caught
Instead of reporting tryTest errors when the tryTest block throws,
report them in the cleanup block if no catch block has caught it.

This fixes a bug where tests that use tryTest/catch would collect
diagnostics in expected cases.

Test: atest
Change-Id: Ic53ae54f1945a2784becd50e5890fad8e7461474

Remi NGUYEN VAN   commited 2024-12-02 09:26:53 +09:00
fc724ab59a
Merge "Add expect_throws() to assert_utils.py to check expected exception" into main
Jimi Chen   authored and   Gerrit Code Review   commited 2024-10-22 07:05:01 +00:00
7a4a85bf44