Merge "[Thread] allow disabling SRP server wait for border routing" into main
This commit is contained in:
commit
7b7ff96c29
4 changed files with 20 additions and 2 deletions
|
|
@ -71,4 +71,12 @@
|
|||
-->
|
||||
<string-array name="config_thread_mdns_vendor_specific_txts">
|
||||
</string-array>
|
||||
|
||||
<!-- Whether to enable / start SRP server only when border routing is ready. SRP server and
|
||||
border routing are mandatory features required by a Thread Border Router, and it takes 10 to
|
||||
20 seconds to establish border routing. Starting SRP server earlier is useful for use cases
|
||||
where the user needs to know what are the devices in the network before actually needs to reach
|
||||
to the devices, or reaching to Thread end devices doesn't require border routing to work.
|
||||
-->
|
||||
<bool name="config_thread_srp_server_wait_for_border_routing_enabled">true</bool>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@
|
|||
<item type="string" name="config_thread_vendor_oui" />
|
||||
<item type="string" name="config_thread_model_name" />
|
||||
<item type="array" name="config_thread_mdns_vendor_specific_txts" />
|
||||
<item type="bool" name="config_thread_srp_server_wait_for_border_routing_enabled" />
|
||||
</policy>
|
||||
</overlayable>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -623,12 +623,14 @@ final class ThreadNetworkControllerService extends IThreadNetworkController.Stub
|
|||
mNat64CidrController.maybeUpdateNat64Cidr();
|
||||
}
|
||||
|
||||
private static OtDaemonConfiguration newOtDaemonConfig(
|
||||
@NonNull ThreadConfiguration threadConfig) {
|
||||
private OtDaemonConfiguration newOtDaemonConfig(ThreadConfiguration threadConfig) {
|
||||
int srpServerConfig = R.bool.config_thread_srp_server_wait_for_border_routing_enabled;
|
||||
boolean srpServerWaitEnabled = mResources.get().getBoolean(srpServerConfig);
|
||||
return new OtDaemonConfiguration.Builder()
|
||||
.setBorderRouterEnabled(threadConfig.isBorderRouterEnabled())
|
||||
.setNat64Enabled(threadConfig.isNat64Enabled())
|
||||
.setDhcpv6PdEnabled(threadConfig.isDhcpv6PdEnabled())
|
||||
.setSrpServerWaitForBorderRoutingEnabled(srpServerWaitEnabled)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -231,6 +231,9 @@ public final class ThreadNetworkControllerServiceTest {
|
|||
|
||||
when(mConnectivityResources.get()).thenReturn(mResources);
|
||||
when(mResources.getBoolean(eq(R.bool.config_thread_default_enabled))).thenReturn(true);
|
||||
when(mResources.getBoolean(
|
||||
eq(R.bool.config_thread_srp_server_wait_for_border_routing_enabled)))
|
||||
.thenReturn(true);
|
||||
when(mResources.getString(eq(R.string.config_thread_vendor_name)))
|
||||
.thenReturn(TEST_VENDOR_NAME);
|
||||
when(mResources.getString(eq(R.string.config_thread_vendor_oui)))
|
||||
|
|
@ -285,6 +288,9 @@ public final class ThreadNetworkControllerServiceTest {
|
|||
|
||||
@Test
|
||||
public void initialize_resourceOverlayValuesAreSetToOtDaemon() throws Exception {
|
||||
when(mResources.getBoolean(
|
||||
eq(R.bool.config_thread_srp_server_wait_for_border_routing_enabled)))
|
||||
.thenReturn(false);
|
||||
when(mResources.getString(eq(R.string.config_thread_vendor_name)))
|
||||
.thenReturn(TEST_VENDOR_NAME);
|
||||
when(mResources.getString(eq(R.string.config_thread_vendor_oui)))
|
||||
|
|
@ -297,6 +303,7 @@ public final class ThreadNetworkControllerServiceTest {
|
|||
mService.initialize();
|
||||
mTestLooper.dispatchAll();
|
||||
|
||||
assertThat(mFakeOtDaemon.getConfiguration().srpServerWaitForBorderRoutingEnabled).isFalse();
|
||||
MeshcopTxtAttributes meshcopTxts = mFakeOtDaemon.getOverriddenMeshcopTxtAttributes();
|
||||
assertThat(meshcopTxts.vendorName).isEqualTo(TEST_VENDOR_NAME);
|
||||
assertThat(meshcopTxts.vendorOui).isEqualTo(TEST_VENDOR_OUI_BYTES);
|
||||
|
|
|
|||
Loading…
Reference in a new issue