diff options
| author | 2019-07-23 23:22:24 +0000 | |
|---|---|---|
| committer | 2019-07-23 23:22:24 +0000 | |
| commit | cd2e8105e92eb12bae7f016f159e8c64f89b5041 (patch) | |
| tree | ccdad8a1a0717a8ec3df57f09f7da9f4279c7e78 | |
| parent | 40f9649ce02acb6f3f5f07c5ce7487dc621244c9 (diff) | |
| parent | 8e3ad786c9589e87d7825c0e6e692d13b03d4474 (diff) | |
Merge "Revert "Revert "Use std::set instead of SortedVector"""
| -rw-r--r-- | services/core/jni/com_android_server_input_InputManagerService.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/services/core/jni/com_android_server_input_InputManagerService.cpp b/services/core/jni/com_android_server_input_InputManagerService.cpp index 1c8c46c74002..466ca9315f6f 100644 --- a/services/core/jni/com_android_server_input_InputManagerService.cpp +++ b/services/core/jni/com_android_server_input_InputManagerService.cpp @@ -41,7 +41,6 @@ #include <utils/Looper.h> #include <utils/threads.h> #include <utils/Trace.h> -#include <utils/SortedVector.h> #include <binder/IServiceManager.h> @@ -307,7 +306,7 @@ private: wp<PointerController> pointerController; // Input devices to be disabled - SortedVector<int32_t> disabledInputDevices; + std::set<int32_t> disabledInputDevices; // Associated Pointer controller display. int32_t pointerDisplayId; @@ -898,13 +897,13 @@ void NativeInputManager::setInputDeviceEnabled(uint32_t deviceId, bool enabled) { // acquire lock AutoMutex _l(mLock); - ssize_t index = mLocked.disabledInputDevices.indexOf(deviceId); - bool currentlyEnabled = index < 0; + auto it = mLocked.disabledInputDevices.find(deviceId); + bool currentlyEnabled = it == mLocked.disabledInputDevices.end(); if (!enabled && currentlyEnabled) { - mLocked.disabledInputDevices.add(deviceId); + mLocked.disabledInputDevices.insert(deviceId); } if (enabled && !currentlyEnabled) { - mLocked.disabledInputDevices.remove(deviceId); + mLocked.disabledInputDevices.erase(deviceId); } } // release lock |