libnetdutils: Remove dependency on libbinder
Turns out asBinderStatus() is presently used only in NetdNativeService,
so we can just move it there. This lets us drop the dependency on
libbinder.
Test: atest libnetdutils netd_unit_test
Change-Id: If24a14b881326ec74880ea411973d0acc6ef5ff1
diff --git a/server/NetdNativeService.cpp b/server/NetdNativeService.cpp
index cafb90e..09b7efc 100644
--- a/server/NetdNativeService.cpp
+++ b/server/NetdNativeService.cpp
@@ -104,6 +104,13 @@
#define NETD_BIG_LOCK_RPC(permission) NETD_LOCKING_RPC((permission), gBigNetdLock)
+binder::Status asBinderStatus(const netdutils::Status& status) {
+ if (isOk(status)) {
+ return binder::Status::ok();
+ }
+ return binder::Status::fromServiceSpecificError(status.code(), status.msg().c_str());
+}
+
inline binder::Status statusFromErrcode(int ret) {
if (ret) {
return binder::Status::fromServiceSpecificError(-ret, strerror(-ret));