Commit graph android_packages_modules_Co.../thread/service
Message SHA1
[Thread] support Thread NetworkRequest
Bug: 374037595
Flag: com.android.net.thread.flags.thread_mobile_enabled
Change-Id: Ib13d2a65f7c9693fb998bb98361538e3b6085913

Kangping Dong   commited 2025-09-12 15:06:00 +08:00
43ddfe74fa
Move #nativeWaitForService into CommonConnectivityJni
AServiceManager_waitForService sytem APIs currently only callable
via dlsym(): b/376759605. When built with sdk_version current,
the NDK stubs for "sdk" variants only include NDK APIs,
excluding #systemapi APIs.

Flag: EXEMPT Mechanical refactors
Test: atest ServiceManagerWrapperIntegrationTest
Change-Id: I48f690d771c7905e79e463617ded772f753cc854

Mark Chien   authored and   Patrick Rohr   commited 2025-08-06 10:44:39 -07:00
f250ade6fa
Revert "[Thread] enable/disable Thread via DeviceConfig flags"
This reverts commit 198b3218e7.

Reason for revert: we need only the settings changes (ag/32820024 and ag/32819994) to hide the settings toggle but don't need to make it default disabled as it makes no differences

Change-Id: I40dcea50eb3bbe16c9ffdb89c6182b976f819ece

Kangping Dong   commited 2025-04-13 21:01:55 -07:00
4aaf2865e4
[Thread] enable/disable Thread via DeviceConfig flags
Flag: EXEMPT See b/407643308
Bug: 407643308

Change-Id: Ia40b562ab41210c8f9b90742420a2f2c32c9071b

Kangping Dong   commited 2025-04-09 19:32:39 +08:00
198b3218e7
[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] 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
[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
[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
[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
[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
[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
[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
Configure TREL feature from feature flag.
Bug: 354868035
Bug: 359089751

Test: atest ThreadNetworkIntegrationTests:ServiceDiscoveryTest#trel_servicePublished

Change-Id: Ib545df6bf5ce20f35914b4695dbd2e3c1e1232e4

Yang Sun   commited 2024-11-18 20:13:00 +08:00
bb7efba754
[Thread] avoid re-setting the infra link state when the state doesn't change
In the situation where infra state changes very frequently, it may cause the border routing to frequently restart.

Bug: 377821980
Test: atest ThreadNetworkIntegrationTests

Change-Id: Id2862b0db7e01f89da20c56c4ad2f0086d4b6a98

Handa Wang   commited 2024-11-07 08:13:03 +00:00
0435210627
[Thread] add private API for disabling border router
Bug: 374036806
Change-Id: Ib8ca8bbd2b3018c39c9250e1b3ce70b193273c1b

Kangping Dong   commited 2024-10-31 14:30:25 +08:00
56449db1be
[Thread] tell ot-daemon about the DNS servers on the infra link
This CL passes the DNS servers' information to ot-daemon which was
fetched from LinkProperties of the infra link. This can enable the DNS
recursive resolver feature of the Thread Border Router.

The integration test case will be covered when aosp/3259932 is merged. Currently the test case CL cannot be merged because the there's a dependency PR in GitHub hasn't been merged: https://github.com/openthread/openthread/pull/10864.

Bug: 365892457
Bug: 354868095
Test: atest ThreadNetworkIntegrationTests:android.net.thread.InternetAccessTest

Change-Id: I66e54715ecaf8e0a43324d4afd4398e8884d8738

Handa Wang   commited 2024-10-28 05:29:00 +00:00
2d9992c186
[Thread] request/release the NAT64 CIDR
This CL implements the logic to maintain the NAT64 CIDR at ThreadNetworkControllerService. When NAT64 is enabled, the service needs to request a CIDR via RoutingCoordinatorManager#requestDownstreamAddress(). When NAT64 is disabled, the service needs to release the CIDR via RoutingCoordinatorManager#releaseDownstreamAddress().

Bug: 350699020

Change-Id: I16397fd48c2925efd9d4833a335cf73832b4f4d6

Handa Wang   commited 2024-10-23 01:31:43 +00:00
a7318da774
[Thread] Let TunInterfaceController.getLinkProperties() return a copy of LinkProperties
This CL avoids accidental edits to the `mLinkProperties` field of TunInterfaceController.

Change-Id: Ie696412c0593cece2fddcd6bc097db2829ef16e7

Handa Wang   commited 2024-10-21 02:51:03 +00:00
380e8244a5
[Thread] introduce ThreadNetworkControllerService#initializeInternal()
The size of the lambda in ThreadNetworkControllerService#initialize() is getting larger so we introduce #initializeInternal() for better readability.

Change-Id: Idd7cb57e5ed03d27210c1199e03bfab51dbd1215

Handa Wang   commited 2024-10-18 09:35:54 +00:00
2801791773
[Thread] add CLI commands for getting/setting config
Bug: 364237115

Change-Id: Ice42d7d02cfefd733042282939635502c259d9d5

Handa Wang   commited 2024-10-17 07:40:42 +00:00
7eb1bbd369
Merge "Change OtDaemonState ephemeralKeyExpiryMillis to ephemeralKeyLifetimeMillis" into main
Yang Sun   authored and   Gerrit Code Review   commited 2024-10-11 01:19:01 +00:00
adee3295ff
Merge "[Thread] fix the issue that border routing is not available after ot-daemon restarts" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-10-10 15:33:01 +00:00
3e4eaf8c80
[Thread] fix the issue that border routing is not available after
ot-daemon restarts

This CL tries to fix issue by removing error-prone shortcircuit checks.
The checks skip configuring the ot-daemon if they think the new state
is equal to the old state. However, the old state mainainted in
ThreadNetworkControllerService may be stale which causes issues.

Bug: 372592886
Test: atest ThreadNetworkIntegrationTests

Change-Id: Icab25cf094f8bf33832b4097ab8ee77b54badc6b

Handa Wang   commited 2024-10-10 14:21:58 +00:00
485a7f1849
Change OtDaemonState ephemeralKeyExpiryMillis to ephemeralKeyLifetimeMillis
Bug: 372598146
Test: atest CtsThreadNetworkTestCases

Change-Id: I634ca0c22b5d80411df2b53493659c27ea07d2f2

Yang Sun   commited 2024-10-10 06:54:40 +00:00
fe0fb3081e
[Thread] implement the ThreadNetworkController#setConfiguration at
service

This CL implements the ThreadNetworkController#setConfiguration. When
the ThreadNetworkControllerService receives this call, the configuration
is passed to ot-daemon and triggers according OT APIs. On success, the
configuration is persisted to the local storage and triggers
OutcomeReceiver#onSuccess. On failure, it triggers
OutcomeReceiver#onError.

Bug: 368456504

Change-Id: I570ec3fead204cd3b6c05629ef409967245350b8

Handa Wang   commited 2024-10-10 05:36:06 +00:00
ed15725987
[Thread] support ephemeral key API in ThreadNetworkControllerService
Bug: 348323600

Test: atest CtsThreadNetworkTestCases
Change-Id: Ic8cae057f1bc8e631e47cfc1afba59b09bf0b35f

Yang Sun   commited 2024-09-29 02:35:51 +00:00
a591d0432b
Merge "[Thread] support discovering NAT64 prefix from AIL" into main
Handa Wang   authored and   Gerrit Code Review   commited 2024-09-23 03:58:57 +00:00
5f9a3d042e
[Thread] support discovering NAT64 prefix from AIL
Bug: 357479886

Change-Id: I8dfd96a0ba3e927ed4cbc8ceecb18652adf98964

Handa Wang   commited 2024-09-23 02:35:07 +00:00
b47c325907
Merge "[Thread] refactor setInfraLinkState" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-09-20 09:51:58 +00:00
adc778d038
Merge "Allow ot-ctl command under ADB Thread Network Service : support of non-interactive mode" into main
Yang Song   authored and   Gerrit Code Review   commited 2024-09-20 07:32:01 +00:00
2d17714c24
[Thread] refactor setInfraLinkState
This CL integrates the refactoring of aosp/3264051.

Bug: 365892457
Change-Id: I77788c06db02abbf2275fda3015b0f3fa63920e0

Handa Wang   commited 2024-09-20 06:34:51 +00:00
e24b215bf2
Merge "Let NsdPublisher pass the interface index when a service is resolved." into main
Yang Sun   authored and   Gerrit Code Review   commited 2024-09-20 05:13:43 +00:00
631ded17fc
Allow ot-ctl command under ADB Thread Network Service : support of non-interactive mode
Bug: 351721329

Test: atest ThreadNetworkUnitTests

Change-Id: Id7443c24ea380d200e73cca4ead2284249f2052f

Yang Song   commited 2024-09-20 03:58:14 +00:00
ffceaae1b8
Let NsdPublisher pass the interface index when a service is resolved.
The mapping from network to interface name is passed from
ThreadNetworkControllerService to NsdPublisher, so that NsdPublisher can
send interface index to mdns subscribers when a service is resolved.

Bug: 321883491

Test: presubmit
Change-Id: I401c38ba3fbc7b2a2de5cbc9ab1132c657518f32

Yang Sun   commited 2024-09-20 11:09:54 +08:00
9bf8e48c2a
[Thread] rename requestThreadNetwork to registerThreadNetworkCallback
Change-Id: I5d0c2e6b094fcd7e4175b7b2a2c4705ae2ad981d

Kangping Dong   commited 2024-09-12 05:44:56 +00:00
0ffdc107e7
Make java_sdk_library dependencies explicit
modules should specify the submodule of java_sdk_library that the module
actually depends on

Test: CI
Bug: 358613520
Change-Id: I0367068c901df98483f6cf95160d3e7801881b0a

Jihoon Kang   commited 2024-09-10 00:01:31 +00:00
8401b6a9f0
Introduce LoggingOtStatusReceiver for logging results of IOtDaemon methods
This is a refactor CL to get rid of two almost identical IOtStatusReceivers.

Bug: 362861470
Change-Id: Iae004eab0c6735359924ab0f6546e84d55d29ff7
Test: None

Handa Wang   commited 2024-09-02 08:05:47 +00:00
113dfaf43d
[Thread] Use SharedLog in ThreadNetworkService
This CL replaces all Log.i/e/w/d/wtf with SharedLog in ThreadNetworkService and its subcomponents.

Note that here are some necessary changes:
- Log.d() is changed to SharedLog.v()
- Only ERROR and WTF level of SharedLog supports Throwable. Some logging statements are changed slightly.

Bug: 351956873

Change-Id: I9c48381195fb3e96b7115ec2ebf229af048ea8de

Handa Wang   commited 2024-09-02 04:52:03 +00:00
2e397aebcd
[Thread] split the configuration and the infra link state
This CL works with the corresponding ot-br-posix CL to separate the
config and the infra link state. In this way,
ThreadNetworkControllerService will call different APIs to send the
config/state to ot-daemon.

Bug: 362172947

Change-Id: Iae98325358f81ea2ff0c672577cc21a128ae049a

Handa Wang   commited 2024-08-28 09:28:46 +00:00
989cc83c27
Merge "changes the API setChannelMaxPowers from hide API to system API" into main
Zhanglong Xia   authored and   Gerrit Code Review   commited 2024-08-26 14:03:50 +00:00
b5ddf3a056
[Thread] rename BorderRouterConfiguration to OtDaemonConfiguration
This is a no-op name refactoring CL to prepare for supporting Thread
in mobile use cases where Thread won't operate as a Border Router.

Flag: EXEMPT AIDL interface change (plus it just changes names)

Change-Id: Ib27bcb5b9cd5e9d04db720fde356be15e90068fa

Kangping Dong   commited 2024-08-26 08:27:35 +00:00
3c222a895a
changes the API setChannelMaxPowers from hide API to system API
This CL changes the hiden API `setChannelMaxPowers` to system API
to allow the privilege app to set the max power of each Thread channel.

Bug: b/346686506
Test: atest CtsThreadNetworkTestCases
Change-Id: I1089a4a315971c3bca8ec688a02143ddec93d039

Zhanglong Xia   commited 2024-08-26 10:07:36 +08:00
5bbfd91b04
[Thread] use immutable BorderRouterConfiguration
This CL refactors the code of ThreadNetworkControllerService to use
immutable BorderRouterConfiguration.

Bug: 358012289
Test: CI

Change-Id: Ifabf0144d5e8f5b5da2b8d64fc9e53c46f917dbb

Handa Wang   commited 2024-08-07 07:36:28 +00:00
ed24de9b64
Merge "[Thread] change the call to configureBorderRouter due to refactor" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-08-05 11:05:36 +00:00
65fd99a573
[Thread] change the call to configureBorderRouter due to refactor
Bug: 357501813
Test: CI

Change-Id: Ia6b63f59e927175d05a6d3da6cebe11491664071

Handa Wang   commited 2024-08-05 08:09:24 +00:00
7482055f9e
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