Snap for 13256841 from 9641ccdaa3c983b3bd07e29bd3f9de185f1b8eab to 25Q2-release Change-Id: I18c2b2de34d9d34354533bfb786d176ad6407eab
diff --git a/src/android/aidl/com/android/server/thread/openthread/OtDaemonConfiguration.aidl b/src/android/aidl/com/android/server/thread/openthread/OtDaemonConfiguration.aidl index 3cabd8d..bb31862 100644 --- a/src/android/aidl/com/android/server/thread/openthread/OtDaemonConfiguration.aidl +++ b/src/android/aidl/com/android/server/thread/openthread/OtDaemonConfiguration.aidl
@@ -54,4 +54,10 @@ * {@code true} if setting country code is enabled by OEM. */ boolean countryCodeEnabled = true; + + /** The vendor name which will be set to the Vendor Name TLV for diagnostic. */ + String vendorName; + + /** The model name which will be set to the Vendor Model TLV for diagnostic. */ + String modelName; }
diff --git a/src/android/android_rcp_host.cpp b/src/android/android_rcp_host.cpp index 4c81e98..0460dc8 100644 --- a/src/android/android_rcp_host.cpp +++ b/src/android/android_rcp_host.cpp
@@ -40,6 +40,7 @@ #include <openthread/dnssd_server.h> #include <openthread/ip6.h> #include <openthread/nat64.h> +#include <openthread/netdiag.h> #include <openthread/openthread-system.h> #include <openthread/srp_server.h> #include <openthread/thread.h> @@ -78,6 +79,11 @@ VerifyOrExit(GetOtInstance() != nullptr, error = OT_ERROR_INVALID_STATE, message = "OT is not initialized"); + SuccessOrExit(error = otThreadSetVendorName(GetOtInstance(), aConfiguration.vendorName.c_str()), + message = "Invalid vendor name " + aConfiguration.vendorName); + SuccessOrExit(error = otThreadSetVendorModel(GetOtInstance(), aConfiguration.modelName.c_str()), + message = "Invalid model name " + aConfiguration.modelName); + // TODO: b/343814054 - Support enabling/disabling DHCPv6-PD. VerifyOrExit(!aConfiguration.dhcpv6PdEnabled, error = OT_ERROR_NOT_IMPLEMENTED, message = "DHCPv6-PD is not supported");
diff --git a/src/android/java/com/android/server/thread/openthread/testing/FakeOtDaemon.java b/src/android/java/com/android/server/thread/openthread/testing/FakeOtDaemon.java index 0b5e737..901f705 100644 --- a/src/android/java/com/android/server/thread/openthread/testing/FakeOtDaemon.java +++ b/src/android/java/com/android/server/thread/openthread/testing/FakeOtDaemon.java
@@ -89,6 +89,7 @@ @Nullable private IOtDaemonCallback mCallback; @Nullable private Long mCallbackListenerId; @Nullable private RemoteException mJoinException; + @Nullable private String mNat64Cidr; @Nullable private RemoteException mSetNat64CidrException; @Nullable private RemoteException mRunOtCtlCommandException; @Nullable private String mCountryCode; @@ -434,11 +435,18 @@ if (mSetNat64CidrException != null) { throw mSetNat64CidrException; } + mNat64Cidr = nat64Cidr; if (receiver != null) { receiver.onSuccess(); } } + /** Returns the NAT64 CIDR set by {@link #setNat64Cidr}. */ + @Nullable + public String getNat64Cidr() { + return mNat64Cidr; + } + @Override public void setInfraLinkDnsServers(List<String> dnsServers, IOtStatusReceiver receiver) throws RemoteException {
diff --git a/tests/android/java/com/android/server/thread/openthread/testing/FakeOtDaemonTest.java b/tests/android/java/com/android/server/thread/openthread/testing/FakeOtDaemonTest.java index 6bb72cd..1ebaf0f 100644 --- a/tests/android/java/com/android/server/thread/openthread/testing/FakeOtDaemonTest.java +++ b/tests/android/java/com/android/server/thread/openthread/testing/FakeOtDaemonTest.java
@@ -318,12 +318,13 @@ } @Test - public void setNat64Cidr_onSuccessIsInvoked() throws Exception { + public void setNat64Cidr_valueSavedAndOnSuccessIsInvoked() throws Exception { IOtStatusReceiver receiver = mock(IOtStatusReceiver.class); mFakeOtDaemon.setNat64Cidr(TEST_NAT64_CIDR, receiver); mTestLooper.dispatchAll(); + assertThat(mFakeOtDaemon.getNat64Cidr()).isEqualTo(TEST_NAT64_CIDR); verify(receiver, never()).onError(anyInt(), any()); verify(receiver, times(1)).onSuccess(); }