From b88102f5b7e51552a3576cf197b4c8cf96f193d1 Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Wed, 8 Sep 2010 11:49:43 -0700 Subject: Input dispatcher ANR handling enhancements. This change is essentially a rewrite of the main input dispatcher loop with the target identification folded in. Since the input dispatcher now has all of the window state, it can make better decisions about when to ANR. Added a .5 second deadline for processing app switch keys. This behavior predates Gingerbread but had not previously been ported. Fixed some timing inaccuracies in the ANR accounting that could cause applications to ANR sooner than they should have. Added a mechanism for tracking key and motion events that have been dispatched to a window so that appropriate cancelation events can be synthesized when recovering from ANR. This change helps to keep applications in sync so they don't end up with stuck buttons upon recovery from ANRs. Added more comments to describe the tricky parts of PollLoop. Change-Id: I13dffca27acb436fc383980db536abc4d8b9e6f1 --- libs/ui/InputManager.cpp | 48 ++++-------------------------------------------- 1 file changed, 4 insertions(+), 44 deletions(-) (limited to 'libs/ui/InputManager.cpp') diff --git a/libs/ui/InputManager.cpp b/libs/ui/InputManager.cpp index ed4f07b277b7..09fce38d9c18 100644 --- a/libs/ui/InputManager.cpp +++ b/libs/ui/InputManager.cpp @@ -72,52 +72,12 @@ status_t InputManager::stop() { return OK; } -status_t InputManager::registerInputChannel(const sp& inputChannel) { - return mDispatcher->registerInputChannel(inputChannel); +sp InputManager::getReader() { + return mReader; } -status_t InputManager::unregisterInputChannel(const sp& inputChannel) { - return mDispatcher->unregisterInputChannel(inputChannel); -} - -int32_t InputManager::injectInputEvent(const InputEvent* event, - int32_t injectorPid, int32_t injectorUid, int32_t syncMode, int32_t timeoutMillis) { - return mDispatcher->injectInputEvent(event, injectorPid, injectorUid, syncMode, timeoutMillis); -} - -void InputManager::preemptInputDispatch() { - mDispatcher->preemptInputDispatch(); -} - -void InputManager::getInputConfiguration(InputConfiguration* outConfiguration) { - mReader->getInputConfiguration(outConfiguration); -} - -status_t InputManager::getInputDeviceInfo(int32_t deviceId, InputDeviceInfo* outDeviceInfo) { - return mReader->getInputDeviceInfo(deviceId, outDeviceInfo); -} - -void InputManager::getInputDeviceIds(Vector& outDeviceIds) { - mReader->getInputDeviceIds(outDeviceIds); -} - -int32_t InputManager::getScanCodeState(int32_t deviceId, uint32_t sourceMask, - int32_t scanCode) { - return mReader->getScanCodeState(deviceId, sourceMask, scanCode); -} - -int32_t InputManager::getKeyCodeState(int32_t deviceId, uint32_t sourceMask, - int32_t keyCode) { - return mReader->getKeyCodeState(deviceId, sourceMask, keyCode); -} - -int32_t InputManager::getSwitchState(int32_t deviceId, uint32_t sourceMask, int32_t sw) { - return mReader->getSwitchState(deviceId, sourceMask, sw); -} - -bool InputManager::hasKeys(int32_t deviceId, uint32_t sourceMask, - size_t numCodes, const int32_t* keyCodes, uint8_t* outFlags) { - return mReader->hasKeys(deviceId, sourceMask, numCodes, keyCodes, outFlags); +sp InputManager::getDispatcher() { + return mDispatcher; } } // namespace android -- cgit v1.2.3-59-g8ed1b