diff options
| author | 2011-07-13 22:51:29 -0700 | |
|---|---|---|
| committer | 2011-07-14 04:11:21 -0700 | |
| commit | 9302c8796fc4dcda08d4bd1e11733848fd4fafaf (patch) | |
| tree | 1008e3db6ba1eb6ee02b7bf8c4a648a13a0b741d /services/input/InputWindow.cpp | |
| parent | 14fcf900ce65e5c8c952c95ee12041f8de16fbb7 (diff) | |
Refactor input dispatcher use of window/app handles.
This change moves the cached window and application input state
into the handle objects themselves. It simplifies the dispatcher
somewhat because it no longer needs to fix up references to
transient InputWindow objects each time the window list is updated.
This change will also make it easier to optimize setInputWindows
to avoid doing a lot of redundant data copying. In principle, only
the modified fields need to be updated. However, for now we
continue to update all fields in unison as before.
It turns out that the input dispatcher was inappropriately retaining
pointers to InputWindow objects within the mWindows InputWindow
vector. This vector is copy-on-write so it is possible and the
item pointers to change if an editing operation is performed on
the vector when it does not exclusively own the underlying
SharedBuffer. This bug was uncovered by a previous change that
replaced calls to clear() and appendVector() with a simple use
of operator= which caused the buffer to be shared. Consequently
after editItemAt was called (which it shouldn't have, actually)
the buffer was copied and the cached InputWindow pointers became
invalid. Oops. This change fixes the problem.
Change-Id: I0a259339a6015fcf9113dc4081a6875e047fd425
Diffstat (limited to 'services/input/InputWindow.cpp')
| -rw-r--r-- | services/input/InputWindow.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/services/input/InputWindow.cpp b/services/input/InputWindow.cpp index b552f6d5b43d..0ce886738108 100644 --- a/services/input/InputWindow.cpp +++ b/services/input/InputWindow.cpp @@ -22,25 +22,25 @@ namespace android { -// --- InputWindow --- +// --- InputWindowHandle --- -bool InputWindow::touchableRegionContainsPoint(int32_t x, int32_t y) const { +bool InputWindowHandle::touchableRegionContainsPoint(int32_t x, int32_t y) const { return touchableRegion.contains(x, y); } -bool InputWindow::frameContainsPoint(int32_t x, int32_t y) const { +bool InputWindowHandle::frameContainsPoint(int32_t x, int32_t y) const { return x >= frameLeft && x <= frameRight && y >= frameTop && y <= frameBottom; } -bool InputWindow::isTrustedOverlay() const { +bool InputWindowHandle::isTrustedOverlay() const { return layoutParamsType == TYPE_INPUT_METHOD || layoutParamsType == TYPE_INPUT_METHOD_DIALOG || layoutParamsType == TYPE_SECURE_SYSTEM_OVERLAY; } -bool InputWindow::supportsSplitTouch() const { - return layoutParamsFlags & InputWindow::FLAG_SPLIT_TOUCH; +bool InputWindowHandle::supportsSplitTouch() const { + return layoutParamsFlags & FLAG_SPLIT_TOUCH; } } // namespace android |