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
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
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
This reverts commit a59a6e304b.
Reason for revert: this should not be added in the mainline module but in platform
Merged-In: I88c993680976d2e10d672bfdbf45119f2db13868
Change-Id: I680f23b5f8099b1ea4a316b768a56f1be5c78862
Creates the /dev/socket/ot-daemon/thread-wpan.sock socket from the
service init file. This is required for communication between ot-ctl
and ot-daemon service
Bug: 320451788
Test: verified that ot-daemon can create socket
/dev/socket/ot-daemon/thread-wpan.sock
Change-Id: Ib2111d67d2ce6726158f02a2cb2310c7ba9bf270
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
This is because the test case relies on **simulation** Thread radio, which is currently only available on CuttleFish.
Bug: 295843010
Test: atest android.net.thread.BorderRoutingTest
Change-Id: Icd29d91c9ec9912e27191e97fe7f58e9067c1d8c
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
To make sure that apps can register for Thread network by specifying
only TRANSPORT_THREAD.
This prevents regression given aosp/2873154 was considered a short-term
solution.
Bug: 313000440
Test: atest CtsThreadNetworkTestCases:android.net.thread.cts.ThreadNetworkControllerTest#threadNetworkCallback_deviceAttached_threadNetworkIsAvailable
Change-Id: I7860c50b092439f39e5d8c437de1863b0633b7a0
This is not required for code in the mainline module since the flag
infra is not supported for mainline. But we will need to write code
in UserManager and it needs to be guarded by new Thread flags.
Note that Merged-In is added to skip merging this CL into the
udc-mainline-prod branch because trunk stable flagging is not supported
there
Bug: 307679182
Test: m
Merged-In: I88c993680976d2e10d672bfdbf45119f2db13868
Change-Id: Id53fa3e7c9592b04f37f4cbd7dcd0499859e59ed
Currently requestThreadNetwork is called in registerThreadNetwork. This creates a new NetworkCallback for Thread every time when Thread is turned on. We'd better just use one callback to avoid potential issues.
Bug: 319179354
Change-Id: I96bad351f089b32a9acd919dea2e2b6b2aea68d2
We need to do initialization work and start OT daemon when
system_server boots. But the initialize() is called at the phase
PHASE_BOOT_COMPLETED which is too late as Apps (e.g. Google Play
Services) can be started before this phase.
This commit changes to start the Thread service earlier at the phase
PHASE_SYSTEM_SERVICES_READY. Other services such as Wi-Fi, Bluetooth,
Ethernet and Nearby all starts / initializes at this phase.
This commit resolves comment aosp/2737373/comment/d65b9446_8a08117c
Bug: 318787467
Test: atest CtsThreadNetworkTestCases
Change-Id: I7b7b8551b9114cbf07f995b64316c7b420d868b6
The ThreadPersistentSetting class can be used to read/store key value
pairs in ThreadPersistentSetting.xml file.
Bug: 299243765
Test: atest ThreadNetworkUnitTests:com.android.server.thread.ThreadPersistentSettingTest
Change-Id: I564ce8373e6af8f5cdf066a579bec46bfffecb72
Adds the Thread service unit test skeleton and make the services
testable.
Initially, a few trivial unit tests for existing APIs are added in
ThreadNetworkControllerServiceTest.java, and more tests will be added in
separate CLs later.
Bug: 317555104
Change-Id: I7b9e5f3663493d8da2448568de792e4272ee1df6
This CL adds resource overlay support to allow developers to
change the default configuration of using the location country code.
Bug: b/311324956
Test: Set the resource overlay in cuttlefish, check the default
configuration via the command `dumpsys thread_network`.
Change-Id: Ide853975e8244f06a382b2eda4844e030539b95d
This CL selects the Thread country code from location country code.
If the location country code is not avaliable, the country code `WW`
will be selected as the default Thread country code.
This CL also adds Shell commands for developers to override the Thread
country code for testing.
Bug: b/309357909
Test: Run `atest ThreadNetworkUnitTests`.
Change-Id: Id87c293005f0e75922a72854b40c41837b74397f
Context#enforceCallingPermission always throws SecurityException if we
are not processing a Binder IPC. This specifically doesn't work with
unit tests where the service APIs are called with mocked Binder
interfaces.
Bug: 317555104
Change-Id: I50be68487fb53907dbb1e3da7815fdf305047481
It's generally discouraged to mock a static method, so this commit
changes InfraInterfaceController#createIcmp6Socket to non-static method
and inject InfraInterfaceController into ThreadNetworkControllerService
as an external dependency.
Bug: 317555104
Change-Id: I6f88c02858279223684c781dc065a9bf84ae15ab
The duplicate entries make `CtsThreadNetworkTestCases` not included in presubmit. The `CtsThreadNetworkTestCases` was added in aosp/2804113 but was accidentally removed in aosp/2888526.
Bug: 317769267
Bug: 297729075
Test: presubmit
Change-Id: I184d21deddc0f0c247321a8d1afe5a8f8674f974
This implements a basic border routing test case (ping) and demonstrates a
valid test environment for Thread Border Router test cases.
Later we can add more packet verifications and more test cases.
Bug: 295843010
Test: atest android.net.ThreadBorderRouterTest
Change-Id: Ifb9b6d45539143a227c2bc0ed69b5c3167ef9acd
`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
framework-connectivity-flagged-apis-droidstubs is used by
jarjar-rules-generator to avoid jarjaring flagged apis.
But, this usage of --show-annotation FlaggedApi in the flag is not
supported.
So this CL removes --show-annotation FlaggedApi.
As far as framework-connectivity-flagged-apis-droidstubs contains
flagged APIs, it's fine that this droidstubs also contains non-flagged
APIs.
Test: TH
Bug: 312408311
Change-Id: I2f1f5624d98873420c0c36ac6e31386102211045
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
This CL lets ThreadNetworkControllerService calls the LocalNetworkConfig
API to set up border routing between Thread and infrastructure network.
Bug: 299552948
Bug: 305861411
Test: Verified on Cuttlefish that forwarding is set up.
Change-Id: I8b2f015d9d6248bfb1cd9ac806dc8664970a26d2