diff options
author | Jeff Brown <jeffbrown@google.com> | 2011-08-23 21:32:42 -0700 |
---|---|---|
committer | Jeff Brown <jeffbrown@google.com> | 2011-08-23 21:32:42 -0700 |
commit | c28306ad4ac9ce7a7d5f10c2e38d422ffc309a1f (patch) | |
tree | b44fd57c3691bc6c4319334752a89fe7966de087 /services/input | |
parent | aaee52cfa8bb1d0070b69cd4087be63dd2c0fee9 (diff) | |
download | frameworks_base-c28306ad4ac9ce7a7d5f10c2e38d422ffc309a1f.zip frameworks_base-c28306ad4ac9ce7a7d5f10c2e38d422ffc309a1f.tar.gz frameworks_base-c28306ad4ac9ce7a7d5f10c2e38d422ffc309a1f.tar.bz2 |
Improve input device wake heuristics.
Bug: 5205674
Only wake the device on positive interactions from the user
such as button presses, movement, initial touch down events.
In particular, do not wake the device on up events since the
driver might synthesize them on power off, causing the device
to wake up again for no good reason.
Change-Id: I767f553ea36d110e6f3a10611b324487ba7d880d
Diffstat (limited to 'services/input')
-rw-r--r-- | services/input/InputReader.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/services/input/InputReader.cpp b/services/input/InputReader.cpp index 643866b..bfcf8e0 100644 --- a/services/input/InputReader.cpp +++ b/services/input/InputReader.cpp @@ -2188,6 +2188,7 @@ void CursorInputMapper::sync(nsecs_t when) { } nsecs_t downTime = mDownTime; bool buttonsChanged = currentButtonState != lastButtonState; + bool buttonsPressed = currentButtonState & ~lastButtonState; float deltaX = mCursorMotionAccumulator.getRelativeX() * mXScale; float deltaY = mCursorMotionAccumulator.getRelativeY() * mYScale; @@ -2249,7 +2250,7 @@ void CursorInputMapper::sync(nsecs_t when) { // the device in your pocket. // TODO: Use the input device configuration to control this behavior more finely. uint32_t policyFlags = 0; - if (getDevice()->isExternal()) { + if ((buttonsPressed || moved || scrolled) && getDevice()->isExternal()) { policyFlags |= POLICY_FLAG_WAKE_DROPPED; } @@ -3345,9 +3346,12 @@ void TouchInputMapper::sync(nsecs_t when) { // Handle policy on initial down or hover events. uint32_t policyFlags = 0; - if (mLastRawPointerData.pointerCount == 0 && mCurrentRawPointerData.pointerCount != 0) { + bool initialDown = mLastRawPointerData.pointerCount == 0 + && mCurrentRawPointerData.pointerCount != 0; + bool buttonsPressed = mCurrentButtonState & ~mLastButtonState; + if (initialDown || buttonsPressed) { + // If this is a touch screen, hide the pointer on an initial down. if (mDeviceMode == DEVICE_MODE_DIRECT) { - // If this is a touch screen, hide the pointer on an initial down. getContext()->fadePointer(); } |