diff --git a/service/ServiceConnectivityResources/res/values/config_thread.xml b/service/ServiceConnectivityResources/res/values/config_thread.xml index 40270388ad..3627157f0a 100644 --- a/service/ServiceConnectivityResources/res/values/config_thread.xml +++ b/service/ServiceConnectivityResources/res/values/config_thread.xml @@ -71,4 +71,12 @@ --> + + + true diff --git a/service/ServiceConnectivityResources/res/values/overlayable.xml b/service/ServiceConnectivityResources/res/values/overlayable.xml index fbaae05361..121cbc4826 100644 --- a/service/ServiceConnectivityResources/res/values/overlayable.xml +++ b/service/ServiceConnectivityResources/res/values/overlayable.xml @@ -52,6 +52,7 @@ + diff --git a/thread/service/java/com/android/server/thread/ThreadNetworkControllerService.java b/thread/service/java/com/android/server/thread/ThreadNetworkControllerService.java index c55096b1b4..c2959f4d8c 100644 --- a/thread/service/java/com/android/server/thread/ThreadNetworkControllerService.java +++ b/thread/service/java/com/android/server/thread/ThreadNetworkControllerService.java @@ -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(); } diff --git a/thread/tests/unit/src/com/android/server/thread/ThreadNetworkControllerServiceTest.java b/thread/tests/unit/src/com/android/server/thread/ThreadNetworkControllerServiceTest.java index dcbb3f51e0..1d44ccb0bd 100644 --- a/thread/tests/unit/src/com/android/server/thread/ThreadNetworkControllerServiceTest.java +++ b/thread/tests/unit/src/com/android/server/thread/ThreadNetworkControllerServiceTest.java @@ -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);