Commit graph android_packages_modules_Co.../thread
Message SHA1
[Thread] add public newbie guide
Change-Id: I03975d832c2ae1223a472f01541d4d488e2f6950

Kangping Dong   commited 2024-06-07 02:38:58 +00:00
3b47411d25
Merge "[Thread] add NetworkCapability.NOT_METERED for Thread network" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-04-02 08:49:58 +00:00
8b15cc8f8e
[Thread] add NetworkCapability.NOT_METERED for Thread network
Thread is an unmetered network so we should add this capability.

Bug: 332219983
Test: `bw_costly_thread-wpan` won't show up after this CL.
Change-Id: I0818700e5e7aad04ae15b0d0fd4490ab3f12839e

Handa Wang   commited 2024-04-02 07:40:14 +00:00
a92080f443
[Thread] enable Service Discovery integration tests
Bug: 328527773
Bug: 332452386

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

Change-Id: Ib1bc690c4f5bfcc30d4fb11b472fb4095505f1ef

Handa Wang   commited 2024-04-02 05:38:02 +00:00
b40140dcd0
[Thread] discover and resolve the meshcop service only on test network
The test case is flaky because the service is unexpectedly discovered
after it's already unregistered. Probably this is due to that on the
WiFi interface NsdManager somehow didn't hear the goodbye PTR for the
service so it can still 'discover' the service. Limiting the discovery
on test network may help avoid the flake because test network is
cleaner.

Bug: 331878313
Test: https://android-build.corp.google.com/builds/abtd/run/L17400030002839695

Change-Id: Icc09aae00cd90f64428387b97dbd9743140641e5

Handa Wang   commited 2024-04-01 01:26:56 +00:00
a449374772
Merge "set the country code when initializing the ot-daemon" into main
Zhanglong Xia   authored and   Gerrit Code Review   commited 2024-03-28 10:48:51 +00:00
1038c141fe
Merge "[Thread] remove queueing mechanism for NsdPublisher" into main
Handa Wang   authored and   Gerrit Code Review   commited 2024-03-28 09:20:37 +00:00
de10473d94
Merge "Separate Struct.java into its own lib." into main
Yang Sun   authored and   Gerrit Code Review   commited 2024-03-28 06:23:57 +00:00
68d68d82ed
Merge "[Thread] add a unicast routing case when infra link switches" into main
Handa Wang   authored and   Gerrit Code Review   commited 2024-03-28 06:06:29 +00:00
28090042b6
[Thread] add a unicast routing case when infra link switches
Bug: 331567763
Test: atest ThreadNetworkIntegrationTests:android.net.thread.BorderRoutingTest#unicastRouting_afterInfraNetworkSwitchInfraDevicePingThreadDeviceOmr_replyReceived

Change-Id: I3bb0d4c8b1ab8d5e68c2fdcb854175d04dbe5336

Handa Wang   commited 2024-03-28 03:56:32 +00:00
d9e4ba6d26
[Thread] use toHexString for toString()
dumpHexString will create additional representations other than a HEX string, it's suitable for raw logging message but not in a Object#toString.

Change-Id: I184eb10bafa2db1103a4ef5cf82250db52aec278

Kangping Dong   commited 2024-03-28 03:54:11 +00:00
21e5d68f74
set the country code when initializing the ot-daemon
The country code is lost after the ot-daemon is restarted. This
CL stores the country code to persistent settings and reads
out the previously stored country code to set the country code
when the ot-daemon is initialized.

Bug: b/326021472
Test: atest ThreadNetworkUnitTests

Change-Id: I6982a57ba4845f5a45f3366400c531398e82339e

Zhanglong Xia   commited 2024-03-28 10:36:24 +08:00
4eab54b40e
Separate Struct.java into its own lib.
* Struct.java is removed from net-utils-device-common-bpf and
  net-utils-device-common-struct's source list
* Created a lib net-utils-device-common-struct-base for Struct.java
* Updated libs that require Struct.java to include
  net-utils-device-common-struct-base.
* Replaced net-utils-multicast-forwarding-structs with
  net-utils-device-common-struct in service-connectivity

Bug: 323503345

Test: build tethering module.
Change-Id: I3f60715c3d8043b7569db7612dee9d4fa1ccba59

Yang Sun   commited 2024-03-27 20:15:17 +08:00
3aa62e6773
[Thread] remove queueing mechanism for NsdPublisher
The queueing mechanism is not needed because b/323300118 is fixed.

Bug: 331512403
Bug: 323300118
Test: atest CtsThreadNetworkTestCases

Change-Id: Id7e868db69668494c1c7e3c473931a3087dc5755

Handa Wang   commited 2024-03-27 09:01:52 +00:00
05571d4a08
Merge "[Thread] add logs for Thread enabled state" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-03-27 03:49:11 +00:00
40029ad089
[Thread] add logs for Thread enabled state
Change-Id: I62bd170dc12dde7663e5811133709847e1808675

Kangping Dong   commited 2024-03-26 14:21:20 +00:00
edee1cac9b
Merge "Update THREAD_ENABLED key string in ThreadPersistentSettings" into main
Kangping Dong   authored and   Gerrit Code Review   commited 2024-03-26 11:18:35 +00:00
f2832c79d6
Update THREAD_ENABLED key string in ThreadPersistentSettings
Updated from Thread_enabled to thread_enabled

Test: presubmit
Change-Id: If0296f4d4bdf37f4564ee6fabdeffffe9d3020dd

Yang Sun   commited 2024-03-26 17:13:32 +08:00
2d4f91d548
check the Thread required features before running ThreadNetworkControllerTest
This CL checks if the device supports Thread specific features before
running the test case ThreadNetworkControllerTest. If the device
doesn't support specific features, just skip the test case.

Bug: b/330879812
Test: atest ThreadNetworkIntegrationTests
Change-Id: I1452ab02cc62228102d4a140f39abf13b79542c7

Zhanglong Xia   commited 2024-03-26 13:20:24 +08:00
c1d4e1eea1
[mdns] support discovering and resolving services
Bug: 305866779
Test: atest ThreadNetworkIntegrationTests:android.net.thread.ServiceDiscoveryTest

Change-Id: I96ee5b835c90fa55136dbbde68d36bbf2044b420

Handa Wang   commited 2024-03-22 06:32:23 +00:00
abefbf0b9f
Merge "[Thread] fix ot-daemon state consistency issues" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-03-22 06:31:18 +00:00
3a9d363bdf
Merge "[Thread] fix access to mOtDaemon" into main
Kangping Dong   authored and   Gerrit Code Review   commited 2024-03-22 05:16:01 +00:00
619c41c01c
[Thread] fix ot-daemon state consistency issues
1. the OtDaemonState in OtDaemonCallbackProxy class is not cleared when
   ot-daemon dies
2. register ot-daemon state callback within the IOtDaemon#initialize API
   to avoid missing state changes between initialize() and
registerStateCallback()

Bug: 330441708
Change-Id: Ice58566582b40a6d25627cf01dec93da61ad3596

Kangping Dong   commited 2024-03-22 10:58:24 +08:00
0d22aded3d
[Thread] fix access to mOtDaemon
When calling a ot-daemon API, getOtDaemon() should always be used.
Access mOtDaemon directly can crash because it will be reset to null
when ot-daemon dies.

Change-Id: Id9941497fd43b1d57aba4bace31be0fbd9439c9c

Kangping Dong   commited 2024-03-22 10:58:20 +08:00
530147f061
[Thread] add system API setChannelMaxPowers
The `setChannelMaxPowers` allows privilege app to set the max
power of each channel. It is going to be used for controlling the
output power of the Thread radio chip.

Bug: b/320594263
Test: atest ThreadNetworkUnitTests && atest CtsThreadNetworkTestCases

Change-Id: Ic47eccd6de2da0e6cdb8f21d5b4df156b1f11747

Zhanglong Xia   commited 2024-03-22 10:49:09 +08:00
62abecc9b5
[Thread] add command to force stop ot-daemon
The Thread HAL supports only one client for a single Thread chip, so
ot-daemon needs to be force stopped in VTS tests because the testapp
needs to connect to the HAL service to perform tests.

Bug: 328538612
Change-Id: I5288e5747ab3957050d0e85c1ea684c6ead6c87d

Kangping Dong   commited 2024-03-21 19:02:39 +08:00
82599d3e21
[Thread] do not restart ot-daemon when Thread is disabled
Current implementation will auto-restart ot-daemon even when Thread
has been disabled by ThreadNetworkController#setEnabled(false). This
commit fixes this issue and also adds the "enable" / "disable" shell
command to ease testing.

Bug: 328538612
Change-Id: Icc9360ccf5d7daa6345def75d1860f046600b85b

Kangping Dong   commited 2024-03-20 23:49:53 +08:00
adb3c1ac62
[Thread] make demoapp system_ext_specific
Vendor or product extra apps/files can't be added to the generic system
image. Like below error:

```
FAILED:
build/make/core/artifact_path_requirements.mk:31: warning:  vendor/google/products/cf_x86_64_phone.mk produces files inside build/make/target/product/generic_system.mks artifact path requirement. Consider adding this file to the system_ext or product partition instead. Confused? Ch
eck out go/artifact-error.
Offending entries:
system/etc/permissions/privapp-permissions-com.android.threadnetwork.demoapp.xml
system/priv-app/ThreadNetworkDemoApp/ThreadNetworkDemoApp.apk
```

Bug: 330097284
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:4c39c8f63edfa55edbd84a8473887df17ffe52fd)
Merged-In: I1b3723c12da44d80555aa35a86b9bae722845cb3
Change-Id: I1b3723c12da44d80555aa35a86b9bae722845cb3

Kangping Dong   authored and   Android Build Cherrypicker Worker   commited 2024-03-19 12:44:43 +00:00
184b400f8f
Merge changes from topic "overlay-vendor-model-name" into main
* changes:
  [Thread] support customize meshcop txt via resourceoverlay
  [Thread] add resourceoverlay config for vendor and model name

Kangping Dong   authored and   Gerrit Code Review   commited 2024-03-19 12:21:23 +00:00
ab1945c790
Merge "[Thread] add missing permissions to ThreadNetworkDemoApp" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-03-19 04:44:16 +00:00
a490186098
[Thread] support customize meshcop txt via resourceoverlay
Currently support customizing the vendor name, vendor oui and model
name.

Bug: 311324956
Test: atest ThreadNetworkIntegrationTests:android.net.thread.ServiceDiscoveryTest#meshcopOverlay_vendorAndModelNameAreSetToOverlayValue
Change-Id: I3ad916112c73c3f8a7eef4e3fa8d421ab9bf8276

Kangping Dong   commited 2024-03-18 20:13:37 +08:00
ea4390cc4c
[Thread] unify synchronous controller API for testing
This commit creates the new `ThreadNetworkControllerWrapper` class to
unify the asynchronous version of the ThreadNetworkController API to
simplify Thread tests.

Test: atest ThreadNetworkIntegrationTests
Change-Id: Ibc6e6e2dad5041b092315aa0278915c137867488

Kangping Dong   commited 2024-03-18 19:17:02 +08:00
62eac0132d
Merge "Use a short timeout for FullThreadDevice.ping" into main
Kangping Dong   authored and   Gerrit Code Review   commited 2024-03-18 11:13:11 +00:00
c1df0d07dd
Use a short timeout for FullThreadDevice.ping
In the tests there may not be a reponse to ftd ping command, and the
function does not check for ping success. So using a short timeout of
0.1s to let the function finish faster.

This change also removed the additional start BR step in
unicastRouting_borderRouterSendsUdpToThreadDevice_datagramReceived as
this is already done in setUp().

Bug: 328144082

Test: atest ThreadNetworkIntegrationTests:android.net.thread.BorderRoutingTest
Change-Id: I18202c74596d4a08bc8238723049e05994cca659

Yang Sun   commited 2024-03-18 17:32:40 +08:00
4bf1dcd7f4
[Thread] add missing permissions to ThreadNetworkDemoApp
The privileged permissions needs to be included in the allowlist to be
able to pre-install the ThreadNetworkDemoApp.

Otherwise RuntimeException like below will be thrown to stop the device
from booting up:

```
03-18 07:13:46.288  4920  4920 E AndroidRuntime: java.lang.IllegalStateException: Signature|privileged permissions not in privileged permission allowlist:
```

Bug: 330097284
Test: `lunch aosp_cf_x86_64_phone-trunk_staging-userdebug && m` and
verified that the demoapp can be started

Change-Id: Ia6876e2eff1cde837be9e69954b2c749525e9e3c

Kangping Dong   commited 2024-03-18 15:18:45 +08:00
1786bd9967
Merge "Log as warning when persistent setting file doesn't exist" into main
Yang Sun   authored and   Gerrit Code Review   commited 2024-03-18 02:11:47 +00:00
3b6db502f1
Merge "[Thread] use TestRule to filter Thread tests" into main
Kangping Dong   authored and   Gerrit Code Review   commited 2024-03-17 14:17:32 +00:00
f8ffba4c04
Log as warning when persistent setting file doesn't exist
The Thread persistent setting file may be missing if a new device is
started or the file is deleted on the device. Updated the logging from
error to warning as the file will be created.

Test: presubmit
Change-Id: I107712fc6fef61f26bc9be49fd703e61beae32a6

Yang Sun   commited 2024-03-17 13:33:01 +08:00
72ea70ed1d
[Thread] use TestRule to filter Thread tests
It's error-prone to check dependent feature in both setUp() and
tearDown() to filter specific Thread tests. This commit adds
`ThreadFeatureCheckRule` and refactor the Thread tests to use the new
test rule to filter test cases.

Test: manually verified the annonated tests are skipped with
ASSUMPTION_FAILED when the dependency feature is not supported

Change-Id: I7a5efe6bda53fc1a6e204f6f40dd3ab2c3940988

Kangping Dong   commited 2024-03-16 20:00:40 +08:00
f1182f1057
Merge "Add reset API for NsdPublisher" into main
Handa Wang   authored and   Gerrit Code Review   commited 2024-03-15 15:00:01 +00:00
88dd959eef
Merge "[Thread] add CtsThreadNetworkTestCases to CTS" into main
Kangping Dong   authored and   Gerrit Code Review   commited 2024-03-15 13:31:05 +00:00
b2f8b5f87a
[Thread] add CtsThreadNetworkTestCases to CTS
Bug: 329561498
Merged-In: I07d78c0d375370aa83024e3e154b7841a5018e64
Change-Id: I5157ae990046efcba411d2b5498c0d16f0c5efcd

Kangping Dong   commited 2024-03-15 15:57:42 +08:00
60e06c4ac9
Add reset API for NsdPublisher
This is needed by `ot-daemon` to clear all registrations when
re-initializing the `ot-daemon`'s `Application` class.

Bug: 323301831

Change-Id: I5ed3d2d29b08f4187ac1f406052d362cf2249c19

Handa Wang   commited 2024-03-14 14:37:38 +00:00
da90deda1b
reduce the timeout for discovering the lost of MeshCoP service in CTS
This is to avoid exceeding the time limit of 60 seconds per test case.

Bug: 323301831

Change-Id: I4921740b2561d75d78084436b53c7bac8c01023c

Handa Wang   commited 2024-03-14 07:51:51 +00:00
e1545c3bca
explicitly request NET_CAPABILITY_LOCAL_NETWORK capability when requesting Thread network
Due to aosp/2936050, NET_CAPABILITY_LOCAL_NETWORK is mandatory in the NetworkRequest before Android V to request a Thread network. Without this ThreadNetworkControllerService cannot get the Thread network so that it cannot bring up border routing.

Bug: 329464390
Bug: 329403058

Change-Id: Ic033288789d338c2fe6d0abde474acd24657ad5f

Handa Wang   commited 2024-03-14 01:56:51 +00:00
281c7d2a9b
Fix the issue that border routing is unavailable when ot-daemon restarts
Bug: 325771342
Test: atest ThreadNetworkIntegrationTests:android.net.thread.BorderRoutingTest

Change-Id: I60f41ef079167955d29d5e6f809ad2dd343c188b

Handa Wang   commited 2024-03-13 00:33:53 +00:00
aac3ef4da9
Check kernel version for multicast routing support.
Multicast routing is only supported on 14_5.15.0 and onwards. When sdk
version is 34+, thread is supported, if kernel version is e.g.
5.15.144-android13 then multicast routing is not supported so we need to
skip multicast routing tests.

Bug: 328133320

Test: atest ThreadNetworkIntegrationTests:android.net.thread.BorderRoutingTest
Change-Id: I5d67f4558b40ee3ec0569298c7c02726d5d19e98

Yang Sun   commited 2024-03-07 20:44:05 +08:00
734c626fea
Merge "Merge Android 14 QPR2 to AOSP main" into main
Xin Li   authored and   Gerrit Code Review   commited 2024-03-07 06:41:03 +00:00
612de50da2
Merge "Use factoryreset as a workaround to reduce the delay of reforming a network" into main
Handa Wang   authored and   Gerrit Code Review   commited 2024-03-07 06:23:21 +00:00
2aa81a6edc
Use factoryreset as a workaround to reduce the delay of reforming a
network

There's a defect in ot-daemon that re-forming a network after erasing
the persistent data will take longer delay. We can use the
`factoryreset` command to work this around so that the test cases take
less time.

Bug: 323301831
Bug: 328235705

Change-Id: I36e67fe0f7f1165a03e71397065a6166117acadb

Handa Wang   commited 2024-03-07 03:11:23 +00:00
b929c98c3c