From 7507d7bc02908e4b2989559c8e9fd1c11fbfe7f0 Mon Sep 17 00:00:00 2001 From: Siarhei Vishniakou Date: Wed, 10 Jul 2019 15:38:05 -0700 Subject: [PATCH] Refactor requestRefreshConfiguration call Currently, it appears that requestRefreshConfiguration can only ever be called with a single configuration value. That means, we can probably switch to using an enum class for the different configuration values, and simplify some of the existing logic. But it's not super obvious from code that only 1 bit is set in this "changes" variable. Refactor it a little to make it more obvious. Bug: 137212522 Test: none Change-Id: I8d21e7ea05e0271229f72354888b722dfdaf3929 --- .../jni/com_android_server_input_InputManagerService.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/services/core/jni/com_android_server_input_InputManagerService.cpp b/services/core/jni/com_android_server_input_InputManagerService.cpp index fb3076ba9ddd6..1c8c46c740026 100644 --- a/services/core/jni/com_android_server_input_InputManagerService.cpp +++ b/services/core/jni/com_android_server_input_InputManagerService.cpp @@ -826,18 +826,19 @@ void NativeInputManager::setInputWindows(JNIEnv* env, jobjectArray windowHandleO } } - uint32_t changes = 0; + bool pointerGesturesEnabledChanged = false; { // acquire lock AutoMutex _l(mLock); if (mLocked.pointerGesturesEnabled != newPointerGesturesEnabled) { mLocked.pointerGesturesEnabled = newPointerGesturesEnabled; - changes |= InputReaderConfiguration::CHANGE_POINTER_GESTURE_ENABLEMENT; + pointerGesturesEnabledChanged = true; } } // release lock - if (changes) { - mInputManager->getReader()->requestRefreshConfiguration(changes); + if (pointerGesturesEnabledChanged) { + mInputManager->getReader()->requestRefreshConfiguration( + InputReaderConfiguration::CHANGE_POINTER_GESTURE_ENABLEMENT); } }