diff options
| author | 2010-11-10 16:53:45 -0800 | |
|---|---|---|
| committer | 2010-11-12 14:53:43 -0800 | |
| commit | e33a9ecc25b91d98ea75e3c14fd24c0c7fce5089 (patch) | |
| tree | cf5ad4bb7114fc4e9a82d70dff3f9192a792aa40 | |
| parent | ead98b9caee03bdf0c4dc4cfa4b266407af3d6cb (diff) | |
Enable touch splitting for all windows by default.
New default only applies to applications with targetSdkVersion >=
HONEYCOMB. Old applications default to no touch splitting for
their windows.
In addition, enabled split touch for various system windows.
Bug: 3049580
Change-Id: Idc8da9baa2cd8e1e4e76af8967d7b6a5ccb94427
| -rw-r--r-- | include/ui/InputDispatcher.h | 4 | ||||
| -rw-r--r-- | libs/ui/InputDispatcher.cpp | 16 |
2 files changed, 10 insertions, 10 deletions
diff --git a/include/ui/InputDispatcher.h b/include/ui/InputDispatcher.h index d09ff412de..15a3925795 100644 --- a/include/ui/InputDispatcher.h +++ b/include/ui/InputDispatcher.h @@ -219,6 +219,8 @@ struct InputWindow { * motion events to be delivered to them with AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED. */ bool isTrustedOverlay() const; + + bool supportsSplitTouch() const; }; @@ -946,7 +948,7 @@ private: struct TouchedWindow { const InputWindow* window; int32_t targetFlags; - BitSet32 pointerIds; + BitSet32 pointerIds; // zero unless target flag FLAG_SPLIT is set sp<InputChannel> channel; }; struct TouchState { diff --git a/libs/ui/InputDispatcher.cpp b/libs/ui/InputDispatcher.cpp index 7ddb3c75ee..db7d4487c9 100644 --- a/libs/ui/InputDispatcher.cpp +++ b/libs/ui/InputDispatcher.cpp @@ -157,6 +157,10 @@ bool InputWindow::isTrustedOverlay() const { || layoutParamsType == TYPE_SECURE_SYSTEM_OVERLAY; } +bool InputWindow::supportsSplitTouch() const { + return layoutParamsFlags & InputWindow::FLAG_SPLIT_TOUCH; +} + // --- InputDispatcher --- @@ -1110,8 +1114,7 @@ int32_t InputDispatcher::findTouchedWindowTargetsLocked(nsecs_t currentTime, } // Figure out whether splitting will be allowed for this window. - if (newTouchedWindow - && (newTouchedWindow->layoutParamsFlags & InputWindow::FLAG_SPLIT_TOUCH)) { + if (newTouchedWindow && newTouchedWindow->supportsSplitTouch()) { // New window supports splitting. isSplit = true; } else if (isSplit) { @@ -2648,13 +2651,8 @@ bool InputDispatcher::transferTouchFocus(const sp<InputChannel>& fromChannel, mTouchState.windows.removeAt(i); - int32_t newTargetFlags = 0; - if (oldTargetFlags & InputTarget::FLAG_FOREGROUND) { - newTargetFlags |= InputTarget::FLAG_FOREGROUND; - if (toWindow->layoutParamsFlags & InputWindow::FLAG_SPLIT_TOUCH) { - newTargetFlags |= InputTarget::FLAG_SPLIT; - } - } + int32_t newTargetFlags = oldTargetFlags + & (InputTarget::FLAG_FOREGROUND | InputTarget::FLAG_SPLIT); mTouchState.addOrUpdateWindow(toWindow, newTargetFlags, pointerIds); found = true; |