diff options
author | Jeff Brown <jeffbrown@google.com> | 2014-04-09 00:31:55 -0700 |
---|---|---|
committer | Jeff Brown <jeffbrown@google.com> | 2014-04-10 20:46:14 -0700 |
commit | 037c33eae74bee2774897d969d48947f9abe254f (patch) | |
tree | 9f6a33f07f48b9a08088eb287c1bfdd1fd97bda5 /libs | |
parent | 7289f3ab8f05db6206d696d75f460fadc05dc731 (diff) | |
download | frameworks_base-037c33eae74bee2774897d969d48947f9abe254f.zip frameworks_base-037c33eae74bee2774897d969d48947f9abe254f.tar.gz frameworks_base-037c33eae74bee2774897d969d48947f9abe254f.tar.bz2 |
Plumb display power state through display manager.
Declare a new method, Display.getState() to retrieve the actual
power state of a display.
Improved documentation for Intent.ACTION_SCREEN_ON and
Intent.ACTION_SCREEN_OFF to clarify what they really mean in
terms of the interactive state of the device.
Deprecated PowerManager.isScreenOn() and replaced it with
PowerManager.isInteractive() with a more suggestive name and
better documentation.
Redirect display power state changes to go through the display
manager first and only then head over to the power manager for
legacy compatibility.
Eliminated the bright here and woke here policy flags since they
were unused. Simplified the input dispatch policy somewhat.
Ensure that screen wake locks are respected up until the point
when dozing really begins.
Fixed a regression in DreamService where onDreamingStarted
might be called before onWindowAttached.
Bug: 13133142
Bug: 13472578
Bug: 13929355
Bug: 13760290
Change-Id: Iabef96921dd554ce3768fb18619cefc3230b5fb0
Diffstat (limited to 'libs')
-rw-r--r-- | libs/input/InputDispatcher.cpp | 45 | ||||
-rw-r--r-- | libs/input/InputDispatcher.h | 3 | ||||
-rw-r--r-- | libs/input/tests/InputDispatcher_test.cpp | 4 |
3 files changed, 5 insertions, 47 deletions
diff --git a/libs/input/InputDispatcher.cpp b/libs/input/InputDispatcher.cpp index 70ff085..7164a13 100644 --- a/libs/input/InputDispatcher.cpp +++ b/libs/input/InputDispatcher.cpp @@ -248,10 +248,10 @@ void InputDispatcher::dispatchOnce() { void InputDispatcher::dispatchOnceInnerLocked(nsecs_t* nextWakeupTime) { nsecs_t currentTime = now(); - // Reset the key repeat timer whenever we disallow key events, even if the next event - // is not a key. This is to ensure that we abort a key repeat if the device is just coming - // out of sleep. - if (!mPolicy->isKeyRepeatEnabled()) { + // Reset the key repeat timer whenever normal dispatch is suspended while the + // device is in a non-interactive state. This is to ensure that we abort a key + // repeat if the device is just coming out of sleep. + if (!mDispatchEnabled) { resetKeyRepeatLocked(); } @@ -1135,30 +1135,6 @@ int32_t InputDispatcher::findTouchedWindowTargetsLocked(nsecs_t currentTime, // For security reasons, we defer updating the touch state until we are sure that // event injection will be allowed. - // - // FIXME In the original code, screenWasOff could never be set to true. - // The reason is that the POLICY_FLAG_WOKE_HERE - // and POLICY_FLAG_BRIGHT_HERE flags were set only when preprocessing raw - // EV_KEY, EV_REL and EV_ABS events. As it happens, the touch event was - // actually enqueued using the policyFlags that appeared in the final EV_SYN - // events upon which no preprocessing took place. So policyFlags was always 0. - // In the new native input dispatcher we're a bit more careful about event - // preprocessing so the touches we receive can actually have non-zero policyFlags. - // Unfortunately we obtain undesirable behavior. - // - // Here's what happens: - // - // When the device dims in anticipation of going to sleep, touches - // in windows which have FLAG_TOUCHABLE_WHEN_WAKING cause - // the device to brighten and reset the user activity timer. - // Touches on other windows (such as the launcher window) - // are dropped. Then after a moment, the device goes to sleep. Oops. - // - // Also notice how screenWasOff was being initialized using POLICY_FLAG_BRIGHT_HERE - // instead of POLICY_FLAG_WOKE_HERE... - // - bool screenWasOff = false; // original policy: policyFlags & POLICY_FLAG_BRIGHT_HERE; - int32_t displayId = entry->displayId; int32_t action = entry->action; int32_t maskedAction = action & AMOTION_EVENT_ACTION_MASK; @@ -1243,10 +1219,7 @@ int32_t InputDispatcher::findTouchedWindowTargetsLocked(nsecs_t currentTime, isTouchModal = (flags & (InputWindowInfo::FLAG_NOT_FOCUSABLE | InputWindowInfo::FLAG_NOT_TOUCH_MODAL)) == 0; if (isTouchModal || windowInfo->touchableRegionContainsPoint(x, y)) { - if (! screenWasOff - || (flags & InputWindowInfo::FLAG_TOUCHABLE_WHEN_WAKING)) { - newTouchedWindowHandle = windowHandle; - } + newTouchedWindowHandle = windowHandle; break; // found touched window, exit window loop } } @@ -2409,10 +2382,6 @@ void InputDispatcher::notifyKey(const NotifyKeyArgs* args) { mPolicy->interceptKeyBeforeQueueing(&event, /*byref*/ policyFlags); - if (policyFlags & POLICY_FLAG_WOKE_HERE) { - flags |= AKEY_EVENT_FLAG_WOKE_HERE; - } - bool needWake; { // acquire lock mLock.lock(); @@ -2592,10 +2561,6 @@ int32_t InputDispatcher::injectInputEvent(const InputEvent* event, int32_t displ mPolicy->interceptKeyBeforeQueueing(keyEvent, /*byref*/ policyFlags); } - if (policyFlags & POLICY_FLAG_WOKE_HERE) { - flags |= AKEY_EVENT_FLAG_WOKE_HERE; - } - mLock.lock(); firstInjectedEntry = new KeyEntry(keyEvent->getEventTime(), keyEvent->getDeviceId(), keyEvent->getSource(), diff --git a/libs/input/InputDispatcher.h b/libs/input/InputDispatcher.h index 29854b2..9439124 100644 --- a/libs/input/InputDispatcher.h +++ b/libs/input/InputDispatcher.h @@ -211,9 +211,6 @@ public: /* Gets the input dispatcher configuration. */ virtual void getDispatcherConfiguration(InputDispatcherConfiguration* outConfig) = 0; - /* Returns true if automatic key repeating is enabled. */ - virtual bool isKeyRepeatEnabled() = 0; - /* Filters an input event. * Return true to dispatch the event unmodified, false to consume the event. * A filter can also transform and inject events later by passing POLICY_FLAG_FILTERED diff --git a/libs/input/tests/InputDispatcher_test.cpp b/libs/input/tests/InputDispatcher_test.cpp index fc89a9b..7aac6ed 100644 --- a/libs/input/tests/InputDispatcher_test.cpp +++ b/libs/input/tests/InputDispatcher_test.cpp @@ -65,10 +65,6 @@ private: *outConfig = mConfig; } - virtual bool isKeyRepeatEnabled() { - return true; - } - virtual bool filterInputEvent(const InputEvent* inputEvent, uint32_t policyFlags) { return true; } |