diff options
author | Yu-Ting Tseng <yutingtseng@google.com> | 2024-05-01 23:54:50 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2024-05-01 23:54:50 +0000 |
commit | 856ff4c9b7a7abbb2c294c36c8b4cf9902d814b2 (patch) | |
tree | 188bc1f9ab2d1e3ed813f7b36de885c22c46adcf | |
parent | 4241c63415f83769f59c4cb2219712ca18f51510 (diff) | |
parent | 8c5f7bec585e734ab466f0b8a2a5bfb5914973e3 (diff) | |
download | native-856ff4c9b7a7abbb2c294c36c8b4cf9902d814b2.tar.gz |
Merge "Move BlockingQueue.h to libinput" into main
-rw-r--r-- | include/input/BlockingQueue.h (renamed from services/inputflinger/BlockingQueue.h) | 0 | ||||
-rw-r--r-- | libs/input/tests/Android.bp | 1 | ||||
-rw-r--r-- | libs/input/tests/BlockingQueue_test.cpp (renamed from services/inputflinger/tests/BlockingQueue_test.cpp) | 7 | ||||
-rw-r--r-- | services/inputflinger/InputProcessor.h | 2 | ||||
-rw-r--r-- | services/inputflinger/tests/Android.bp | 1 | ||||
-rw-r--r-- | services/inputflinger/tests/InputDispatcher_test.cpp | 2 | ||||
-rw-r--r-- | services/inputflinger/tests/fuzzers/BlockingQueueFuzzer.cpp | 2 |
7 files changed, 7 insertions, 8 deletions
diff --git a/services/inputflinger/BlockingQueue.h b/include/input/BlockingQueue.h index f848c82c42..f848c82c42 100644 --- a/services/inputflinger/BlockingQueue.h +++ b/include/input/BlockingQueue.h diff --git a/libs/input/tests/Android.bp b/libs/input/tests/Android.bp index 13cfb491b5..9137a3468f 100644 --- a/libs/input/tests/Android.bp +++ b/libs/input/tests/Android.bp @@ -13,6 +13,7 @@ cc_test { cpp_std: "c++20", host_supported: true, srcs: [ + "BlockingQueue_test.cpp", "IdGenerator_test.cpp", "InputChannel_test.cpp", "InputDevice_test.cpp", diff --git a/services/inputflinger/tests/BlockingQueue_test.cpp b/libs/input/tests/BlockingQueue_test.cpp index 754a5c451e..924b937080 100644 --- a/services/inputflinger/tests/BlockingQueue_test.cpp +++ b/libs/input/tests/BlockingQueue_test.cpp @@ -14,8 +14,7 @@ * limitations under the License. */ -#include "../BlockingQueue.h" - +#include <input/BlockingQueue.h> #include <gtest/gtest.h> #include <thread> @@ -109,7 +108,7 @@ TEST(BlockingQueueTest, Queue_AllowsMultipleThreads) { BlockingQueue<int> queue(capacity); // Fill queue from a different thread - std::thread fillQueue([&queue](){ + std::thread fillQueue([&queue]() { for (size_t i = 0; i < capacity; i++) { ASSERT_TRUE(queue.push(static_cast<int>(i))); } @@ -136,7 +135,7 @@ TEST(BlockingQueueTest, Queue_BlocksWhileWaitingForElements) { std::atomic_bool hasReceivedElement = false; // fill queue from a different thread - std::thread waitUntilHasElements([&queue, &hasReceivedElement](){ + std::thread waitUntilHasElements([&queue, &hasReceivedElement]() { queue.pop(); // This should block until an element has been added hasReceivedElement = true; }); diff --git a/services/inputflinger/InputProcessor.h b/services/inputflinger/InputProcessor.h index dcbfebc62f..7a00a2dae8 100644 --- a/services/inputflinger/InputProcessor.h +++ b/services/inputflinger/InputProcessor.h @@ -22,7 +22,7 @@ #include <unordered_map> #include <aidl/android/hardware/input/processor/IInputProcessor.h> -#include "BlockingQueue.h" +#include <input/BlockingQueue.h> #include "InputListener.h" namespace android { diff --git a/services/inputflinger/tests/Android.bp b/services/inputflinger/tests/Android.bp index 2a03ecc62b..9c9f643656 100644 --- a/services/inputflinger/tests/Android.bp +++ b/services/inputflinger/tests/Android.bp @@ -39,7 +39,6 @@ cc_test { ], srcs: [ "AnrTracker_test.cpp", - "BlockingQueue_test.cpp", "CapturedTouchpadEventConverter_test.cpp", "CursorInputMapper_test.cpp", "EventHub_test.cpp", diff --git a/services/inputflinger/tests/InputDispatcher_test.cpp b/services/inputflinger/tests/InputDispatcher_test.cpp index 5002391f61..c2e67fa788 100644 --- a/services/inputflinger/tests/InputDispatcher_test.cpp +++ b/services/inputflinger/tests/InputDispatcher_test.cpp @@ -15,7 +15,6 @@ */ #include "../dispatcher/InputDispatcher.h" -#include "../BlockingQueue.h" #include "FakeApplicationHandle.h" #include "TestEventMatchers.h" @@ -31,6 +30,7 @@ #include <flag_macros.h> #include <gmock/gmock.h> #include <gtest/gtest.h> +#include <input/BlockingQueue.h> #include <input/Input.h> #include <input/PrintTools.h> #include <linux/input.h> diff --git a/services/inputflinger/tests/fuzzers/BlockingQueueFuzzer.cpp b/services/inputflinger/tests/fuzzers/BlockingQueueFuzzer.cpp index 219b662ffb..863d0a165e 100644 --- a/services/inputflinger/tests/fuzzers/BlockingQueueFuzzer.cpp +++ b/services/inputflinger/tests/fuzzers/BlockingQueueFuzzer.cpp @@ -15,8 +15,8 @@ */ #include <fuzzer/FuzzedDataProvider.h> +#include <input/BlockingQueue.h> #include <thread> -#include "BlockingQueue.h" // Chosen to be a number large enough for variation in fuzzer runs, but not consume too much memory. static constexpr size_t MAX_CAPACITY = 1024; |