Commit graph android_packages_modules_Co.../thread
Message SHA1
Merge "[Thread] add CtsThreadNetworkTestCases to mcts-tethering" into main
Kangping Dong   authored and   Gerrit Code Review   commited 2024-02-28 09:10:55 +00:00
62046e57fe
Merge "[Thread] add Thread aconfig_declaration to java_sdk_library" into main
Kangping Dong   authored and   Gerrit Code Review   commited 2024-02-28 06:26:02 +00:00
22074a3efa
[Thread] add CtsThreadNetworkTestCases to mcts-tethering
Background: go/mcts-design

Bug: 327091762
Change-Id: I5c4f7c33579a84626bcc3f662b9658c646eefbf5

Kangping Dong   commited 2024-02-27 15:16:20 +08:00
44d0265efa
Merge "[Test] multicast forwarding from LLA/MLA address test" into main
Yang Sun   authored and   Gerrit Code Review   commited 2024-02-27 01:31:54 +00:00
bd447266b9
Merge "[Test] Thread multicast routing E2E test" into main
Yang Sun   authored and   Gerrit Code Review   commited 2024-02-27 01:29:34 +00:00
47d8b2ed38
[Thread] pre-grant all permissions for ThreadNetworkControllerServiceTest
Existing ThreadNetworkControllerService tests are using RunAsShell to
grant the permissions for indivitual APIs. Given the permission checks
are tested in the CTS tests, this is not very useful with the overhead
of complicating the testing code. Instead, this CL grants all the
permissions in setUp() with spy-ed Context.

This commit also fixes the issue in b/326793058 that the tests doesn't
run on a U device where the THREAD_NETWORK_PRIVILEGED permission doesn't
exist.

Bug: 326793058
Test: m ThreadNetworkUnitTests
Change-Id: I477cf30d737969ccf12180eae48d3b8fd6ed4a51

Kangping Dong   commited 2024-02-26 17:15:07 +08:00
a3c94d5273
[Test] multicast forwarding from LLA/MLA address test
Added E2E test cases to verify that packets from Thread network with
link-local/mesh-local source address to multicast group with scope
larger than realm-local are not forwarded to infra link.

Bug: 325770316

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

Yang Sun   commited 2024-02-26 13:25:28 +08:00
12074b5fad
[Test] Thread multicast routing E2E test
Added E2E test for Thread multicast routing.

Bug: 320616891

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

Change-Id: Icbaa9f6645080bd1a0a95ddc7902b9a468dd0088

Yang Sun   commited 2024-02-26 13:22:51 +08:00
e056b9a188
[Thread] add Thread aconfig_declaration to java_sdk_library
This commit also moves Thread flags to Connectivity/common to ease
maintenance.

Test: m framework-connectivity-t
Bug: 317290555
Merged-In: I50f3d3b8205a5a9ee8154a649318a2c175edbb71
Merged-In: I8a71f4ee49cc68a9512f432e454469200f2a5058
Change-Id: I8a71f4ee49cc68a9512f432e454469200f2a5058

Kangping Dong   commited 2024-02-26 11:18:03 +08:00
8fb80dd075
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] add aconfig_declarations for Thread module API flags
This is required to included Thread module APIs in DP2 release.
See ag/26286387

merged-in is used to stop the CL from being merged into U branches

Bug: 325886480
Merged-In: I1eed7982b40d28947aa3f9575c568eac325dc832
Merged-In: I79be1b48058ce6fb08149e18cdd7a5f5b0762769
Change-Id: I79be1b48058ce6fb08149e18cdd7a5f5b0762769

Kangping Dong   commited 2024-02-21 14:56:42 +00:00
ce69cd9459
[Thread] add MainlineModuleController for ThreadNetwotkUnitTests
Per comment in https://android-review.git.corp.google.com/c/platform/test/mts/+/2930711/comment/a88f14b1_a2fb9841/

Bug: 322142548
Change-Id: Id87c9f20be31cbead2062c08addc5995df143896

Kangping Dong   commited 2024-02-21 09:15:13 +00:00
9d2f1e8e9e
[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
Add a test case that a Border Router sends a UDP message to Thread device
This test case lets the BR send a UDP message to Thread device using
socket API and verify the message is received on the Thread device via
ot-ctl udp command.

For now this only verifies the direction BR -> ED because the other
direction ED -> BR is depending on platform UDP feature which is not
enabled yet.

Bug: 321168973
Test:  atest ThreadNetworkIntegrationTests:BorderRoutingTest#unicastRouting_borderRouterSendsUdpToThreadDevice_datagramReceived

Change-Id: I590583dd818f3d72dec41184e5427a8b08f842bb

Handa Wang   commited 2024-02-19 03:24:38 +00:00
b5c6ac2fe7
Merge "Set the container field of aconfig flags" into main
Oriol Prieto Gascó   authored and   Gerrit Code Review   commited 2024-02-06 00:38:23 +00:00
108a2d6360
[Thread] check too large error code in unit tests
Per CTS review comment in aosp/2949385:
```
You might want to make this a bit larger, otherwise if some new error codes are added in the future in a mainline update, already released CTS test packages will start to fail.

That should be fixed by mCTS, but since mCTS is not in place yet, it's best to be safe
```

This commit moves the too-large error code check into unit test to avoid
potential CTS compatibility issues.

Bug: 323791003
Change-Id: If99191630e1044cb8f5ed189bf79567cd51c3905

Kangping Dong   commited 2024-02-05 15:53:43 +08:00
54d62cee14
Merge "[Thread] add CTS tests for ThreadNetworkException" into main
Kangping Dong   authored and   Gerrit Code Review   commited 2024-02-04 09:58:33 +00:00
2fe1db6e49
[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
[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
Set the container field of aconfig flags
Test: m
Bug: 312769710
Change-Id: I1eed7982b40d28947aa3f9575c568eac325dc832

Oriol Prieto Gasco   commited 2024-02-03 02:39:14 +00:00
6eec17aa97
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
Merge "[Thread] add Thread tests to mts-tethering" into main
Kangping Dong   authored and   Gerrit Code Review   commited 2024-01-31 05:45:12 +00:00
6c728aa1fa
Merge "Pass buffer size to NetlinkUtils.netlinkSocketForProto" into main
Maciej Å»enczykowski   authored and   Gerrit Code Review   commited 2024-01-31 01:42:49 +00:00
2cb28ea360
Pass buffer size to NetlinkUtils.netlinkSocketForProto
Pass buffer size to netlinkSocketForProto to allow callers to specify
buffer size. The buffer size is not set if 0 is passed in.

Following callers of netlinkSocketForProto passes SOCKET_RECV_BUFFERSIZE
to keep same behavior as before:
 * OffloadHardwareInterface.createConntrackSocket()
 * NetlinkUtils.sendOneShotKernelMessage()
 * IpSecXfrmController.Dependencies.newNetlinkSocket()
 * InetDiagMessage.getConnectionOwnerUid()
Following callers pass 0 to not update the buffer size:
 * TunInterfaceController - it uses the socket only for writing
 * NetlinkUtils.createNetLinkInetDiagSocket() same behavior as before
Added a SOCKET_DUMP_RECV_BUFFERSIZE of 128k to be used by socket
requesting dump information from kernel:
 * NetlinkUtils.getAndProcessNetlinkDumpMessages() - sends dump request
   and expecting multiple reply messages.

Bug: 320420453

Test: atest NetworkStaticLibTests
atest FrameworksNetTests

Change-Id: I3dcb76963cf2646eb311602b50ab4e44b8ad3e8f

Yang Sun   commited 2024-01-30 21:54:48 +08:00
7934241c8f
Merge "Move the Thread proguard flags to ConnectivityService's proguard.flags" into main
Handa Wang   authored and   Gerrit Code Review   commited 2024-01-30 09:03:34 +00:00
96361bc4cd
Merge "[Thread] add ThreadNetworkIntegrationTests to mts-tethering" into main
Kangping Dong   authored and   Gerrit Code Review   commited 2024-01-29 12:08:06 +00:00
e2021fde0c
Merge "Update name threadnetwork.country_code in comments" into main
Zhanglong Xia   authored and   Gerrit Code Review   commited 2024-01-29 07:34:42 +00:00
1553c4d350
Merge "[Thread] tests a single ThreadNetworkController" into main
Kangping Dong   authored and   Gerrit Code Review   commited 2024-01-29 06:29:46 +00:00
9c712684b1
[Thread] tests a single ThreadNetworkController
Simplifies the CTS tests by testing only the first controller given
there is only one controller. No testing logic changes.

This commit also moves the helper methods to end of the file as they are
not the focus.

Bug: 321662734
Test: m CtsThreadNetworkTestCases
Change-Id: I4acf26e13ee112df2b7378b1005a1a14de4d783e

Kangping Dong   commited 2024-01-29 11:57:40 +08:00
44b8312033
Update name threadnetwork.country_code in comments
The properity `ro.boot.threadnetwork.country_code` has been renamed
to `threadnetwork.country_code` in aosp/2923770. This CL updates the
properity name in the comment.

Bug: b/309357909
Test: Run `atest ThreadNetworkUnitTests`.
Change-Id: I630f4d970452b17c3ee35fa8e9792ca907341ee8

Zhanglong Xia   commited 2024-01-29 11:13:47 +08:00
08bba8804a
[Thread] add Android.bp format to make-pretty.sh
There are sometimes gerrit warnings on Android.bp file format:
```
Analyzer Description: Formats Android.bp files.
Owner: soong-team@google.com

This file is not formatted.

Run prebuilts/build-tools/linux-x86/bin/bpfmt -w {filename} to format the file, or apply the suggested fix.
```

This commit adds the suggested format script to make-pretty.sh to avoid
the warning.

Change-Id: I8a691b1e6af873e8c43e34ed3168203d469eee1c

Kangping Dong   commited 2024-01-28 13:14:46 +08:00
c73dd5aa23
[Thread] add ThreadNetworkIntegrationTests to mts-tethering
Bug: 299853805
Change-Id: I567142a8bf8c735b65048d985e94d958a7feef03

Kangping Dong   commited 2024-01-28 13:10:52 +08:00
25bcfee4e3
Merge changes from topic "set-thread-enabled" into main
* changes:
  Add service implementation for ThreadNetworkController#setEnabled
  Add setEnabled API

Yang Sun   authored and   Gerrit Code Review   commited 2024-01-26 11:22:37 +00:00
8f9544539b
Move the Thread proguard flags to ConnectivityService's proguard.flags
We needed this proguard flag because
ThreadNetworkService#onLocalNetworkInfoChanged will otherwise be
stripped. We need to keep the method to ensure the border routing
feature works.

Initially we put the flag in thread/service/proguard.flags. However,
this seems not working on udc-mainline-prod branch. After moving it to
Connectivity/service/proguard.flags, it works as desired.

Bug: 313539492

Change-Id: I33cb0602095a617dbb1cfe3d9002f9c68e93cccf

Handa Wang   commited 2024-01-26 09:14:53 +00:00
cca941a232
Add service implementation for ThreadNetworkController#setEnabled
ThreadNetworkControllerService handles setEnabled requests and
asks ot-daemon to enable/disable Thread. The desired Thread enabled state
is saved in thread persistent setttings, the setting is loaded at bootup.

Bug: 299243765

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

Change-Id: Ifd0135433df25d9c6cfd3f365dd06ec7908268e7

Yang Sun   commited 2024-01-26 15:53:43 +08:00
625353b5bf
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
Check whether the WiFi country code is a valid Thread country code
The Thread country code should be a 2-Character alphabetical country
code. The `00` is an invalid country code for Thread country code,
but it is the default country code for WiFi country code. If setiting
the `00` as the Thread country code, the ThreadCountryCode throws
an exception.

This CL checks whether the country code is a valid Thread country
code before setting the WiFi country code as the Thread country code.

Bug: b/322404467
Test: atest ThreadNetworkUnitTests
Change-Id: Ic5fd69fc254ee25ad1e75e17096a5f5310a9140f

Zhanglong Xia   commited 2024-01-26 11:51:44 +08:00
a888e726b3
[Thread] add Thread tests to mts-tethering
Bug: 322142548
Change-Id: I71af1787b23be4c27d26b30498408631c2955012

Kangping Dong   commited 2024-01-25 18:05:10 +08:00
974d3ed761
Merge "Add OEM country code to Thread country code sources" into main
Kangping Dong   authored and   Gerrit Code Review   commited 2024-01-25 09:39:13 +00:00
869394241e
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] remove thread_user_restriction_enabled" into main
Kangping Dong   authored and   Gerrit Code Review   commited 2024-01-25 05:08:08 +00:00
670793d58e