input: don't depend on unique_fd cast to int
Also, reuse dupFd method instead of calling ::dup directly.
Test: m libinput
Test: m libinputdispatcher
Bug: 302723053
Change-Id: Ie6e4f1ea9cfc00b4c2be44dcc8922a17de129cfb
diff --git a/include/input/InputTransport.h b/include/input/InputTransport.h
index 4f53c36..59b9495 100644
--- a/include/input/InputTransport.h
+++ b/include/input/InputTransport.h
@@ -240,7 +240,7 @@
android::base::unique_fd fd, sp<IBinder> token);
InputChannel() = default;
InputChannel(const InputChannel& other)
- : mName(other.mName), mFd(::dup(other.mFd)), mToken(other.mToken){};
+ : mName(other.mName), mFd(other.dupFd()), mToken(other.mToken){};
InputChannel(const std::string name, android::base::unique_fd fd, sp<IBinder> token);
~InputChannel() override;
/**
@@ -310,7 +310,7 @@
if (fstat(mFd.get(), &lhs) != 0) {
return false;
}
- if (fstat(inputChannel.getFd(), &rhs) != 0) {
+ if (fstat(inputChannel.getFd().get(), &rhs) != 0) {
return false;
}
// If file descriptors are pointing to same inode they are duplicated fds.
@@ -322,7 +322,7 @@
base::unique_fd dupFd() const;
std::string mName;
- android::base::unique_fd mFd;
+ base::unique_fd mFd;
sp<IBinder> mToken;
};