Loading gatekeeper/OWNERS +3 −1 Original line number Diff line number Diff line # Bug component: 1124862 swillden@google.com drysdale@google.com guangzhu@google.com oarbildo@google.com subrahmanyaman@google.com swillden@google.com gnss/common/utils/default/DeviceFileReader.cpp +28 −16 Original line number Diff line number Diff line Loading @@ -32,40 +32,52 @@ void DeviceFileReader::getDataFromDeviceFile(const std::string& command, int mMi return; } int mGnssFd = open(deviceFilePath.c_str(), O_RDWR | O_NONBLOCK); if (mGnssFd == -1) { int gnss_fd, epoll_fd; if ((gnss_fd = open(deviceFilePath.c_str(), O_RDWR | O_NONBLOCK)) == -1) { return; } if (write(gnss_fd, command.c_str(), command.size()) <= 0) { close(gnss_fd); return; } int bytes_write = write(mGnssFd, command.c_str(), command.size()); if (bytes_write <= 0) { close(mGnssFd); // Create an epoll instance. if ((epoll_fd = epoll_create1(EPOLL_CLOEXEC)) < 0) { close(gnss_fd); return; } // Add file descriptor to epoll instance. struct epoll_event ev, events[1]; ev.data.fd = mGnssFd; memset(&ev, 0, sizeof(ev)); ev.data.fd = gnss_fd; ev.events = EPOLLIN; int epoll_fd = epoll_create1(0); epoll_ctl(epoll_fd, EPOLL_CTL_ADD, mGnssFd, &ev); int bytes_read = -1; std::string inputStr = ""; int epoll_ret = epoll_wait(epoll_fd, events, 1, mMinIntervalMs); if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, gnss_fd, &ev) == -1) { close(gnss_fd); close(epoll_fd); return; } if (epoll_ret == -1) { close(mGnssFd); // Wait for device file event. if (epoll_wait(epoll_fd, events, 1, mMinIntervalMs) == -1) { close(gnss_fd); close(epoll_fd); return; } // Handle event and write data to string buffer. int bytes_read = -1; std::string inputStr = ""; while (true) { memset(inputBuffer, 0, INPUT_BUFFER_SIZE); bytes_read = read(mGnssFd, &inputBuffer, INPUT_BUFFER_SIZE); bytes_read = read(gnss_fd, &inputBuffer, INPUT_BUFFER_SIZE); if (bytes_read <= 0) { break; } s_buffer_ += std::string(inputBuffer, bytes_read); } close(mGnssFd); close(gnss_fd); close(epoll_fd); // Trim end of file mark(\n\n\n\n). auto pos = s_buffer_.find("\n\n\n\n"); Loading security/keymint/aidl/vts/functional/AuthTest.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -274,7 +274,7 @@ class AuthTest : public KeyMintAidlTestBase { std::shared_ptr<ISecureClock> clock_; string password_; uint32_t uid_; long sid_; int64_t sid_; std::vector<uint8_t> handle_; }; Loading security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h +1 −1 Original line number Diff line number Diff line Loading @@ -356,7 +356,7 @@ class KeyMintAidlTestBase : public ::testing::TestWithParam<string> { SecurityLevel securityLevel_; string name_; string author_; long challenge_; int64_t challenge_; private: void CheckEncryptOneByteAtATime(BlockMode block_mode, const int block_size, Loading sensors/common/vts/utils/include/sensors-vts-utils/SensorsHidlTestBase.h +9 −17 Original line number Diff line number Diff line Loading @@ -225,7 +225,9 @@ class SensorsHidlTestBase : public testing::TestWithParam<std::string> { ASSERT_EQ(batch(handle, samplingPeriodInNs, batchingPeriodInNs), Result::OK); ASSERT_EQ(activate(handle, 1), Result::OK); events = getEnvironment()->collectEvents(minTimeUs, minNEvent, true /*clearBeforeStart*/); events = getEnvironment()->collectEvents( minTimeUs, minNEvent, true /* clearBeforeStart */, true /* changeCollection */, [&type](const EventType& event) { return event.sensorType == type; }); ASSERT_EQ(activate(handle, 0), Result::OK); ALOGI("Collected %zu samples", events.size()); Loading @@ -233,9 +235,7 @@ class SensorsHidlTestBase : public testing::TestWithParam<std::string> { ASSERT_GT(events.size(), 0u); bool handleMismatchReported = false; bool metaSensorTypeErrorReported = false; for (auto& e : events) { if (e.sensorType == type) { // avoid generating hundreds of error if (!handleMismatchReported) { EXPECT_EQ(e.sensorHandle, handle) Loading @@ -243,14 +243,6 @@ class SensorsHidlTestBase : public testing::TestWithParam<std::string> { "Event of the same type must come from the sensor registered"); } sensorEvents.push_back(e); } else { // avoid generating hundreds of error if (!metaSensorTypeErrorReported) { EXPECT_TRUE(isMetaSensorType(e.sensorType)) << (metaSensorTypeErrorReported = true, "Only meta types are allowed besides the type registered"); } } } std::string s; Loading Loading
gatekeeper/OWNERS +3 −1 Original line number Diff line number Diff line # Bug component: 1124862 swillden@google.com drysdale@google.com guangzhu@google.com oarbildo@google.com subrahmanyaman@google.com swillden@google.com
gnss/common/utils/default/DeviceFileReader.cpp +28 −16 Original line number Diff line number Diff line Loading @@ -32,40 +32,52 @@ void DeviceFileReader::getDataFromDeviceFile(const std::string& command, int mMi return; } int mGnssFd = open(deviceFilePath.c_str(), O_RDWR | O_NONBLOCK); if (mGnssFd == -1) { int gnss_fd, epoll_fd; if ((gnss_fd = open(deviceFilePath.c_str(), O_RDWR | O_NONBLOCK)) == -1) { return; } if (write(gnss_fd, command.c_str(), command.size()) <= 0) { close(gnss_fd); return; } int bytes_write = write(mGnssFd, command.c_str(), command.size()); if (bytes_write <= 0) { close(mGnssFd); // Create an epoll instance. if ((epoll_fd = epoll_create1(EPOLL_CLOEXEC)) < 0) { close(gnss_fd); return; } // Add file descriptor to epoll instance. struct epoll_event ev, events[1]; ev.data.fd = mGnssFd; memset(&ev, 0, sizeof(ev)); ev.data.fd = gnss_fd; ev.events = EPOLLIN; int epoll_fd = epoll_create1(0); epoll_ctl(epoll_fd, EPOLL_CTL_ADD, mGnssFd, &ev); int bytes_read = -1; std::string inputStr = ""; int epoll_ret = epoll_wait(epoll_fd, events, 1, mMinIntervalMs); if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, gnss_fd, &ev) == -1) { close(gnss_fd); close(epoll_fd); return; } if (epoll_ret == -1) { close(mGnssFd); // Wait for device file event. if (epoll_wait(epoll_fd, events, 1, mMinIntervalMs) == -1) { close(gnss_fd); close(epoll_fd); return; } // Handle event and write data to string buffer. int bytes_read = -1; std::string inputStr = ""; while (true) { memset(inputBuffer, 0, INPUT_BUFFER_SIZE); bytes_read = read(mGnssFd, &inputBuffer, INPUT_BUFFER_SIZE); bytes_read = read(gnss_fd, &inputBuffer, INPUT_BUFFER_SIZE); if (bytes_read <= 0) { break; } s_buffer_ += std::string(inputBuffer, bytes_read); } close(mGnssFd); close(gnss_fd); close(epoll_fd); // Trim end of file mark(\n\n\n\n). auto pos = s_buffer_.find("\n\n\n\n"); Loading
security/keymint/aidl/vts/functional/AuthTest.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -274,7 +274,7 @@ class AuthTest : public KeyMintAidlTestBase { std::shared_ptr<ISecureClock> clock_; string password_; uint32_t uid_; long sid_; int64_t sid_; std::vector<uint8_t> handle_; }; Loading
security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h +1 −1 Original line number Diff line number Diff line Loading @@ -356,7 +356,7 @@ class KeyMintAidlTestBase : public ::testing::TestWithParam<string> { SecurityLevel securityLevel_; string name_; string author_; long challenge_; int64_t challenge_; private: void CheckEncryptOneByteAtATime(BlockMode block_mode, const int block_size, Loading
sensors/common/vts/utils/include/sensors-vts-utils/SensorsHidlTestBase.h +9 −17 Original line number Diff line number Diff line Loading @@ -225,7 +225,9 @@ class SensorsHidlTestBase : public testing::TestWithParam<std::string> { ASSERT_EQ(batch(handle, samplingPeriodInNs, batchingPeriodInNs), Result::OK); ASSERT_EQ(activate(handle, 1), Result::OK); events = getEnvironment()->collectEvents(minTimeUs, minNEvent, true /*clearBeforeStart*/); events = getEnvironment()->collectEvents( minTimeUs, minNEvent, true /* clearBeforeStart */, true /* changeCollection */, [&type](const EventType& event) { return event.sensorType == type; }); ASSERT_EQ(activate(handle, 0), Result::OK); ALOGI("Collected %zu samples", events.size()); Loading @@ -233,9 +235,7 @@ class SensorsHidlTestBase : public testing::TestWithParam<std::string> { ASSERT_GT(events.size(), 0u); bool handleMismatchReported = false; bool metaSensorTypeErrorReported = false; for (auto& e : events) { if (e.sensorType == type) { // avoid generating hundreds of error if (!handleMismatchReported) { EXPECT_EQ(e.sensorHandle, handle) Loading @@ -243,14 +243,6 @@ class SensorsHidlTestBase : public testing::TestWithParam<std::string> { "Event of the same type must come from the sensor registered"); } sensorEvents.push_back(e); } else { // avoid generating hundreds of error if (!metaSensorTypeErrorReported) { EXPECT_TRUE(isMetaSensorType(e.sensorType)) << (metaSensorTypeErrorReported = true, "Only meta types are allowed besides the type registered"); } } } std::string s; Loading