Loading include/input/InputTransport.h +3 −3 Original line number Diff line number Diff line Loading @@ -240,7 +240,7 @@ public: 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; /** Loading Loading @@ -310,7 +310,7 @@ public: 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. Loading @@ -322,7 +322,7 @@ private: base::unique_fd dupFd() const; std::string mName; android::base::unique_fd mFd; base::unique_fd mFd; sp<IBinder> mToken; }; Loading libs/input/InputTransport.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -424,7 +424,7 @@ status_t InputChannel::sendMessage(const InputMessage* msg) { msg->getSanitizedCopy(&cleanMsg); ssize_t nWrite; do { nWrite = ::send(getFd(), &cleanMsg, msgLength, MSG_DONTWAIT | MSG_NOSIGNAL); nWrite = ::send(getFd().get(), &cleanMsg, msgLength, MSG_DONTWAIT | MSG_NOSIGNAL); } while (nWrite == -1 && errno == EINTR); if (nWrite < 0) { Loading Loading @@ -455,7 +455,7 @@ status_t InputChannel::sendMessage(const InputMessage* msg) { status_t InputChannel::receiveMessage(InputMessage* msg) { ssize_t nRead; do { nRead = ::recv(getFd(), msg, sizeof(InputMessage), MSG_DONTWAIT); nRead = ::recv(getFd().get(), msg, sizeof(InputMessage), MSG_DONTWAIT); } while (nRead == -1 && errno == EINTR); if (nRead < 0) { Loading Loading @@ -521,7 +521,7 @@ sp<IBinder> InputChannel::getConnectionToken() const { } base::unique_fd InputChannel::dupFd() const { android::base::unique_fd newFd(::dup(getFd())); base::unique_fd newFd(::dup(getFd().get())); if (!newFd.ok()) { ALOGE("Could not duplicate fd %i for channel %s: %s", getFd().get(), getName().c_str(), strerror(errno)); Loading services/inputflinger/dispatcher/InputDispatcher.cpp +5 −5 Original line number Diff line number Diff line Loading @@ -5837,7 +5837,7 @@ Result<std::unique_ptr<InputChannel>> InputDispatcher::createInputChannel(const { // acquire lock std::scoped_lock _l(mLock); const sp<IBinder>& token = serverChannel->getConnectionToken(); int fd = serverChannel->getFd(); auto&& fd = serverChannel->getFd(); std::shared_ptr<Connection> connection = std::make_shared<Connection>(std::move(serverChannel), /*monitor=*/false, mIdGenerator); Loading @@ -5850,7 +5850,7 @@ Result<std::unique_ptr<InputChannel>> InputDispatcher::createInputChannel(const std::function<int(int events)> callback = std::bind(&InputDispatcher::handleReceiveCallback, this, std::placeholders::_1, token); mLooper->addFd(fd, 0, ALOOPER_EVENT_INPUT, sp<LooperEventCallback>::make(callback), mLooper->addFd(fd.get(), 0, ALOOPER_EVENT_INPUT, sp<LooperEventCallback>::make(callback), nullptr); } // release lock Loading Loading @@ -5880,7 +5880,7 @@ Result<std::unique_ptr<InputChannel>> InputDispatcher::createInputMonitor(int32_ std::shared_ptr<Connection> connection = std::make_shared<Connection>(serverChannel, /*monitor=*/true, mIdGenerator); const sp<IBinder>& token = serverChannel->getConnectionToken(); const int fd = serverChannel->getFd(); auto&& fd = serverChannel->getFd(); if (mConnectionsByToken.find(token) != mConnectionsByToken.end()) { ALOGE("Created a new connection, but the token %p is already known", token.get()); Loading @@ -5891,7 +5891,7 @@ Result<std::unique_ptr<InputChannel>> InputDispatcher::createInputMonitor(int32_ mGlobalMonitorsByDisplay[displayId].emplace_back(serverChannel, pid); mLooper->addFd(fd, 0, ALOOPER_EVENT_INPUT, sp<LooperEventCallback>::make(callback), mLooper->addFd(fd.get(), 0, ALOOPER_EVENT_INPUT, sp<LooperEventCallback>::make(callback), nullptr); } Loading Loading @@ -5930,7 +5930,7 @@ status_t InputDispatcher::removeInputChannelLocked(const sp<IBinder>& connection removeMonitorChannelLocked(connectionToken); } mLooper->removeFd(connection->inputChannel->getFd()); mLooper->removeFd(connection->inputChannel->getFd().get()); nsecs_t currentTime = now(); abortBrokenDispatchCycleLocked(currentTime, connection, notify); Loading Loading
include/input/InputTransport.h +3 −3 Original line number Diff line number Diff line Loading @@ -240,7 +240,7 @@ public: 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; /** Loading Loading @@ -310,7 +310,7 @@ public: 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. Loading @@ -322,7 +322,7 @@ private: base::unique_fd dupFd() const; std::string mName; android::base::unique_fd mFd; base::unique_fd mFd; sp<IBinder> mToken; }; Loading
libs/input/InputTransport.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -424,7 +424,7 @@ status_t InputChannel::sendMessage(const InputMessage* msg) { msg->getSanitizedCopy(&cleanMsg); ssize_t nWrite; do { nWrite = ::send(getFd(), &cleanMsg, msgLength, MSG_DONTWAIT | MSG_NOSIGNAL); nWrite = ::send(getFd().get(), &cleanMsg, msgLength, MSG_DONTWAIT | MSG_NOSIGNAL); } while (nWrite == -1 && errno == EINTR); if (nWrite < 0) { Loading Loading @@ -455,7 +455,7 @@ status_t InputChannel::sendMessage(const InputMessage* msg) { status_t InputChannel::receiveMessage(InputMessage* msg) { ssize_t nRead; do { nRead = ::recv(getFd(), msg, sizeof(InputMessage), MSG_DONTWAIT); nRead = ::recv(getFd().get(), msg, sizeof(InputMessage), MSG_DONTWAIT); } while (nRead == -1 && errno == EINTR); if (nRead < 0) { Loading Loading @@ -521,7 +521,7 @@ sp<IBinder> InputChannel::getConnectionToken() const { } base::unique_fd InputChannel::dupFd() const { android::base::unique_fd newFd(::dup(getFd())); base::unique_fd newFd(::dup(getFd().get())); if (!newFd.ok()) { ALOGE("Could not duplicate fd %i for channel %s: %s", getFd().get(), getName().c_str(), strerror(errno)); Loading
services/inputflinger/dispatcher/InputDispatcher.cpp +5 −5 Original line number Diff line number Diff line Loading @@ -5837,7 +5837,7 @@ Result<std::unique_ptr<InputChannel>> InputDispatcher::createInputChannel(const { // acquire lock std::scoped_lock _l(mLock); const sp<IBinder>& token = serverChannel->getConnectionToken(); int fd = serverChannel->getFd(); auto&& fd = serverChannel->getFd(); std::shared_ptr<Connection> connection = std::make_shared<Connection>(std::move(serverChannel), /*monitor=*/false, mIdGenerator); Loading @@ -5850,7 +5850,7 @@ Result<std::unique_ptr<InputChannel>> InputDispatcher::createInputChannel(const std::function<int(int events)> callback = std::bind(&InputDispatcher::handleReceiveCallback, this, std::placeholders::_1, token); mLooper->addFd(fd, 0, ALOOPER_EVENT_INPUT, sp<LooperEventCallback>::make(callback), mLooper->addFd(fd.get(), 0, ALOOPER_EVENT_INPUT, sp<LooperEventCallback>::make(callback), nullptr); } // release lock Loading Loading @@ -5880,7 +5880,7 @@ Result<std::unique_ptr<InputChannel>> InputDispatcher::createInputMonitor(int32_ std::shared_ptr<Connection> connection = std::make_shared<Connection>(serverChannel, /*monitor=*/true, mIdGenerator); const sp<IBinder>& token = serverChannel->getConnectionToken(); const int fd = serverChannel->getFd(); auto&& fd = serverChannel->getFd(); if (mConnectionsByToken.find(token) != mConnectionsByToken.end()) { ALOGE("Created a new connection, but the token %p is already known", token.get()); Loading @@ -5891,7 +5891,7 @@ Result<std::unique_ptr<InputChannel>> InputDispatcher::createInputMonitor(int32_ mGlobalMonitorsByDisplay[displayId].emplace_back(serverChannel, pid); mLooper->addFd(fd, 0, ALOOPER_EVENT_INPUT, sp<LooperEventCallback>::make(callback), mLooper->addFd(fd.get(), 0, ALOOPER_EVENT_INPUT, sp<LooperEventCallback>::make(callback), nullptr); } Loading Loading @@ -5930,7 +5930,7 @@ status_t InputDispatcher::removeInputChannelLocked(const sp<IBinder>& connection removeMonitorChannelLocked(connectionToken); } mLooper->removeFd(connection->inputChannel->getFd()); mLooper->removeFd(connection->inputChannel->getFd().get()); nsecs_t currentTime = now(); abortBrokenDispatchCycleLocked(currentTime, connection, notify); Loading