From d688ab1bdb84291ce10242ce2d7b58f662e8011b Mon Sep 17 00:00:00 2001 From: Pin-Yu Huang Date: Fri, 19 Jul 2019 02:00:56 +0000 Subject: [PATCH] Revert "Use std::set instead of SortedVector" This reverts commit 5b38f061dcb75e349c2d57c193bbaf46d9cd02ef. Reason for revert: this CL cause multiple build break Change-Id: I29476975153d32e0bf2ade194b1acbe944b59fd3 --- .../com_android_server_input_InputManagerService.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/services/core/jni/com_android_server_input_InputManagerService.cpp b/services/core/jni/com_android_server_input_InputManagerService.cpp index 466ca9315f6f0..1c8c46c740026 100644 --- a/services/core/jni/com_android_server_input_InputManagerService.cpp +++ b/services/core/jni/com_android_server_input_InputManagerService.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #include @@ -306,7 +307,7 @@ private: wp pointerController; // Input devices to be disabled - std::set disabledInputDevices; + SortedVector disabledInputDevices; // Associated Pointer controller display. int32_t pointerDisplayId; @@ -897,13 +898,13 @@ void NativeInputManager::setInputDeviceEnabled(uint32_t deviceId, bool enabled) { // acquire lock AutoMutex _l(mLock); - auto it = mLocked.disabledInputDevices.find(deviceId); - bool currentlyEnabled = it == mLocked.disabledInputDevices.end(); + ssize_t index = mLocked.disabledInputDevices.indexOf(deviceId); + bool currentlyEnabled = index < 0; if (!enabled && currentlyEnabled) { - mLocked.disabledInputDevices.insert(deviceId); + mLocked.disabledInputDevices.add(deviceId); } if (enabled && !currentlyEnabled) { - mLocked.disabledInputDevices.erase(deviceId); + mLocked.disabledInputDevices.remove(deviceId); } } // release lock