Commit graph android_packages_modules_Co.../thread
Message SHA1
Merge "[Thread] fix upstream network selector to exclude VPN" into main
Handa Wang   authored and   Gerrit Code Review   commited 2024-08-01 03:20:46 +00:00
50644b75b8
[Thread] fix upstream network selector to exclude VPN
Previously the upstream network selector wrongly cleared the default
network capabilities so there's a risk of choosing VPN as the upstream
network, which is undesired.

Bug: 356346764
Test: atest ThreadNetworkIntegrationTests
ThreadNetworkControllerServiceTest

Change-Id: Ic1762775734d734f1974a753f100814b61d66589

Handa Wang   commited 2024-08-01 03:20:11 +00:00
4641f69608
[Thread] Make ThreadConfiguraiton a system API
This CL adds 3 things as @SystemApi:
- The ThreadConfiguration class except the Builder nested class.
- The ThreadNetworkController#registerConfigurationCallback method.
- The ThreadNetworkController#unregisterConfigurationCallback method.

Bug: 342519412
Test: CtsThreadNetworkTestCases

Change-Id: I8d3e48b73d471af1515f251451a1259a4bde69af

Handa Wang   commited 2024-07-29 08:07:17 +00:00
5fc74b9fd8
[Thread] fix ServiceDiscoveryTest
The test was flaky because we didn't give enough time for SRP
registration to complete.

The waiting should be counted as started when the SRP server is available).
Previously we started the waiting before the availability of SRP server
so the counted waiting time may be longer than expected which causes
the wait to timeout and fail the test case.

This CL also extracts some common utils from integration test cases to
the IntegrationTestUtils class.

Bug: 353836718
Test: Locally passed 50 times in a row

Change-Id: I2f648a21d57025b082296b4e562c46432ab04ff8

Handa Wang   commited 2024-07-22 05:33:36 +00:00
cc6d43690b
[Thread] disable handling of airplane mode
This is basically a revert of aosp/3079292 to disable the handling of
the airplane mode. The cause is that there are a few reported ANR issues
on real devices and they points to the handlers here in Thread module.

Before we figure out the root cause, let's disable the airplane mode
handler in Thread to recover the presubmit tests.

Bug: 353115531
Bug: 352484437
Bug: 350586929
Bug: 352316041
Change-Id: I569ced2855658f965ddf51242600ee3c325781a7

Kangping Dong   commited 2024-07-15 15:48:15 +08:00
14da81bc17
Merge "[Thread] add config_thread_mdns_vendor_specific_txts" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-07-10 11:03:52 +00:00
9365e728e5
Merge "Revert "[Thread] post broacast receivers on the handler thread"" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-07-10 09:43:16 +00:00
4866872a4d
[Thread] add config_thread_mdns_vendor_specific_txts
per offline discussion, it's better to provide support of customizing
any vendor-specific TXTs to make the solution more generic. The preivous
defined "vgh" TXT entry is deprected.

Bug: 343671003
Change-Id: I6e2804e346d04078b7d28bfdc18ed6c23c5c10e6

Kangping Dong   commited 2024-07-10 17:36:13 +08:00
29918c1d45
Revert "[Thread] post broacast receivers on the handler thread"
This reverts commit f8aaac0dd0.

Reason for revert: see b/350586929

Change-Id: I34f3a87664992e5324f89bcf49e56707d0143743

Kangping Dong   authored and   Gerrit Code Review   commited 2024-07-10 08:45:09 +00:00
65b4f5fa53
Merge "Thread: fill in ticks in active timestamp" into main
Yakun Xu   authored and   Gerrit Code Review   commited 2024-06-26 09:33:38 +00:00
4355dae9d8
Thread: fill in ticks in active timestamp
This commit fills in the ticks of active timestamp of randomly generated
dataset as defined in Thread spec.

Bug: 347838683
Change-Id: I5d8ba3ca7728e1890996fdd64198f7bc90bfb1fa

Yakun Xu   commited 2024-06-26 15:56:57 +08:00
e2ab96f3c7
Merge changes from topic "thread-configuration-api" into main
* changes:
  [Thread] support ThreadConfiguration API at ThreadNetworkControllerService
  [Thread] add support for configuration at ThreadNetworkController

Treehugger Robot   authored and   Gerrit Code Review   commited 2024-06-24 10:03:18 +00:00
bc9c0e2b03
[Thread] support ThreadConfiguration API at ThreadNetworkControllerService
Bug: 342519412
Test: atest CtsThreadNetworkTestCases

Change-Id: I7b84a64d24e513bd6ba07bb26e3801b72c250810

Handa Wang   commited 2024-06-24 07:50:37 +00:00
4688910810
[Thread] add support for configuration at ThreadNetworkController
This CL adds methods for setting the ThreadConfiguration and
subscribing/unsubscribing to Configuration changes. The ThreadConfiguration
is used for controlling Thread features for the device.

Bug: 342519412
Change-Id: I9e20391eb3b2f20312a2cb0b587cc5bdf200d24d

Handa Wang   commited 2024-06-24 07:50:34 +00:00
7520abf333
[Thread] post broacast receivers on the handler thread
It turns out context.registerReceiver(receiver, intentFilter,
permission, flags, handler) is not posting the receiver on the handler
and will result in ANR in activity manager if the receiver is blocked

This commit makes it safer by posting the receiver body to mHandler
explicitly.

Bug: 340368050
Change-Id: Ib6b8c0a8952ce43c935f39b0978f47268b108a79

Kangping Dong   commited 2024-06-24 11:52:14 +08:00
f8aaac0dd0
Merge "[Thread] add annotations for unit test NsdPublisherTest" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-06-18 06:45:16 +00:00
8e53836647
Merge "[Thread] reduce JNI code for setting up the ICMPv6 socket" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-06-18 05:03:15 +00:00
5637480c2c
[Thread] reduce JNI code for setting up the ICMPv6 socket
Bug: 316103631
Test: atest ThreadNetworkIntegrationTests

Change-Id: I64a0cb22d4ed2208328123d8dace3463a92af01e

Handa Wang   commited 2024-06-18 02:40:36 +00:00
0348cbe874
[Thread] add annotations for unit test NsdPublisherTest
Change-Id: Ic4e12b21bb888f0e4f892e9a368a64d769120cc1
Test: atest NsdPublisherTest

Handa Wang   commited 2024-06-18 00:51:03 +00:00
89c32ea0c8
Merge "[Thread] add the "vgh" TXT entry" into main am: 7ff092e3d1
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3109107

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

Treehugger Robot   authored and   Automerger Merge Worker   commited 2024-06-12 18:27:23 +00:00
a00548da3d
[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 am: 53f4a29816
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3007440

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

Treehugger Robot   authored and   Automerger Merge Worker   commited 2024-06-07 02:53:34 +00:00
43b971e2e9
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
Merge "Use DeviceFeatureModuleController to run tests only if the device has the required feature." into main am: 4dd381a966
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3115944

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

Kangping Dong   authored and   Automerger Merge Worker   commited 2024-06-06 06:01:19 +00:00
80bd51430c
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 am: a22aa7777d
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3102801

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

Handa Wang   authored and   Automerger Merge Worker   commited 2024-06-05 10:35:01 +00:00
c2a1ac99c8
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
Merge "[Thread] enforce a timeout for waiting FTDs' output in integration tests" into main am: 37f70df140
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3109718

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

Handa Wang   authored and   Automerger Merge Worker   commited 2024-06-03 05:02:38 +00:00
b9a64b22e8
[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
Merge "Fix ThreadFeatureCheckerRule on U- devices" into main am: 7ab992b3c6
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3108017

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

Kangping Dong   authored and   Automerger Merge Worker   commited 2024-05-30 04:57:33 +00:00
3b7cfafdc5
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
Merge "Handle enabledState change in onStateChanged()." into main am: 5b93b601ee
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3102803

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

Yang Sun   authored and   Automerger Merge Worker   commited 2024-05-28 11:01:12 +00:00
73b3b25c76
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 am: 22c6b6c9d7
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3102782

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

Kangping Dong   authored and   Automerger Merge Worker   commited 2024-05-26 13:42:00 +00:00
1643133b60
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
Merge Android 24Q2 Release (ab/11526283) to aosp-main-future
Bug: 337098550
Merged-In: I50f3d3b8205a5a9ee8154a649318a2c175edbb71
Change-Id: I744085a52a290ba39beec9df7c27247ee5cc007f

Xin Li   commited 2024-05-24 08:25:30 -07:00
a9c4e57fd0
[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