Commit graph android_packages_modules_Co.../thread
Message SHA1
[Thread] add the "vgh" TXT entry
Allows vendors to specify whether the Thread network is managed by
Google or not.

Bug: 343671003

Change-Id: Ie4d4050add0485643ea3eff0c576868b086f848c

Kangping Dong   commited 2024-06-12 23:19:34 +08:00
151275359f
Merge "[Thread] add public newbie guide" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-06-07 02:39:52 +00:00
53f4a29816
[Thread] add public newbie guide
Change-Id: I03975d832c2ae1223a472f01541d4d488e2f6950

Kangping Dong   commited 2024-06-07 02:38:58 +00:00
3b47411d25
Use DeviceFeatureModuleController to run tests only if the device has the required feature.
This is to avoid running tests on devices that do not support Thread. Otherwise, the tests will fail with ClassNotFoundException when the test classes are loaded

Change-Id: I286394ae925ad7258aa82cd308ac963ee334992c

Kangping Dong   commited 2024-06-05 19:32:59 -07:00
67586d188e
Merge "[Thread] support resolving a host for NsdPublisher" into main
Handa Wang   authored and   Gerrit Code Review   commited 2024-06-05 10:23:26 +00:00
a22aa7777d
[Thread] enforce a timeout for waiting FTDs' output in integration tests
When developing and debugging a test case, sometimes the FTD may stuck and will not give any output. In such a case the test may time out after 1 minute (or longer). We should enforce a timeout (e.g. 5 seconds) when reading from its stdout so we don't have to wait for it that long.


Bug: 343885515
Test: CI

Change-Id: I766c172364106f19500032459de12ed6de38fb05

Handa Wang   commited 2024-06-03 03:04:56 +00:00
eca707dda4
Fix ThreadFeatureCheckerRule on U- devices
On U- devices, the ThreadNetworkManager class is not available, so we need to use the service name instead. And we should make sure Thread test cases runs on only devices that does has Thread feature supported.

Change-Id: Idd356062277a5180933789c7d471c70e2689350d

Kangping Dong   commited 2024-05-30 03:36:45 +00:00
953a161f1a
[Thread] support resolving a host for NsdPublisher
This CL lets NsdPublisher support resolving an mDNS host via one-shot
mDNS query. Because NsdManager not yet responds to such a query
properly, we cannot add an integration test for this. I've verified the
Discovery Proxy use case work properly on real devices.

Bug: 322434640
Test: atest NsdPublisherTest

Change-Id: Ie67f2fb9dd012408c123c354fc29f1a943280780

Handa Wang   commited 2024-05-28 11:18:10 +00:00
1a6ca28ae0
Handle enabledState change in onStateChanged().
Only call onThreadEnableStateChanged() when the callback is registered
or the state has changed.

Bug: 342999416

Test: atest CtsThreadNetworkTestCases:android.net.thread.cts.ThreadNetworkControllerTest#subscribeThreadEnableState_getActiveDataset_onThreadEnableStateChangedNotCalled

Change-Id: I822d2b98b221c3312ff472b82ebb3e7e88e313fe

Yang Sun   commited 2024-05-28 14:55:50 +08:00
be11abeb5d
Merge "[Thread] fix airplane mode race conditions" into main
Kangping Dong   authored and   Gerrit Code Review   commited 2024-05-26 13:26:39 +00:00
22c6b6c9d7
[Thread] fix airplane mode race conditions
On some devices, Thread and Bluetooth HAL share a single UART device
and Thread HAL (hence ot-daemon) can't be started when the Bluetooth
HAL is disabled. When airplane mode is turned on, Bluetooth service may
receive the broadcast event first and disable the Bluetooth HAL. This
effectively stops Thread HAL and ot-daemon. When the
ThreadNetworkControllerService receives the death signal, it doesn't get
the airplane mode changed event from the system yet and so it tries to
restart ot-daemon. Then get blocked because ot-daemon can't be started
now (because the Thread HAL can't be started).

The proper fix is to allow enabling/disabling Thread HAL independent of
the Bluetooth HAL, so that Thread can function no matter Bluetooth is
disabled or not. But that may takes longer fix cycles, so here takes a
wrokaround by always querying the latest airplane mode value from
Settings.Global when deciding whether to restart ot-daemon in the death
handler.

Test: test on the real device that ot-daemon will not be requested to
restart when airplane mode is turned on
Bug: 340744397
Bug: 340236524
Bug: 340368050

Change-Id: I603d085d66a95b612c613ba07dc432ff0df135db

Kangping Dong   commited 2024-05-24 20:25:50 +08:00
e89125d6c5
Merge "Thread: use network time for generating dataset" into main
Yakun Xu   authored and   Gerrit Code Review   commited 2024-05-24 09:18:21 +00:00
f987ceba35
Merge "[Thread] add more Thread shell commands" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-05-24 09:16:06 +00:00
20e06e28ce
Thread: use network time for generating dataset
This commit tries to use network time as authoritative time source for
generating Thread operational dataset. If the time is get successfully,
the authoritative bit will be set in the dataset.

Bug: 340130726
Test: presubmit
Change-Id: Ibaca1f866be0be121763fdb63e02621809484b17

Yakun Xu   commited 2024-05-24 14:29:10 +08:00
6420ccf4a8
[Thread] add more Thread shell commands
A summary of changes in this commit:
1. add new commands mirroring the java APIs: "join", "migrate" and
   "leave"
2. Use THREAD_NETWORK_TESTING for guarding access to shell commands
   which are for testing
3. Refactor ThreadNetworkShellCommand for readability

Bug: 329368792
Change-Id: Ibdb256674533704dc1d000a15c162f41cec5047f

Kangping Dong   commited 2024-05-24 14:11:40 +08:00
abe19f9628
Update checkOnHandlerThread()
The function is updated to throw IllegalStateException when called off
the handler thread.

Added the check for setEnabledInternal().

Bug: 342286647
Test: presubmit
Change-Id: I378b588af958bf4b913b32b096af1361f179c16e

Yang Sun   commited 2024-05-23 15:19:55 +08:00
d4ed49c770
[Thread] run ThreadNetworkControllerServiceTest tests in a single thread
@Test annotated methods are running in threads like
"Thread[Time-limited test,5,main]" which is created by FailOnTimeout.java,
while @Before annotated setUp() is running in thread
"Thread[Instr: androidx.test.runner.AndroidJUnitRunner,5,main]" which is
created by AndroidJUnitRunner.

The issue is that there are code in ThreadNetworkControllerService
checking all its methods runs on the thread associated to the provided
handler. This constraint doesn't hold in this unit test because
TestLooper runs all the posted tasks on the current thread rather than
the thread associated to its backed looper. So the tests will fail with
Log.wtf() which terminates the process on eng build.

This commit fixes this issue by annotating the test class with
@UiThreadTest to force methods annotated with @Before, @After and @Test
to run on the main / UI thread.

Test: run this test class on aosp_cf_x86_64_phone-trunk_staging-eng
Bug: 342092067
Change-Id: I7d75de5ac31234f3051e9ed332da33c1da6a8c98

Kangping Dong   commited 2024-05-23 03:04:59 +00:00
4d0afab8fe
Merge "Thread: use test name as mobly-par-file-name" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-05-22 11:26:30 +00:00
00ba4b7b78
Merge changes I0ec79adf,Icf5aadc4 into main
* changes:
  [Thread] avoid kernel-generated lla on thread-wpan
  [Thread] use NetlinkUtils methods to update addresses

Treehugger Robot   authored and   Gerrit Code Review   commited 2024-05-21 06:30:56 +00:00
7528130f24
[Thread] avoid kernel-generated lla on thread-wpan
OpenThread generates the link-local address randomly, so the kernel
shound't generate another lla again.

Bug: 305605130

Change-Id: I0ec79adf0de4edc6921703c3cc50cfcfe63b853b

Kangping Dong   commited 2024-05-20 22:51:09 +08:00
8658ef364d
Reset mNetDataPrefixes when Thread goes down.
Bug: 335762753

Test: atest ThreadNetworkIntegrationTests:android.net.thread.ThreadIntegrationTest#toggleThreadNetwork_routeFromPreviousNetDataIsRemoved

Change-Id: I7fd56dcec32ad2b57338ca8033aaa0a95020304e

Yang Sun   commited 2024-05-20 16:41:56 +08:00
8fd35e3771
[Thread] use NetlinkUtils methods to update addresses
The helper methods makes the code simpler.

Test: atest ThreadNetworkIntegrationTests
Change-Id: Icf5aadc446ebba8707b45cd878222c826261815f

Kangping Dong   commited 2024-05-20 09:58:04 +08:00
0aeee52ac1
Thread: use test name as mobly-par-file-name
This commit uses the test name as mobly-par-file-name.

Bug: 339155136
Test: presubmit

Change-Id: I592b74a09567cf7a162a024b8ee7ca30fce34df3

Yakun Xu   commited 2024-05-18 10:14:15 +08:00
a081e0b1a3
[Thread] fix multidevice tests name
Bug: 341241657
Change-Id: I69a5fd049053afd7ed5df15309a60ab805b50dff

Kangping Dong   commited 2024-05-17 12:05:13 +00:00
7d64fe750d
Merge "Thread: simulate Thread on eth1 for tests" into main
Yakun Xu   authored and   Gerrit Code Review   commited 2024-05-17 03:52:14 +00:00
99d5727954
Merge "Thread: add multi-device test" into main
Yakun Xu   authored and   Gerrit Code Review   commited 2024-05-17 03:52:14 +00:00
45d7e1cffd
Thread: simulate Thread on eth1 for tests
This commit changes OpenThread to simulate on eth1 instead of loopback interface.

Bug: 329188649
Test: presubmit
Change-Id: I80a2842be02c03c5987ac8be8368fa86d7c6bace

Yakun Xu   commited 2024-05-16 15:32:08 +08:00
7bc7d69e1e
Thread: add multi-device test
This commit adds a basic multi-device test for Thread network.
Two nodes are used. One creates a network and the test verifies
the other one can discover it by Thread scan.

Test: presubmit
Bug: 329188649
Change-Id: Ice03015838bbf6fe836fac48c659a97850a89132

Yakun Xu   commited 2024-05-16 15:19:48 +08:00
f05592620f
Merge "Add netdata prefixes to tun interface routing table." into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-05-15 19:34:04 +00:00
43b62ae5ff
Add netdata prefixes to tun interface routing table.
When there are thread devices with DUA in the thread network, BR itself
may not have a DUA address, so it doesn't have route to DUA in the
thread-wpan routing table. When thread device sends a packet from the
DUA to AIL via BR, BR rpfilter would drop the packet. Adding the route
to DUA prefix in thread-wpan solves this problem.

Bug: 335762753

Test: atest ThreadNetworkIntegrationTests:android.net.thread.ThreadIntegrationTest#addPrefixToNetData_routeIsAddedToTunInterface
atest ThreadNetworkIntegrationTests:android.net.thread.ThreadIntegrationTest#removePrefixFromNetData_routeIsRemovedFromTunInterface

Change-Id: I5ca8f7e723116a63718734f72f1b463d9c380329

Yang Sun   commited 2024-05-15 22:26:35 +08:00
14de932e9b
Merge "Remove logging of notify thread enabled state." into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-05-15 12:24:43 +00:00
d199b6a232
Remove logging of notify thread enabled state.
This is already logged in ot-daemon when the state is updated.

Bug: 338695689
Change-Id: Ib8eb8b9fca3271e85a4915150ff0af4fee8847e1

Yang Sun   commited 2024-05-15 19:02:10 +08:00
5b929f6767
Merge "[Thread] rename isEnabled() to shouldEnableThread()" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-05-11 05:10:48 +00:00
5f2f7309db
Merge "[Thread] add airplane mode support" into main
Kangping Dong   authored and   Gerrit Code Review   commited 2024-05-11 03:55:20 +00:00
0bf21e6f58
[Thread] rename isEnabled() to shouldEnableThread()
Follow up comments in aosp/3079292

Change-Id: I7d95a653cb08549fd30994e95f11794f0a7aac80

Kangping Dong   commited 2024-05-11 11:51:45 +08:00
eb51ad9cb0
[Thread] add airplane mode support
Listens to airplane mode in Thread system service and enables/disables
Thread accordingly:
1. When airplane is on, disable Thread but don't persist the state
2. If Thread is explicitly enabled when airplane mode is on, Thread will
   be enabled and the choice is remembered so that Thread will not be
   disabled the next time airplane mode is turned on
3. If Thread is explicitly disabled when airplane mode is on, it will be
   considered that the user wants to disable when airplane mode is
   turned on, so Thread will be auto disabled the next time airplane
   mode is turned on

The behavior described above is consistent with Wi-Fi and bluetooth.

Bug: 322742298
Change-Id: I1750922d9c304095e4114cddfbfe24d70d0e223a

Kangping Dong   commited 2024-05-10 16:14:12 +08:00
8e68015475
ThreadIntegrationTest: use longer ping timeout when reply is expected.
The ping timeout was 0.1s to keep the tests short, this may not be
enough to receive ping reply. When test case expects ping reply to be
received we can use a longer timeout of 1s.

Bug: 338061061

Test: atest ThreadNetworkIntegrationTests:android.net.thread.ThreadIntegrationTest#edPingsMeshLocalAddresses_oneReplyPerRequest
Change-Id: I988fb8973735d9b082c5b8c3c57566b950ae804b

Yang Sun   commited 2024-05-08 16:44:00 +08:00
d36928c916
[icmp] Add test to verify no duplicated icmp echo reply on mesh-local
addresses.

Bug: 333493455

Test: atest ThreadNetworkIntegrationTests:android.net.thread.ThreadIntegrationTest#edPingsMeshLocalAddresses_oneReplyPerRequest

Change-Id: I07aefa1311f15d3f801de64c0342694296f09469

Yang Sun   commited 2024-04-29 16:21:16 +08:00
d722a997bd
[Thread] fix CTS for U branches
Per aosp/2936050, before Android V, an App needs to explictily set
NET_CAPABILITY_LOCAL_NETWORK to request a Thread network. This CL
updates the test case so it can pass on U devices.

Bug: 336678348
Test: atest CtsThreadNetworkTestCases

Change-Id: I383e34cb94f67286c5a5ab3bad7a11d98c3c2871

Handa Wang   commited 2024-04-24 05:12:58 +00:00
42ea5408ae
Merge "Add OT multicast addresses to tun interface." into main
Yang Sun   authored and   Gerrit Code Review   commited 2024-04-12 06:39:26 +00:00
aa72ee2dd5
Add OT multicast addresses to tun interface.
Bug: 333668308

Test: atest ThreadNetworkIntegrationTests:android.net.thread.ThreadIntegrationTest#joinNetwork_tunInterfaceJoinsAllRouterMulticastGroup
Change-Id: I0bb91259ae5cbe0eb9c5d71b7aa4e5b2a95f8c6b

Yang Sun   commited 2024-04-11 00:54:25 -07:00
244dce3722
Merge "[Thread] ignore the flaky test case advertisingProxy_srpClientUnregistersService_serviceIsNotDiscoverableByMdns" into main
Handa Wang   authored and   Gerrit Code Review   commited 2024-04-11 03:12:30 +00:00
e67e1a7166
[Thread] ignore the flaky test case advertisingProxy_srpClientUnregistersService_serviceIsNotDiscoverableByMdns
The flakiness of this test case is 1%. Disable the test case to prevent
the whole test module from being demotioned.

Bug: 333078476
Bug: 333806992
Change-Id: I820f7a567a7827eee280d0f545c9f654efe5eeaa

Handa Wang   commited 2024-04-11 01:51:06 +00:00
7ade29d142
Merge "[Thread] ignore the flaky test case meshcopService_joinedNetwork_discoveredHasNetwork" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-04-10 10:17:31 +00:00
9671e9a6d8
Merge "dataset selects a channel from channel 11 to 24" into main
Kangping Dong   authored and   Gerrit Code Review   commited 2024-04-10 08:27:58 +00:00
e435650d41
Merge "[Thread] loose the restriction on the setEnabled API behavior" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-04-10 08:20:09 +00:00
df357e3612
dataset selects a channel from channel 11 to 24
Many Thread radio chips need to reduce their transmit power on edge
channels to pass regulatory RF certification. This CL restrcits the
dataset to select a channel from channel 11 to 24.

Bug: b/331708479
Test: atest ThreadNetworkUnitTests
Change-Id: I758c9f33629a0cafcc39bb9fde0ad45ab2699db8

Zhanglong Xia   commited 2024-04-10 14:43:17 +08:00
dac352d489
[Thread] ignore the flaky test case meshcopService_joinedNetwork_discoveredHasNetwork
Bug: 333649897
Bug: 332782903

Test: CI

Change-Id: I74e8e00f709c5820c58b85dbf90f2ab8019eb65a

Handa Wang   commited 2024-04-10 06:31:11 +00:00
81804470f9
[Thread] loose the restriction on the setEnabled API behavior
It's too strict that the device must rejoin the network after being
enabled again. This probably don't work on mobile devices. remove the
CTS case for now.

Change-Id: I3a4511f4b2fddddf982206720bbb61f718bc8327

Kangping Dong   commited 2024-04-10 13:06:43 +08:00
504fe7d510
Dynamically set mesh-local addresses preferred lifetime.
When there is an active OMR address(not deprecated), set the mesh-local
addresses as non-preferred. When there is no active OMR address, set
the mesh-local addresses as preferred.

Bug: 323624146

Test: atest ThreadNetworkIntegrationTests

Change-Id: I969c20ddadfd2d0bd97499da48efc9b32cfa7e0b

Yang Sun   commited 2024-04-09 02:26:00 -07:00
79b202ac9f