Use std::set instead of SortedVector
We only care whether a certain input device is present in a list or not.
For that, we can just use an std::set and not have to use custom
SortedVector data structure. This makes it easier for someone already
familiar with c++ but not necessarily Android to follow the code. It
also ensures that the data structure is properly maintained going
forward.
Bug: 137212522
Test: atest libinput_tests inputflinger_tests
Change-Id: I7808b41524ae0b87dbf1aaf7a49afa64b14b3eb9
diff --git a/services/inputflinger/include/InputReaderBase.h b/services/inputflinger/include/InputReaderBase.h
index c7720cb..2710514 100644
--- a/services/inputflinger/include/InputReaderBase.h
+++ b/services/inputflinger/include/InputReaderBase.h
@@ -27,11 +27,11 @@
#include <utils/KeyedVector.h>
#include <utils/Thread.h>
#include <utils/RefBase.h>
-#include <utils/SortedVector.h>
-#include <optional>
#include <stddef.h>
#include <unistd.h>
+#include <optional>
+#include <set>
#include <unordered_map>
#include <vector>
@@ -250,7 +250,7 @@
bool pointerCapture;
// The set of currently disabled input devices.
- SortedVector<int32_t> disabledDevices;
+ std::set<int32_t> disabledDevices;
InputReaderConfiguration() :
virtualKeyQuietTime(0),