diff options
| author | Jeff Brown <jeffbrown@google.com> | 2012-02-03 13:35:13 -0800 |
|---|---|---|
| committer | Jeff Brown <jeffbrown@google.com> | 2012-02-07 18:38:11 -0800 |
| commit | 308028049a75b36d5ed525c0bcef441da850c2a5 (patch) | |
| tree | fd5f6c8563d10381ad192934d26818f9494e7325 | |
| parent | 28587f445a2af6d94d1b215e019e8bcc377c17a1 (diff) | |
| download | frameworks_base-308028049a75b36d5ed525c0bcef441da850c2a5.zip frameworks_base-308028049a75b36d5ed525c0bcef441da850c2a5.tar.gz frameworks_base-308028049a75b36d5ed525c0bcef441da850c2a5.tar.bz2 | |
Remove the input dispatcher throttle.
This is part of a series of changes to improve input system pipelining.
Bug: 5963420
Change-Id: Iab33594bc5df8aa05232ef64c64e98fc61c5bf52
| -rw-r--r-- | services/input/InputDispatcher.cpp | 70 | ||||
| -rw-r--r-- | services/input/InputDispatcher.h | 19 | ||||
| -rw-r--r-- | services/java/com/android/server/wm/InputManager.java | 19 | ||||
| -rw-r--r-- | services/jni/com_android_server_InputManager.cpp | 10 |
4 files changed, 2 insertions, 116 deletions
diff --git a/services/input/InputDispatcher.cpp b/services/input/InputDispatcher.cpp index ad64ccd..28bd14b 100644 --- a/services/input/InputDispatcher.cpp +++ b/services/input/InputDispatcher.cpp @@ -39,9 +39,6 @@ // Log debug messages about input event injection. #define DEBUG_INJECTION 0 -// Log debug messages about input event throttling. -#define DEBUG_THROTTLING 0 - // Log debug messages about input focus tracking. #define DEBUG_FOCUS 0 @@ -210,14 +207,6 @@ InputDispatcher::InputDispatcher(const sp<InputDispatcherPolicyInterface>& polic mKeyRepeatState.lastKeyEntry = NULL; policy->getDispatcherConfiguration(&mConfig); - - mThrottleState.minTimeBetweenEvents = 1000000000LL / mConfig.maxEventsPerSecond; - mThrottleState.lastDeviceId = -1; - -#if DEBUG_THROTTLING - mThrottleState.originalSampleCount = 0; - ALOGD("Throttling - Max events per second = %d", mConfig.maxEventsPerSecond); -#endif } InputDispatcher::~InputDispatcher() { @@ -310,63 +299,7 @@ void InputDispatcher::dispatchOnceInnerLocked(nsecs_t* nextWakeupTime) { } } else { // Inbound queue has at least one entry. - EventEntry* entry = mInboundQueue.head; - - // Throttle the entry if it is a move event and there are no - // other events behind it in the queue. Due to movement batching, additional - // samples may be appended to this event by the time the throttling timeout - // expires. - // TODO Make this smarter and consider throttling per device independently. - if (entry->type == EventEntry::TYPE_MOTION - && !isAppSwitchDue - && mDispatchEnabled - && (entry->policyFlags & POLICY_FLAG_PASS_TO_USER) - && !entry->isInjected()) { - MotionEntry* motionEntry = static_cast<MotionEntry*>(entry); - int32_t deviceId = motionEntry->deviceId; - uint32_t source = motionEntry->source; - if (! isAppSwitchDue - && !motionEntry->next // exactly one event, no successors - && (motionEntry->action == AMOTION_EVENT_ACTION_MOVE - || motionEntry->action == AMOTION_EVENT_ACTION_HOVER_MOVE) - && deviceId == mThrottleState.lastDeviceId - && source == mThrottleState.lastSource) { - nsecs_t nextTime = mThrottleState.lastEventTime - + mThrottleState.minTimeBetweenEvents; - if (currentTime < nextTime) { - // Throttle it! -#if DEBUG_THROTTLING - ALOGD("Throttling - Delaying motion event for " - "device %d, source 0x%08x by up to %0.3fms.", - deviceId, source, (nextTime - currentTime) * 0.000001); -#endif - if (nextTime < *nextWakeupTime) { - *nextWakeupTime = nextTime; - } - if (mThrottleState.originalSampleCount == 0) { - mThrottleState.originalSampleCount = - motionEntry->countSamples(); - } - return; - } - } - -#if DEBUG_THROTTLING - if (mThrottleState.originalSampleCount != 0) { - uint32_t count = motionEntry->countSamples(); - ALOGD("Throttling - Motion event sample count grew by %d from %d to %d.", - count - mThrottleState.originalSampleCount, - mThrottleState.originalSampleCount, count); - mThrottleState.originalSampleCount = 0; - } -#endif - - mThrottleState.lastEventTime = currentTime; - mThrottleState.lastDeviceId = deviceId; - mThrottleState.lastSource = source; - } - - mInboundQueue.dequeue(entry); + EventEntry* entry = mInboundQueue.dequeueAtHead(); mPendingEvent = entry; } @@ -4080,7 +4013,6 @@ void InputDispatcher::dump(String8& dump) { dumpDispatchStateLocked(dump); dump.append(INDENT "Configuration:\n"); - dump.appendFormat(INDENT2 "MaxEventsPerSecond: %d\n", mConfig.maxEventsPerSecond); dump.appendFormat(INDENT2 "KeyRepeatDelay: %0.1fms\n", mConfig.keyRepeatDelay * 0.000001f); dump.appendFormat(INDENT2 "KeyRepeatTimeout: %0.1fms\n", mConfig.keyRepeatTimeout * 0.000001f); } diff --git a/services/input/InputDispatcher.h b/services/input/InputDispatcher.h index a1d42e1..7495fe2 100644 --- a/services/input/InputDispatcher.h +++ b/services/input/InputDispatcher.h @@ -172,15 +172,9 @@ struct InputDispatcherConfiguration { // The key repeat inter-key delay. nsecs_t keyRepeatDelay; - // The maximum suggested event delivery rate per second. - // This value is used to throttle motion event movement actions on a per-device - // basis. It is not intended to be a hard limit. - int32_t maxEventsPerSecond; - InputDispatcherConfiguration() : keyRepeatTimeout(500 * 1000000LL), - keyRepeatDelay(50 * 1000000LL), - maxEventsPerSecond(60) { } + keyRepeatDelay(50 * 1000000LL) { } }; @@ -927,17 +921,6 @@ private: void incrementPendingForegroundDispatchesLocked(EventEntry* entry); void decrementPendingForegroundDispatchesLocked(EventEntry* entry); - // Throttling state. - struct ThrottleState { - nsecs_t minTimeBetweenEvents; - - nsecs_t lastEventTime; - int32_t lastDeviceId; - uint32_t lastSource; - - uint32_t originalSampleCount; // only collected during debugging - } mThrottleState; - // Key repeat tracking. struct KeyRepeatState { KeyEntry* lastKeyEntry; // or null if no repeat diff --git a/services/java/com/android/server/wm/InputManager.java b/services/java/com/android/server/wm/InputManager.java index a4f0a0c..56c3519 100644 --- a/services/java/com/android/server/wm/InputManager.java +++ b/services/java/com/android/server/wm/InputManager.java @@ -668,25 +668,6 @@ public class InputManager implements Watchdog.Monitor { } @SuppressWarnings("unused") - public int getMaxEventsPerSecond() { - int result = 0; - try { - result = Integer.parseInt(SystemProperties.get("windowsmgr.max_events_per_sec")); - } catch (NumberFormatException e) { - } - if (result < 1) { - // This number equates to the refresh rate * 1.5. The rate should be at least - // equal to the screen refresh rate. We increase the rate by 50% to compensate for - // the discontinuity between the actual rate that events come in at (they do - // not necessarily come in constantly and are not handled synchronously). - // Ideally, we would use Display.getRefreshRate(), but as this does not necessarily - // return a sensible result, we use '60' as our default assumed refresh rate. - result = 90; - } - return result; - } - - @SuppressWarnings("unused") public int getPointerLayer() { return mWindowManagerService.mPolicy.windowTypeToLayerLw( WindowManager.LayoutParams.TYPE_POINTER) diff --git a/services/jni/com_android_server_InputManager.cpp b/services/jni/com_android_server_InputManager.cpp index e163826..5c3e002 100644 --- a/services/jni/com_android_server_InputManager.cpp +++ b/services/jni/com_android_server_InputManager.cpp @@ -71,7 +71,6 @@ static struct { jmethodID getExcludedDeviceNames; jmethodID getKeyRepeatTimeout; jmethodID getKeyRepeatDelay; - jmethodID getMaxEventsPerSecond; jmethodID getHoverTapTimeout; jmethodID getHoverTapSlop; jmethodID getDoubleTapTimeout; @@ -586,12 +585,6 @@ void NativeInputManager::getDispatcherConfiguration(InputDispatcherConfiguration if (!checkAndClearExceptionFromCallback(env, "getKeyRepeatDelay")) { outConfig->keyRepeatDelay = milliseconds_to_nanoseconds(keyRepeatDelay); } - - jint maxEventsPerSecond = env->CallIntMethod(mCallbacksObj, - gCallbacksClassInfo.getMaxEventsPerSecond); - if (!checkAndClearExceptionFromCallback(env, "getMaxEventsPerSecond")) { - outConfig->maxEventsPerSecond = maxEventsPerSecond; - } } bool NativeInputManager::isKeyRepeatEnabled() { @@ -1480,9 +1473,6 @@ int register_android_server_InputManager(JNIEnv* env) { GET_METHOD_ID(gCallbacksClassInfo.getLongPressTimeout, clazz, "getLongPressTimeout", "()I"); - GET_METHOD_ID(gCallbacksClassInfo.getMaxEventsPerSecond, clazz, - "getMaxEventsPerSecond", "()I"); - GET_METHOD_ID(gCallbacksClassInfo.getPointerLayer, clazz, "getPointerLayer", "()I"); |
