Plumb display power state through display manager.
Eliminated the bright here and woke here policy flags since they were unused. Simplified the input dispatch policy somewhat. Bug: 13133142 Change-Id: I74b4dc866c44c46ed43006a48a857f0da4c07cc9
This commit is contained in:
parent
cf8684b206
commit
dc5992e48c
|
@ -251,10 +251,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();
|
||||
}
|
||||
|
||||
|
@ -1138,30 +1138,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;
|
||||
|
@ -1246,10 +1222,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
|
||||
}
|
||||
}
|
||||
|
@ -2412,10 +2385,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();
|
||||
|
@ -2595,10 +2564,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(),
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -65,10 +65,6 @@ private:
|
|||
*outConfig = mConfig;
|
||||
}
|
||||
|
||||
virtual bool isKeyRepeatEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool filterInputEvent(const InputEvent* inputEvent, uint32_t policyFlags) {
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue