Loading services/inputflinger/Android.bp +9 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,10 @@ package { default_applicable_licenses: ["frameworks_native_license"], } inputflinger_tidy_checks = [ "android-*", ] cc_defaults { name: "inputflinger_defaults", cpp_std: "c++20", Loading @@ -38,6 +42,11 @@ cc_defaults { sanitize: { misc_undefined: ["bounds"], }, tidy: true, tidy_checks: [ "-*", // Disable all checks not explicitly enabled for now ] + inputflinger_tidy_checks, tidy_checks_as_errors: inputflinger_tidy_checks, } ///////////////////////////////////////////////// Loading services/inputflinger/InputManager.cpp +0 −2 Original line number Diff line number Diff line Loading @@ -33,8 +33,6 @@ namespace android { using gui::FocusRequest; using gui::WindowInfo; using gui::WindowInfoHandle; static int32_t exceptionCodeFromStatusT(status_t status) { switch (status) { Loading services/inputflinger/reader/EventHub.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -685,7 +685,7 @@ EventHub::EventHub(void) mEpollFd = epoll_create1(EPOLL_CLOEXEC); LOG_ALWAYS_FATAL_IF(mEpollFd < 0, "Could not create epoll instance: %s", strerror(errno)); mINotifyFd = inotify_init(); mINotifyFd = inotify_init1(IN_CLOEXEC); std::error_code errorCode; bool isDeviceInotifyAdded = false; Loading Loading @@ -713,7 +713,7 @@ EventHub::EventHub(void) LOG_ALWAYS_FATAL_IF(result != 0, "Could not add INotify to epoll instance. errno=%d", errno); int wakeFds[2]; result = pipe(wakeFds); result = pipe2(wakeFds, O_CLOEXEC); LOG_ALWAYS_FATAL_IF(result != 0, "Could not create wake pipe. errno=%d", errno); mWakeReadPipeFd = wakeFds[0]; Loading services/inputflinger/reader/TouchVideoDevice.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,7 @@ TouchVideoDevice::TouchVideoDevice(int fd, std::string&& name, std::string&& dev }; std::unique_ptr<TouchVideoDevice> TouchVideoDevice::create(std::string devicePath) { unique_fd fd(open(devicePath.c_str(), O_RDWR | O_NONBLOCK)); unique_fd fd(open(devicePath.c_str(), O_RDWR | O_NONBLOCK | O_CLOEXEC)); if (fd.get() == INVALID_FD) { ALOGE("Could not open video device %s: %s", devicePath.c_str(), strerror(errno)); return nullptr; Loading services/inputflinger/tests/InputDispatcher_test.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include <android-base/stringprintf.h> #include <android-base/thread_annotations.h> #include <binder/Binder.h> #include <fcntl.h> #include <gtest/gtest.h> #include <input/Input.h> #include <linux/input.h> Loading Loading @@ -6331,7 +6332,7 @@ TEST_F(InputDispatcherSpyWindowTest, ReceivesInputInOrder) { const std::vector<sp<FakeWindowHandle>> channels{spy1, spy2, window, spy3}; const size_t numChannels = channels.size(); base::unique_fd epollFd(epoll_create1(0 /*flags*/)); base::unique_fd epollFd(epoll_create1(EPOLL_CLOEXEC)); if (!epollFd.ok()) { FAIL() << "Failed to create epoll fd"; } Loading Loading
services/inputflinger/Android.bp +9 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,10 @@ package { default_applicable_licenses: ["frameworks_native_license"], } inputflinger_tidy_checks = [ "android-*", ] cc_defaults { name: "inputflinger_defaults", cpp_std: "c++20", Loading @@ -38,6 +42,11 @@ cc_defaults { sanitize: { misc_undefined: ["bounds"], }, tidy: true, tidy_checks: [ "-*", // Disable all checks not explicitly enabled for now ] + inputflinger_tidy_checks, tidy_checks_as_errors: inputflinger_tidy_checks, } ///////////////////////////////////////////////// Loading
services/inputflinger/InputManager.cpp +0 −2 Original line number Diff line number Diff line Loading @@ -33,8 +33,6 @@ namespace android { using gui::FocusRequest; using gui::WindowInfo; using gui::WindowInfoHandle; static int32_t exceptionCodeFromStatusT(status_t status) { switch (status) { Loading
services/inputflinger/reader/EventHub.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -685,7 +685,7 @@ EventHub::EventHub(void) mEpollFd = epoll_create1(EPOLL_CLOEXEC); LOG_ALWAYS_FATAL_IF(mEpollFd < 0, "Could not create epoll instance: %s", strerror(errno)); mINotifyFd = inotify_init(); mINotifyFd = inotify_init1(IN_CLOEXEC); std::error_code errorCode; bool isDeviceInotifyAdded = false; Loading Loading @@ -713,7 +713,7 @@ EventHub::EventHub(void) LOG_ALWAYS_FATAL_IF(result != 0, "Could not add INotify to epoll instance. errno=%d", errno); int wakeFds[2]; result = pipe(wakeFds); result = pipe2(wakeFds, O_CLOEXEC); LOG_ALWAYS_FATAL_IF(result != 0, "Could not create wake pipe. errno=%d", errno); mWakeReadPipeFd = wakeFds[0]; Loading
services/inputflinger/reader/TouchVideoDevice.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,7 @@ TouchVideoDevice::TouchVideoDevice(int fd, std::string&& name, std::string&& dev }; std::unique_ptr<TouchVideoDevice> TouchVideoDevice::create(std::string devicePath) { unique_fd fd(open(devicePath.c_str(), O_RDWR | O_NONBLOCK)); unique_fd fd(open(devicePath.c_str(), O_RDWR | O_NONBLOCK | O_CLOEXEC)); if (fd.get() == INVALID_FD) { ALOGE("Could not open video device %s: %s", devicePath.c_str(), strerror(errno)); return nullptr; Loading
services/inputflinger/tests/InputDispatcher_test.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include <android-base/stringprintf.h> #include <android-base/thread_annotations.h> #include <binder/Binder.h> #include <fcntl.h> #include <gtest/gtest.h> #include <input/Input.h> #include <linux/input.h> Loading Loading @@ -6331,7 +6332,7 @@ TEST_F(InputDispatcherSpyWindowTest, ReceivesInputInOrder) { const std::vector<sp<FakeWindowHandle>> channels{spy1, spy2, window, spy3}; const size_t numChannels = channels.size(); base::unique_fd epollFd(epoll_create1(0 /*flags*/)); base::unique_fd epollFd(epoll_create1(EPOLL_CLOEXEC)); if (!epollFd.ok()) { FAIL() << "Failed to create epoll fd"; } Loading