Commit graph android_packages_modules_Co.../thread/tests
Message SHA1
Split framework component
Test: m cts
Flag: TEST_ONLY
Bug: 432581059
Change-Id: Iea2a716a03fbd102b4cbdfb1c99ab5f8ce444ac9

Yihan Dong   commited 2025-07-30 14:01:24 +08:00
b19fdd7046
[Thread] enable border router in InternetAccessTest
Previously this wasn't explicitly set so it relies on other test classes to enable border router which causes flakiness.

Bug: 428628512
Flag: TEST_ONLY
Test: CI

Change-Id: I3bbb2e9fd6374019421b57e0d8d266cd20b5a244

Handa Wang   commited 2025-06-30 19:01:14 -07:00
8e51e16531
[API] make ThreadNetworkSpecifier @SystemApi
This class can be used with ConnectivityManager#requestNetwork to
request connecting to a specific Thread network from system apps.

Bug: 377258309
Flag: com.android.net.thread.flags.thread_mobile_enabled
Change-Id: I80cb992380236b045e4e331b9861274d8cd10cfd

Kangping Dong   commited 2025-06-30 17:08:51 +08:00
c4d212c5d4
[Thread] update ThreadNetworkSpecifier to add active dataset and support
redactions

This class can be used with ConnectivityManager#requestNetwork to
request connecting to a specific Thread network.

Bug: 374037595
Flag: EXEMPT changes to code which is not used
Change-Id: I6d5ea54243751a0f1ca5760944c46ecb600deb89

Kangping Dong   commited 2025-06-30 17:08:51 +08:00
78c5e676b8
[Thread] fix SparseArray hash for ActiveOperationalDataset
The existing ActiveOperationalDataset#hashCode has an issue that it's
depending on the SparseArray#hasCode which doesn't override the
Object#hashCode method. The consequence is that when the
ActiveOperationalDataset is used as a key in a container, there will
be a miss even if two ActiveOperationalDataset objects have the same
content.

This commit fixes this issue by using a dedicated
byteArraySparseArrayHasCode() method which computes the content hashcode
with Arrays.deepHashCode(). Also fixes the issue that mUnknownTlvs is
not counted in hashCode().

Flag: EXEMPT trivial bugfix
Change-Id: I085d3bf0bdf4bb73bb995fc28dd3857437f9743e

Kangping Dong   commited 2025-06-10 21:01:22 +08:00
2e49f00e29
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
Add unit test for ThreadNetworkControllerService#SetEnabled
Bug: 321853291
Test: atest ThreadNetworkUnitTests
Flag: TEST_ONLY

Change-Id: Ifa74a629a20c87bf45d3d3e0693033d8e28b4e8f

Yang Sun   commited 2025-04-15 09:44:12 +00:00
3fa3ca8e5b
[Thread] fix CTS test for Android TV U
Android TV U should have the `ThreadNetworkManager` only when the Thread
hardware feature is defined on the TV

Change-Id: I154fc7fadfda4c9c97653b25f3efaa87bf081052

Kangping Dong   commited 2025-03-23 23:22:24 -07:00
89682e21ee
Merge "[Thread] add vendor & model name support for net diag" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-03-21 03:53:47 -07:00
52875db997
[Thread] add vendor & model name support for net diag
1. allow OEMs to default the vendor and model name to system properties.
2. use the vendor & model name for net diag TLVs

Change-Id: I30e988ba3e9cb9f9c5dc3a096f162d5dbcdfbc11

Kangping Dong   commited 2025-03-21 17:20:15 +08:00
6303c84ef5
[Thread] grant the NEARBY_WIFI_DEVICES permission to Thread tests
Fix forward for b/405297285

Background: new / existing runtime permission is now used to guard
access to local networks. apps / tests now need to hold this permission
to do traffic with local devices.

Test: atest ThreadNetworkIntegrationTests
Bug: 405297285
Change-Id: I31aaf147a9f9bd8fab7640b935a163405d31e2b9

Kangping Dong   commited 2025-03-21 17:09:35 +08:00
340c5ca514
[Thread] add country code overlay to enable/disable setting Thread country code
Some android devices call the API `setChannelMaxPowers()` to set the
Thread radio output power. Then there is no need for these devices
to set the Thread country code.

This commit adds an overlay configuration `config_thread_country_code_enabled`
to enable/disable setting the Thread country code.

Bug: b/402276117
Test: atest ThreadNetworkUnitTests:ThreadNetworkCountryCodeTest#initialize_countryCodeDisabled_defaultCountryCodeIsUsed
Change-Id: I215c64757d0277853f8d4625ace363a4d7bb974b

Zhanglong Xia   commited 2025-03-19 05:23:13 +00:00
7356171339
Merge changes I65d57e0e,I8ca1f7ae into main
* changes:
  [Thread] unregister all country code callbacks when CountryCode is not needed
  [Thread] do not set the country code again if the co-processor doesn't support it

Zhanglong Xia   authored and   Gerrit Code Review   commited 2025-03-17 22:10:39 -07:00
996c612875
[Thread] unregister all country code callbacks when CountryCode is not needed
This commit unregisters all country code callbacks (WiFi, Telephony and
Location) when the CountryCode module detects that the co-processor
doesn't support setting the country code.

Bug: b/402276117
Test: atest ThreadNetworkUnitTests:ThreadNetworkCountryCodeTest#setCountryCodeNotSupported_returnUnsupportedFeatureError_unregisterAllCallbacks
Change-Id: I65d57e0e826202ad696335200645bf6d78c8b87c

Zhanglong Xia   commited 2025-03-18 03:04:21 +00:00
fe54478761
[Thread] do not set the country code again if the co-processor doesn't support it
Some the co-processors do not support setting the country code. This
commit enables the CountryCode module doesn't set the country again
after it knows that the co-processor doesn't support setting the
country code.

Bug: b/402276117
Test: atest ThreadNetworkUnitTests:ThreadNetworkCountryCodeTest#setCountryCodeNotSupported_returnUnsupportedFeatureError_countryCodeNotSetAgain

Change-Id: I8ca1f7aed3774a086e114e91d8100fb7fe9e3664

Zhanglong Xia   commited 2025-03-18 03:01:59 +00:00
f6187b99c7
Merge "[Thread] leverage the TestableNetworkAgent to simplify the setup of test network" into main
Handa Wang   authored and   Gerrit Code Review   commited 2025-03-16 22:21:11 -07:00
ad3ca8bbb4
[Thread] leverage the TestableNetworkAgent to simplify the setup of test network
Some previous setup steps were implemented in NsdManager test cases
hence we couldn't reuse them in Thread test cases. aosp/3377549
introduced more methods in TestableNetworkAgent class which we could use
to get unify the behavior and reduce redundant code.

Not sure if this can deflake the integration test cases.

Bug: 338061061

Change-Id: I6b4542505ec80bf06b736fecbbe7d6901d27cbc4

Handa Wang   commited 2025-03-16 20:10:09 -07:00
ff509d40ae
[Thread] create standalone border router test module
This is for reduce the overall time of the ThreadNetworkIntegrationTests
which now runs twice for both BR and non-BR cases

Bug: 403360961
Bug: 402480982

Change-Id: Ifa80b8e8885ed980064f92100ef817f9f62b4dc2

Kangping Dong   commited 2025-03-17 10:50:38 +08:00
f96d06db57
[Thread] prefer only ML-EID in case OMR is missing
This is to avoid applications uses Aloc address for source address which
would cause issues when there are multiple devices sharing the same
Aloc.

Bug: 396019291

Change-Id: I287007ddecd9d0fa2ac8da92f4de691e7844b259

Kangping Dong   commited 2025-03-13 15:27:37 +08:00
74a6ca6478
Fix flaky test for trel service discovery
When checking for trel services published by a BR, we need to filter the
services by their service name, since there might be other devices
publishing trel service at the same time.

Bug: 399518677
Change-Id: I56518dbe6c79b48aa048073d8556a53e1261e8bd

Yang Sun   commited 2025-03-12 07:18:16 +00:00
ffd3986c99
[thread] loose the restrictions on ThreadNetworkManager APIs
1. We don't need to assert that ThreadNetworkManager is always null
   when the Thread hardware features are not present. There can be more
   useful Thread features which don't require the hardware
2. The getAllThreadNetworkControllers() API has no documentation says
   the returned list is guaranteed not empty.

Change-Id: Ie77110067ff670053a2125b30b2791b9f54b2582

Kangping Dong   commited 2025-03-11 20:58:51 +08:00
17740cb799
Merge changes from topic "thread-router" into main
* changes:
  [thread] refactor the settings module
  [thread] Support non-BR mode

Kangping Dong   authored and   Gerrit Code Review   commited 2025-03-11 03:37:36 -07:00
7cb5078ba1
Merge "Fix flaky tests of route propagation from netdata to tun interface in ThreadIntegrationTest" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-03-11 02:18:20 -07:00
c2eba15017
[thread] refactor the settings module
The current settings APIs have a few issues:
1. It doesn't support default value which is derived from resource
   overlays
2. It exposes the default values of settings entries as public APIs
   while they shouldn't be

Bug: 401654864

Change-Id: I1bbe3f14507a497320401f02fa6da512558fe385

Kangping Dong   commited 2025-03-11 17:09:29 +08:00
d9bbec2fa1
[thread] Support non-BR mode
This commit adds a resource overlay config for OEMs to disable the
Border Router feature by default. Also updates the tests to cover both
BR and non-BR use cases

Bug: 401654864
Change-Id: I7dd4363836269a08853b58304f62fe52f9021a9e

Kangping Dong   commited 2025-03-11 17:09:29 +08:00
82988c3d98
Fix flaky tests of route propagation from netdata to tun interface in ThreadIntegrationTest
Wait for route to be added/removed from link properties in the tests
instead of checking immediately, as it takes time for the change to
propagate from ot.

Bug: 401815392
Change-Id: Ie95f4beaa370514d31875b9f2e926762a38bc99e

Yang Sun   commited 2025-03-11 07:40:38 +00:00
82cdf67a19
Merge "skip the country code test when the country code is not support" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-03-09 21:49:10 -07:00
749898bb1e
skip the country code test when the country code is not support
Setting country code is not a must support feature on all platforms.
This commit skips the country code related tests when the platform
doesn't support setting the country code.

Bug: b/401793629
Test: atest ThreadNetworkIntegrationTests

Change-Id: I6bb8444f70afb2635d7791af2128741bc02e8ff3

Zhanglong Xia   commited 2025-03-10 02:22:21 +00:00
38aa51aaf2
Merge "[Thread] Replace the "ot-ctl factoryreset" with the java leave() API" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-03-04 01:01:49 -08:00
5e9d7c1853
[Thread] Replace the "ot-ctl factoryreset" with the java leave() API
The leave() API can now correctly clear the in-memory state for the
Thread stack, it's better to use the leaveAndWait() API in the tests to
ensure timing sequences

Bug: 338061061
Change-Id: Ic91f8043cd5a35f19b9161c5778f83b83a713946

Kangping Dong   commited 2025-03-04 15:14:48 +08:00
cbfe8c938e
Merge "Cleanup python version properties" into main
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2025-03-03 16:12:48 -08:00
603c07f699
Cleanup python version properties
Now that python 2 is fully removed, there's no need for
version-specific properties. Remove them.

Also remove usages of embedded_launcher: true, as that
is the new default value.

Bug: 399954452
Test: Presubmits
Change-Id: I368416638bbf1f5e76f7756792d537f72f3c9714

Cole Faust   commited 2025-02-28 16:34:06 -08:00
f5d1d3a705
Remove -stubs-including-flagged
These were added to allow tests to build against flagged off APIs, in
legacy downstream branches that did not support the flagging
infrastructure and stripped out flagged off APIs from the stubs.

Flagged off APIs are part of the regular stubs in branches used today,
so this is not needed anymore.

Bug: 399365344
Test: atest
Change-Id: Ica7df0c5c9be39d9dca49e0114711a7c43125c3d

Remi NGUYEN VAN   authored and   Paul Duffin   commited 2025-02-28 10:47:40 +00:00
df5441508e
Merge "[Thread] ignore all meshcop CTS tests before it's made stable" into main
Kangping Dong   authored and   Gerrit Code Review   commited 2025-02-26 18:56:35 -08:00
fb8b73fdf7
Merge "[Thread] In Integration test, let the DNS client wait for DNS server to show up in Network Data" into main
Handa Wang   authored and   Gerrit Code Review   commited 2025-02-26 17:45:38 -08:00
1cfc7f69ef
Merge "Remove target preparer for epskc_enabled flag" into main
Yang Sun   authored and   Gerrit Code Review   commited 2025-02-26 01:19:33 -08:00
52fdeb421b
[Thread] In Integration test, let the DNS client wait for DNS server to show up in Network Data
The bring up delay of SRP server is higher than before. In the integration test case we need to explicitly wait for the SRP server to show up in Network Data. Otherwise the test may be flaky.

Bug: 399263029
Change-Id: Id6346bcbfd55a34103ba8de0dcee75d3cacde446

Handa Wang   commited 2025-02-26 01:16:41 -08:00
b68f4ace76
[Thread] ignore all meshcop CTS tests before it's made stable
All the 3 meshcop_xxx CTS tests in ThreadNetworkControllerTest are
flaky:
1. meshcopService_threadEnabledButNotJoined_discoveredButNoNetwork fails
   if thread is disabled and then enabled
2. meshcopService_threadDisabled_notDiscovered fails if the discovery is
   not specifically on the test network
3. meshcopService_joinedNetwork_discoveredHasNetwork is already flaky

Bug: 332195449
Bug: 333649897
Bug: 396311014
Change-Id: Ibd3f7b05bddb6b28408f9411350e364dd720b335

Kangping Dong   commited 2025-02-25 22:19:58 +08:00
fa27b8c81a
Remove target preparer for epskc_enabled flag
The flag is read-only, and is tested with flag filtering. The target
preparer was prepared for manual testing before the flag was rolled out
in M25-02.

Bug: 398553026
Change-Id: Id678a147e38b8b5454b37bf72cb66bdac24786f8

Yang Sun   commited 2025-02-24 02:21:54 +00:00
8fdc345a3b
[Thread] fix the failure in ThreadIntegrationTest
This test had an assumption that Thread is enabled which is not true. This CL enables Thread in the setUp().

Bug: 397583601
Change-Id: I9c4d5028a663c6fe1c581267ff7d172d0cba577c

Handa Wang   commited 2025-02-19 01:20:23 -08:00
424aec63e2
[Thread] allow disabling border router auto-join
Test: verified that when the config is set to `false`, thread won't start up after reboots:
```
➜  main-aosp-2 adb shell ot-ctl state
leader
Done
➜  main-aosp-2 adb reboot
➜  main-aosp-2 adb shell ot-ctl state
/system/bin/sh: ot-ctl: inaccessible or not found
➜  main-aosp-2 adb root
➜  main-aosp-2 adb shell ot-ctl state
disabled
Done
```

Bug: 378587036
Change-Id: I4d1c90ab3121f39219cbaf795879a7ba91db02a3

Kangping Dong   commited 2025-01-10 00:09:06 -08:00
d2fc66d4bb
Merge "[Thread] allow disabling SRP server wait for border routing" into main
Kangping Dong   authored and   Gerrit Code Review   commited 2025-01-09 21:54:49 -08:00
7b7ff96c29
[Thread] allow disabling SRP server wait for border routing
It's default enabled that it waits for border routing establishment
before starting the SRP server. But there are also use cases where
the user may want to know what are the devices in the Thread network
before actually reach to the devices, or it doesn't depend on border
routing to reach to a Thread device.

Given that, this commit adds the support of starting SRP server
without waiting for border routing by adding a new
Runtime Resource Overlay configuration parameter:
config_thread_srp_server_wait_for_border_routing_enabled

Test: it's difficult to assert on the SRP server starts up timing. But manually verified that the SRP server starts without waiting for the routing manager when the RRO config is flipped:

```
01-09 20:18:35.835  7555  7555 I ot-daemon: [I] RoutingManager: RsSender: Sent RS 1/3
01-09 20:18:35.835  7555  7555 I ot-daemon: [I] RoutingManager: Received RS from fe80:0:0:0:98af:44ff:fe2e:fa80 on infra netif 17
01-09 20:18:35.835  7555  7555 I ot-daemon: [I] RoutingManager: Will evaluate routing policy in 00:00.150 (150 msec)
01-09 20:18:35.926  7555  7555 I ot-daemon: [I] NetDataPublshr: DNS/SRP service - State: Adding -> Added
01-09 20:18:35.926  7555  7555 I ot-daemon: [I] SrpServer-----: Start listening on port 53536
01-09 20:18:35.926  7555  7555 I ot-daemon: [I] NetworkData---: Sent ServerData
01-09 20:18:35.926  7555  7555 I ot-daemon: [I] NetworkData---: Received ServerData
01-09 20:18:35.926  7555  7555 I ot-daemon: [I] NetworkData---: Allocated Service ID = 1
01-09 20:18:35.926  7555  7555 I ot-daemon: [I] NetworkData---: Sent ServerData ack
01-09 20:18:35.926  7555  7555 I ot-daemon: [I] Notifier------: StateChanged (0x00000200) [NetData]
01-09 20:18:35.926  7555  7555 I ot-daemon: [I] Mle-----------: Send Data Response (ff02:0:0:0:0:0:0:1)
01-09 20:18:35.926  7555  7555 I ot-daemon: [I] BbrLeader-----: PBBR state: Unchanged
01-09 20:18:35.926  7555  7555 I ot-daemon: [I] BbrLeader-----: Rloc16:0x8800, seqno:69, delay:5, timeout:3600
01-09 20:18:35.926  7555  7555 I ot-daemon: [I] RoutingManager: Will evaluate routing policy in 00:03.558 (3558 msec)
01-09 20:18:35.926  7555  7555 I ot-daemon: [I] NetDataPublshr: DNS/SRP service (state:Added) in netdata - total:1, preferred:0, desired:2
```

Bug: 378587036
Change-Id: Ib768014f3c44dca89390cec823a1c2acac38ab0d

Kangping Dong   commited 2025-01-09 04:23:17 -08:00
fad62be2d2
Add logs in IntegrationTestUtils.kt for service discovery
Bug: 338061061
Change-Id: I17f52e7272c42c3a347e32b89d9d0a64edabcd4e

Yang Sun   commited 2025-01-02 16:53:35 +08:00
be81b8415c
Merge "Handle non IPv6 packet in getRaPios" into main
Yang Sun   authored and   Gerrit Code Review   commited 2024-12-06 05:35:26 +00:00
5123022755
Handle non IPv6 packet in getRaPios
Bug: 338061061

Test: atest ThreadNetworkIntegrationTests:android.net.thread.BorderRoutingTest

Change-Id: Ia637dc8ec4cca919bd1957148ec2c104ab1895ac

Yang Sun   commited 2024-12-06 02:18:22 +00:00
5b018cfd06
[Thread] refactor OtDaemonServer::Initialize argument order
see aosp/3391987 for background

Change-Id: I798bfc172e3207c97d520785d62f5381c9d050ad

Kangping Dong   commited 2024-12-05 15:54:55 +08:00
7ce2471354
Merge "Add WRITE_ALLOWLISTED_DEVICE_CONFIG when modifying DeviceConfig" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-11-25 05:40:31 +00:00
9a07a34c64
Add WRITE_ALLOWLISTED_DEVICE_CONFIG when modifying DeviceConfig
Bug: 380648508
Test: atest ThreadNetworkControllerServiceTest
Change-Id: I36908316f5eef6a3712c98f5901a5c162db3471c

Yang Sun   commited 2024-11-25 10:00:32 +08:00
4b43c079ff
Merge "Add test for TREL service not unpublish when feature disabled" into main
Yang Sun   authored and   Gerrit Code Review   commited 2024-11-21 07:10:55 +00:00
5c66824a44