Commit graph android_packages_modules_Co.../thread/service
Message SHA1
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
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
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
[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
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
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
[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] 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
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
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
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
[mdns] support regsitering hosts in NsdPublisher
This CL also adds an integration test case for the Advertising Proxy feature.
Currently the test case is disabled because it's unstable on some branches.
Will re-enable the test case when it's stable enough.

Bug: 318323473
Test: atest ThreadNetworkIntegrationTests:android.net.thread.ServiceDiscoveryTest
Change-Id: Ic88efb3b80640f95b53e4ec2428369e87be71649

Handa Wang   commited 2024-03-07 02:59:14 +00:00
c6037af2bf
Revert "[mdns] support regsitering hosts in NsdPublisher"
Revert submission 2943805-nsdpublisher-publish-host

Reason for revert: Test failures: b/328384504

Reverted changes: /q/submissionid:2943805-nsdpublisher-publish-host

Change-Id: I5919fea68cae0d3817319994f43eb47e912f9157

Vaibhav Devmurari   authored and   Gerrit Code Review   commited 2024-03-06 12:15:11 +00:00
ba1cc3886e
[mdns] support regsitering hosts in NsdPublisher
This CL also adds an integration test case for the Advertising Proxy feature.

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

Change-Id: I626aa6250bc2cb94aee09067b4f8e6b14bd90fcf

Handa Wang   commited 2024-03-05 06:56:52 +00:00
87c688df4b
Merge "[Thread] make Thread state customisable via resource overlay" into main
Kangping Dong   authored and   Gerrit Code Review   commited 2024-02-28 16:28:55 +00:00
5ce2519a3e
Merge "[BBR] Apply downstream multicast config sent from ot-daemon" into main
Yang Sun   authored and   Gerrit Code Review   commited 2024-02-28 14:15:46 +00:00
aa26b685f7
[Thread] make Thread state customisable via resource overlay
Make the default Thread and Border Router enabled state customizable for
vendor via resource overlay.

Bug: 322734489
Change-Id: I278d6afa82aac8d1bb06ee79f22bae6fb0199386

Kangping Dong   commited 2024-02-28 16:54:02 +08:00
c8359f4eb1
[BBR] Apply downstream multicast config sent from ot-daemon
The multicast listening address from ot-daemon is maintained separately
from the bbr state. When bbr changes from primary to secondary, there
can still be subscribed addresses and should not be missed when switching
back to primary mode. So instead of sending address add/remove events
from ot-daemon and maintain the list in system server, ot-daemon will
send full list of addresses together with the multicast routing
enablement state each time there is an update to the bbr state or
listening addresses.

Bug: 321624274

Test: atest ThreadNetworkIntegrationTests

Change-Id: Ic9ce77bb7fdeacf2def216cf9bcd44095083a992

Yang Sun   commited 2024-02-28 15:07:30 +08:00
053ae87688
Select Thread channel from preferred or supported channel mask
The API `createRandomizedDataset()` randomly selects a channel
between channel 11 and 26. But not all countries support channels
between 11 and 26.

This CL selects random channel from  the preferred channel mask if
the preferred channel mask is not 0, otherwise choose one from the
supported channel mask.

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

Change-Id: I6add3edc7e4fa888c46b57c4463ab18e0aa84e80

Zhanglong Xia   commited 2024-02-23 11:04:27 +08:00
d800ee41bf
Merge "[Thread] remove OT_ERROR_DETACHED" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-02-22 06:29:26 +00:00
f54f07dbb8
Merge "[Thread] convert OT_ERROR_INVALID_STATE to INTERNAL_ERROR" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-02-22 06:22:46 +00:00
0d131ca017
[Thread] remove OT_ERROR_DETACHED
remove handling of this error code given it's not returned from
IOtDaemon APIs.

Test: atest CtsThreadNetworkTestCases
Change-Id: Id1d9b9d0ad45b7242e7c1d081b05ac51cf928603

Kangping Dong   commited 2024-02-22 11:37:53 +08:00
139185cc32
[Thread] convert OT_ERROR_INVALID_STATE to INTERNAL_ERROR
In most cases, OT_ERROR_INVALID_STATE in ot-daemon indicates an internal
error. OtDaemonServer should actually maintain the state to make sure no
OT_ERROR_INVALID_STATE error can be returned.

Test: atest CtsThreadNetworkTestCases
Change-Id: I9dd6667548048873bf0c5b8eb85d929dfcaef997

Kangping Dong   commited 2024-02-22 11:34:16 +08:00
9a7619cd99
[Thread] disable Thread when user restriction is set
This commit follows the guideline in go/ae-v-thread-admin-control that
Thread radio should be disabled when the user restriction is set and
nobody can enable Thread again (it fails with
ERROR_FAILED_PRECONDIFITION).

This commit adds only unit tests, E2E CTS tests are tracked in b/319079428

Bug: 319077876
Change-Id: I8981aa9e71948c64ee79701427ac794880826327

Kangping Dong   commited 2024-02-20 15:56:42 +08:00
505b5ce45b
[mdns] implement NsdPublisher AIDL service
For ot-daemon to perform mDNS operations, we need to implement an AIDL
service NsdPublisher. MdnsPublisher forwards the calls to NsdManager.

For now, only register & unregster a service without a custom host is supported.

Bug: 320211657
Bug: 318323473
Test: atest CtsThreadNetworkTestCases

Change-Id: Ia392a0f57046f53973ac6bd6043dec915d170666

Handa Wang   commited 2024-02-04 04:03:36 +00:00
0c99448af4
Merge "[Thread] restarts when ot-daemon crashes" into main
Kangping Dong   authored and   Gerrit Code Review   commited 2024-02-01 15:24:26 +00:00
fbaa7ea0bc
[Thread] restarts when ot-daemon crashes
This commit handles the ot-daemon crash by automatically restarting it
and rejoin the network if ever joined.

This also fixes the address not deleted issue in TunInterfaceContorller.

Bug: 321540728
Bug: 309792480
Change-Id: I3ed466eb70818974a1e57f01456363bdf82915d5

Kangping Dong   commited 2024-02-01 21:49:31 +08:00
3deddc7b3f
Add netlinkSocketForProto() without buffersize.
Test: atest NetworkStaticLibTests
atest FrameworksNetTests

Change-Id: I34a0a29eb7e78490701872229585e61f7a0c1dd3

Yang Sun   commited 2024-02-01 09:50:52 +08:00
1d8b7cc422
Merge "[DON'T BLOCK] Test ownership migration rules" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-01-31 23:38:03 +00:00
e7aa45cdf0
Merge "[Thread] refine border routing logging" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-01-31 13:27:26 +00:00
7f7135e29e
[DON'T BLOCK] Test ownership migration rules
This CL is created as a best effort to migrate test targets
to the new android ownership model. If you find incorrect or unnecessary
attribution in this CL, please create a separate CL to fix that.

For more details please refer to the link below,
<add g3 doc link>

Bug: 304529413
Test: N/A
Change-Id: I243f17b3f0ad7af9ffa15ca242456e36688733f5
Merged-In: I243f17b3f0ad7af9ffa15ca242456e36688733f5

Aditya Choudhary   commited 2024-01-31 12:34:50 +00:00
01b5ede2b2