aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-10-28 12:08:19 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-10-28 12:08:19 +0000
commit8edd609fe8be7755a5358b0d22499d8c201d4b6e (patch)
tree008073c2f9de3d168c6cd1809816c02b6015a2a2
parent83e7b35adb0242fc06795c688901e19d2b3c738e (diff)
parent4ec6611993bc97c9a9c1151a5bb77cff62134920 (diff)
downloadot-br-posix-android14-mainline-media-release.tar.gz
Snap for 11018792 from 4ec6611993bc97c9a9c1151a5bb77cff62134920 to mainline-media-releaseaml_med_341312300aml_med_341312020android14-mainline-media-release
Change-Id: I95bdbfe3930fdf56d91f0dece5b6251d8f8fa3dd
-rw-r--r--src/android/aidl/com/android/server/thread/openthread/IOtDaemon.aidl18
-rw-r--r--src/android/otdaemon_server.cpp30
-rw-r--r--src/android/otdaemon_server.hpp12
3 files changed, 30 insertions, 30 deletions
diff --git a/src/android/aidl/com/android/server/thread/openthread/IOtDaemon.aidl b/src/android/aidl/com/android/server/thread/openthread/IOtDaemon.aidl
index b6b7442a..f24fd7f2 100644
--- a/src/android/aidl/com/android/server/thread/openthread/IOtDaemon.aidl
+++ b/src/android/aidl/com/android/server/thread/openthread/IOtDaemon.aidl
@@ -64,26 +64,26 @@ interface IOtDaemon {
int getThreadVersion();
/**
- * Attaches this device to the network specified by {@code activeOpDatasetTlvs}.
+ * Joins this device to the network specified by {@code activeOpDatasetTlvs}.
*
- * @sa android.net.thread.ThreadNetworkController#attach
- * @sa android.net.thread.ThreadNetworkController#attachOrForm
+ * @sa android.net.thread.ThreadNetworkController#join
*/
- oneway void attach(
+ oneway void join(
boolean doForm, in byte[] activeOpDatasetTlvs, in IOtStatusReceiver receiver);
/**
- * Detaches from the current network.
+ * Leaves from the current network.
*
- * 1. It returns success immediately if this device is already detached or disabled
- * 2. Else if there is already an onging {@code detach} request, no action will be taken but
+ * 1. It returns success immediately if this device has already left or disabled
+ * 2. Else if there is already an onging {@code join} request, no action will be taken but
* the {@code receiver} will be invoked after the previous request is completed
* 3. Otherwise, OTBR sends Address Release Notification (i.e. ADDR_REL.ntf) to grcefully
* detach from the current network and it takes 1 second to finish
+ * 4. The Operational Dataset will be removed from persistent storage
*
- * @sa android.net.thread.ThreadNetworkController#detach
+ * @sa android.net.thread.ThreadNetworkController#leave
*/
- oneway void detach(in IOtStatusReceiver receiver);
+ oneway void leave(in IOtStatusReceiver receiver);
/** Migrates to the new network specified by {@code pendingOpDatasetTlvs}.
*
diff --git a/src/android/otdaemon_server.cpp b/src/android/otdaemon_server.cpp
index fc14e9cb..bad693a3 100644
--- a/src/android/otdaemon_server.cpp
+++ b/src/android/otdaemon_server.cpp
@@ -135,11 +135,11 @@ void OtDaemonServer::StateCallback(otChangedFlags aFlags)
if (!isAttached())
{
- for (const auto &detachCallback : mOngoingDetachCallbacks)
+ for (const auto &leaveCallback : mOngoingLeaveCallbacks)
{
- detachCallback();
+ leaveCallback();
}
- mOngoingDetachCallbacks.clear();
+ mOngoingLeaveCallbacks.clear();
}
}
@@ -319,21 +319,21 @@ Status OtDaemonServer::initialize(const ScopedFileDescriptor &aTun
return Status::ok();
}
-Status OtDaemonServer::attach(bool aDoForm,
- const std::vector<uint8_t> &aActiveOpDatasetTlvs,
- const std::shared_ptr<IOtStatusReceiver> &aReceiver)
+Status OtDaemonServer::join(bool aDoForm,
+ const std::vector<uint8_t> &aActiveOpDatasetTlvs,
+ const std::shared_ptr<IOtStatusReceiver> &aReceiver)
{
otError error = OT_ERROR_NONE;
std::string message;
otOperationalDatasetTlvs datasetTlvs;
- // TODO(b/273160198): check how we can implement attach-only behavior
+ // TODO(b/273160198): check how we can implement join as a child
(void)aDoForm;
- otbrLogInfo("Start attaching...");
+ otbrLogInfo("Start joining...");
VerifyOrExit(GetOtInstance() != nullptr, error = OT_ERROR_INVALID_STATE, message = "OT is not initialized");
- VerifyOrExit(!isAttached(), error = OT_ERROR_INVALID_STATE, message = "Cannot attach when already attached");
+ VerifyOrExit(!isAttached(), error = OT_ERROR_INVALID_STATE, message = "Cannot join when already attached");
std::copy(aActiveOpDatasetTlvs.begin(), aActiveOpDatasetTlvs.end(), datasetTlvs.mTlvs);
datasetTlvs.mLength = aActiveOpDatasetTlvs.size();
@@ -353,7 +353,7 @@ void OtDaemonServer::detachGracefully(const DetachCallback &aCallback)
{
otError error;
- mOngoingDetachCallbacks.push_back(aCallback);
+ mOngoingLeaveCallbacks.push_back(aCallback);
// The callback is already guarded by a timer inside OT, so the client side shouldn't need to
// add a callback again.
@@ -361,14 +361,14 @@ void OtDaemonServer::detachGracefully(const DetachCallback &aCallback)
if (error == OT_ERROR_BUSY)
{
// There is already an ongoing detach request, do nothing but enqueue the callback
- otbrLogDebug("Reuse existing detach() request");
+ otbrLogDebug("Reuse existing detach request");
ExitNow(error = OT_ERROR_NONE);
}
exit:;
}
-Status OtDaemonServer::detach(const std::shared_ptr<IOtStatusReceiver> &aReceiver)
+Status OtDaemonServer::leave(const std::shared_ptr<IOtStatusReceiver> &aReceiver)
{
if (GetOtInstance() == nullptr)
{
@@ -391,11 +391,11 @@ void OtDaemonServer::DetachGracefullyCallback(void *aBinderServer)
{
OtDaemonServer *thisServer = static_cast<OtDaemonServer *>(aBinderServer);
- for (auto callback : thisServer->mOngoingDetachCallbacks)
+ for (auto callback : thisServer->mOngoingLeaveCallbacks)
{
callback();
}
- thisServer->mOngoingDetachCallbacks.clear();
+ thisServer->mOngoingLeaveCallbacks.clear();
}
bool OtDaemonServer::isAttached()
@@ -485,7 +485,7 @@ exit:
return status;
}
-binder_status_t OtDaemonServer::dump(int aFd, const char** aArgs, uint32_t aNumArgs)
+binder_status_t OtDaemonServer::dump(int aFd, const char **aArgs, uint32_t aNumArgs)
{
OT_UNUSED_VARIABLE(aArgs);
OT_UNUSED_VARIABLE(aNumArgs);
diff --git a/src/android/otdaemon_server.hpp b/src/android/otdaemon_server.hpp
index 3f6ff8ff..b339dc6b 100644
--- a/src/android/otdaemon_server.hpp
+++ b/src/android/otdaemon_server.hpp
@@ -63,7 +63,7 @@ public:
void operator=(const OtDaemonServer &) = delete;
// Dump information for debugging.
- binder_status_t dump(int aFd, const char** aArgs, uint32_t aNumArgs) override;
+ binder_status_t dump(int aFd, const char **aArgs, uint32_t aNumArgs) override;
private:
using DetachCallback = std::function<void()>;
@@ -85,10 +85,10 @@ private:
Status getExtendedMacAddress(std::vector<uint8_t> *aExtendedMacAddress) override;
Status getThreadVersion(int *aThreadVersion) override;
bool isAttached(void);
- Status attach(bool aDoForm,
- const std::vector<uint8_t> &aActiveOpDatasetTlvs,
- const std::shared_ptr<IOtStatusReceiver> &aReceiver) override;
- Status detach(const std::shared_ptr<IOtStatusReceiver> &aReceiver) override;
+ Status join(bool aDoForm,
+ const std::vector<uint8_t> &aActiveOpDatasetTlvs,
+ const std::shared_ptr<IOtStatusReceiver> &aReceiver) override;
+ Status leave(const std::shared_ptr<IOtStatusReceiver> &aReceiver) override;
void detachGracefully(const DetachCallback &aCallback);
Status scheduleMigration(const std::vector<uint8_t> &aPendingOpDatasetTlvs,
const std::shared_ptr<IOtStatusReceiver> &aReceiver) override;
@@ -106,7 +106,7 @@ private:
ScopedFileDescriptor mTunFd;
std::shared_ptr<IOtDaemonCallback> mCallback;
BinderDeathRecipient mClientDeathRecipient;
- std::vector<DetachCallback> mOngoingDetachCallbacks;
+ std::vector<DetachCallback> mOngoingLeaveCallbacks;
};
} // namespace Android