Commit graph android_packages_modules_Co.../thread/framework
Message SHA1
[Thread] Mark ThreadConfiguration#isDhcpv6PdEnabled() as @hide
This CL marks ThreadConfiguration#isDhcpv6PdEnabled() as @hide because
there's no way yet to set it as enabled. When PD is implemented, we'll
expose this API as System API.

Bug: 342519412

Change-Id: I6b8f7b83bd01c0ba045c777e6f613bc4a74d9dfb

Handa Wang   commited 2024-10-22 07:33:00 +00:00
7616fdd777
Remove the check for epskc flag value at runtime.
This blocks local testing as the flag is read-only.

Change-Id: I891ef2d61dbb1ecccde7b89081899afb7155dd2f

Yang Sun   commited 2024-10-15 07:08:11 +00:00
eab97a0552
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 changes from topic "thread-set-configuration" into main
* changes:
  [Thread] make ThreadNetworkController#setConfiguration a system API
  [Thread] implement the ThreadNetworkController#setConfiguration at service

Handa Wang   authored and   Gerrit Code Review   commited 2024-10-10 10:37:47 +00:00
fd2a145513
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] make ThreadNetworkController#setConfiguration a system API
This CL turns setConfiguration into a system API, including the
ThreadConfiguration#Builder
and the #setNat64Enabled method.

Bug: 368456504

Change-Id: I0ff2ed81271dcceea295d169a46a02f05aeda5d6

Handa Wang   commited 2024-10-10 05:36:11 +00:00
651bfdaaf7
[javadoc] add missing space
Bug: 348323500
Test: presubmit

Change-Id: Iacad7bd2537108425cc9dedcfdd3eeef7f9765b8

Yang Sun   commited 2024-10-08 06:01:05 +00:00
34e9836b26
[Thread][API] add API for ephemeral key.
This CL adds the API for starting/stopping the ephemeral key mode, and
subscribing to the ephemeral key state changes.

Ephemeral key mode is started with a limit amount of time to allow
Thread credential sharing.

Bug: 348323500
Test: atest CtsThreadNetworkTestCases
Change-Id: I540c88ec4668291358fbe87a678d8f9d31a67e54

Yang Sun   commited 2024-09-29 02:35:44 +00:00
b8aa8bb47f
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
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
Format the code in ThreadNetworkController.java
Change-Id: I3471f53396afb12768aa279a1ab059ffbfd8671e

Yang Sun   commited 2024-09-19 10:15:51 +00:00
75a6bf3958
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
Use java_aconfig_library for nearby and thread flags
Connectivity repo now can use java_aconfig_library since this target is
available on all downstream branches.

Bug: 345121279
Test: TH
Change-Id: I6d267ddac89731a8efbef2ee98a3baa1df754ff5

Motomu Utsumi   commited 2024-08-16 16:59:08 +09:00
dbb82c0581
[Thread] format AIDL files
Change-Id: Ic822710af1790a946bff838429cb98d2c6c3eef9

Handa Wang   commited 2024-08-12 06:22:01 +00:00
396db6050c
[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
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
[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] 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
[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] 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
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
[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
[Thread] add CTS tests for ThreadNetworkException
Bug: 323464130
Test: presubmit
Change-Id: I67bde1506e99b42ff3806254aa8bbc6c98792e3e

Kangping Dong   commited 2024-02-04 12:58:10 +08:00
86a70b4992
[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
Add setEnabled API
setEnabled API is added to ThreadNetworkController, this
can be used by applications with privileged permission to set
Thread to enable/disabled state.

The Thread enabled state can be subscribed with
ThreadNetworkController#registerStateCallback.

When Thread is disabled, the join/scheduleMigration APIs will
fail with ERROR_THREAD_DISABLED.

When Thread is disabling, all commands will fail with ERROR_BUSY.

Bug: 299243765

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

Change-Id: Ifa7845bf1d5664ecd31ce74e24b3a839f92bba13

Yang Sun   commited 2024-01-26 15:53:33 +08:00
0797d9d501
Add OEM country code to Thread country code sources
Bug: b/309357909
Test: Run `atest ThreadNetworkUnitTests`.
Change-Id: Ic3c9ef69fc77c44a50f6dc856e1af26c43be1aa2

Zhanglong Xia   commited 2024-01-25 16:08:04 +08:00
5c0d8a6603
Merge "[Thread] add error code ERROR_UNKNOWN for forward compatibility" into main
Kangping Dong   authored and   Gerrit Code Review   commited 2024-01-24 02:20:42 +00:00
649571ddf7
Make ThreadNetworkController.setTestNetworkAsUpstream require NETWORK_SETTINGS permission
This CL contains following enhancements:

- Enforce NETWORK_SETTINGS permission for ThreadNetworkController.setTestNetworkAsUpstream.
- Move the setTestNetworkAsUpstream in
  ThreadNetworkControllerService to make the order of methods more
logical.
- Update the test case name in BorderRoutingTest.

Bug: 295843010
Bug: 320842152

Change-Id: I82edac6c819dd637f4c98f31368a1b520338ce24

Handa Wang   commited 2024-01-19 08:15:58 +00:00
253b3fb6da
[Thread] add error code ERROR_UNKNOWN for forward compatibility
This is per the go/android-api-guidelines#return-error:
```
Make sure your chosen error handling option gives you the
flexibility to introduce new error types in the future. For
@IntDef, that means including an OTHER or UNKNOWN value - when
returning a new code, you can check the caller's targetSdkVersion
to avoid returning an error code the application doesn't know
about. For exceptions, have a common superclass that your
exceptions implement, so that any code that handles that type will
also catch and handle subtypes.
```

Bug: 320403080
Change-Id: I2ee663b75107dac6d84fa697f449fa0424128fde

Kangping Dong   commited 2024-01-16 16:07:53 +08:00
2c83e2fcc9
add hidden method setTestNetworkAsUpstream
`setTestNetworkAsUpstream` allows to specify a test network as the upstream of Thread network. This is going to be used in Thread integration tests. E.g. android.net.thread.BorderRoutingTest.

Bug: 295843010
Test: atest android.net.thread.BorderRoutingTest

Change-Id: I66474e2aa5b3434c4c66078a1d6bd6e522e32ae5

Handa Wang   commited 2023-12-25 16:47:23 +08:00
198a3d495a
[Thread] clear calling identity before invoking app-supplied callback
Per API council feedback and API guideline at
go/android-api-guidelines#provide-executor, it should call
Binder.clearCallingIdentity() before invoking the app-supplied callbacks
so that the app doesn't use the system-server's identity for permission
check in the callback.

Bug: 309952666
Test: atest ThreadNetworkUnitTests
Change-Id: I3cfbce29c0a516506bb76a44b151a583c8477806

Kangping Dong   commited 2023-11-22 01:54:34 +00:00
98015f3373
Merge "[Thread] add documentation for Delay Timer of Pending Dataset" into main
Kangping Dong   authored and   Gerrit Code Review   commited 2023-11-15 04:29:03 +00:00
d9fe1c5eae
[Thread] add @RequiresPermissions for unregisterXxxCallback APIs
Per API council review suggestions in b/309952666, add the same
permission requirements for the unregister APIs.

Bug: 309952666
Test: atest CtsThreadNetworkTestCases
Change-Id: Idc481c7676ddc5d748fe7803f74dd63981186c09

Kangping Dong   commited 2023-11-13 17:29:07 +08:00
8e44412f7c
[Thread] add documentation for Delay Timer of Pending Dataset
Make it clear that Duration#ZERO is used for automatically selecting a
reasonable value by the system.

Bug: 307939803
Test: atest CtsThreadNetworkTestCases
Change-Id: I880dca187902464fbe45ed6f2a64e9f88a5493ab

Kangping Dong   commited 2023-11-09 18:31:01 +08:00
d8c30214b8
Merge "[Thread] add documentation for Pending Dataset constructor" into main
Kangping Dong   authored and   Gerrit Code Review   commited 2023-11-09 02:55:16 +00:00
ac94d2cec6
[Thread] add documentation for Pending Dataset constructor
Per API council review feedback in b/307939803

Bug: 307939803
Test: atest CtsThreadNetworkTestCases
Change-Id: Ia5fbb38e24d09c4a8d95ce0dfd6058a65d5d4614

Kangping Dong   commited 2023-11-09 02:55:53 +08:00
a925218c4f
[Thread] move createRandomDataset to ThreadNetworkController
This commit renames `createRandomDataset` to `createRandomizedDataset`
and moves this method to ThreadNetworkController class.

The reason for moving this method is that we rely on the service side to
know which channels are currently supported by this device and there is
no safe way for ActiveOperationalDataset to created a randomized full
dataset by its own. Moving this method to ThreadNetworkController also
allows us to support future platform-dependend configurations.

Bug: 308117328
Bug: 307939803
Change-Id: I0b0b7b727c3b326ab59bb1299ace15df1ff1ad5e

Kangping Dong   commited 2023-11-08 22:39:33 +08:00
af4f1f576c
[Thread] add ThreadNetworkController APIs
The ThreadNetworkController class provides APIs for managing the Thread
network, for example, attach to a specific network, form a network with
given dataset or update/migrate an existing network.

Bug: 262683651
Test: atest CtsThreadNetworkTestCases
Change-Id: Ib3c267d2c81a8c3c7772ed3c9cd2092487cc941a

Kangping Dong   commited 2023-11-08 17:56:16 +08:00
b1c75dbe8c
Merge "[Thread] fix OperationalDatasetTimestamp#toTlvValue is not loss-less" into main
Kangping Dong   authored and   Gerrit Code Review   commited 2023-11-07 19:20:44 +00:00
9efc28e6d0
[Thread] fix OperationalDatasetTimestamp#toTlvValue is not loss-less
OperationalDatasetTimestamp is saving the timestamp as an Instant
object, and this has the problem that when the dataset timestamp is
written to a TLV, it's going to loss precision as the nanoseconds
of the Instant is converted to "Ticks". This results in bug that
the dataset timestamp doesn't equal to the same value when it's
converted back from a TLV:

```
var timestamp1 = OperationalDatasetTimestamp.fromInstant(Instant.ofEpochSecond(100, 999938900));
byte[] tlv = timestamp1.toTlvValue();
timestamp2 = OperationalDatasetTimestamp.fromTlvValue(tlv);

assertThat(timestamp2).isEqualTo(timestamp1); // This fails!!!
```

Bug: 308408536
Test: atest ThreadNetworkUnitTests CtsThreadNetworkTestCases
Change-Id: I81b482a05337b6d1150edaa28b860034592a4347

Kangping Dong   commited 2023-11-07 13:13:06 +08:00
160b4d38f9
[Thread] add a script for make-pretty
This make-pretty.sh can be called from any where and it formats only
java code under packages/modules/Connectivity/thread/

Test: ./thread/scripts/make-pretty.sh
Change-Id: I1b24025cf0267c81a7b133d1e8a08f77cc7ddc0e

Kangping Dong   commited 2023-11-07 12:41:42 +08:00
7dffade561
[Thread] make the Manager and Controller class 'final'
Per the API review council, the classes should be "final" by default

Bug: 301076593
Test: build && atest CtsThreadNetworkTestCases
Change-Id: I85f0b4fabe5b1bcec2be052620b38a07c58181d7

Kangping Dong   commited 2023-10-25 22:03:11 +08:00
5e1d430d33
[Thread] add Thread Operational Dataset API
Design doc: go/thread-android-api
Android FR: b/235016403

Bug: 262683651
Change-Id: Icbd4ee4150e3fd78df627c2e726c259e7ee50871

Kangping Dong   commited 2023-10-25 18:13:07 +08:00
7fea5fa6a2
[Thread] flagging Android Thread APIs
This commit declares the initial "thread_enabled" feature flag and use
this to flag all existing and future Thread system APIs with @FlaggedApi

Bug: 301473012
Test: build
Change-Id: I43f64ce38f7fd0806733b21c4f393e4563e6a467

Kangping Dong   commited 2023-10-24 19:45:04 +08:00
75aa485604
[Thread] initial Thread network service
This commit sets up the initial Thread network service for the
Android Thread feature which allows an Android device to create
a Thread network and being a Border Router.

See https://www.threadgroup.org/What-is-Thread for background of
Thread.

See b/235016403 for the Android Thread feature request.

Test: lunch aosp_cf_x86_64_tv-userdebug
      m && launch_cvd
      atest CtsThreadNetworkTestCases
Bug: 262683651
Change-Id: Ie1bb23084531f67165ec068ea3ca39592dbc01d1

Kangping Dong   commited 2023-09-12 21:48:57 +08:00
1cec48f3c0
[Thread] move Thread into com.android.tethering
Bug: 296211911
Change-Id: Ifd4f7cd06f1aeaba739d27d2328e89031ca73235

Kangping Dong   commited 2023-08-23 14:28:50 +08:00
e7fef8938a