Binder: Split OS to Android and Unix part, abstract GetThreadId out
Bug: 302723053
Test: mma in binder folder
Test: aosp/2616196
Change-Id: I73df8fc453df0edf496960853cb0004f1c3a6a43
diff --git a/libs/binder/RpcServer.cpp b/libs/binder/RpcServer.cpp
index 55fc16d..354a4b3 100644
--- a/libs/binder/RpcServer.cpp
+++ b/libs/binder/RpcServer.cpp
@@ -57,7 +57,7 @@
sp<RpcServer> RpcServer::make(std::unique_ptr<RpcTransportCtxFactory> rpcTransportCtxFactory) {
// Default is without TLS.
if (rpcTransportCtxFactory == nullptr)
- rpcTransportCtxFactory = makeDefaultRpcTransportCtxFactory();
+ rpcTransportCtxFactory = binder::os::makeDefaultRpcTransportCtxFactory();
auto ctx = rpcTransportCtxFactory->newServerCtx();
if (ctx == nullptr) return nullptr;
return sp<RpcServer>::make(std::move(ctx));
@@ -216,7 +216,7 @@
iovec iov{&zero, sizeof(zero)};
std::vector<std::variant<base::unique_fd, base::borrowed_fd>> fds;
- ssize_t num_bytes = receiveMessageFromSocket(server.mServer, &iov, 1, &fds);
+ ssize_t num_bytes = binder::os::receiveMessageFromSocket(server.mServer, &iov, 1, &fds);
if (num_bytes < 0) {
int savedErrno = errno;
ALOGE("Failed recvmsg: %s", strerror(savedErrno));
@@ -231,7 +231,7 @@
}
unique_fd fd(std::move(std::get<unique_fd>(fds.back())));
- if (auto res = setNonBlocking(fd); !res.ok()) {
+ if (auto res = binder::os::setNonBlocking(fd); !res.ok()) {
ALOGE("Failed setNonBlocking: %s", res.error().message().c_str());
return res.error().code() == 0 ? UNKNOWN_ERROR : -res.error().code();
}
@@ -488,7 +488,7 @@
return;
}
- auto status = getRandomBytes(sessionId.data(), sessionId.size());
+ auto status = binder::os::getRandomBytes(sessionId.data(), sessionId.size());
if (status != OK) {
ALOGE("Failed to read random session ID: %s", strerror(-status));
return;