summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jeff Brown <jeffbrown@google.com> 2010-11-10 16:53:45 -0800
committer Jeff Brown <jeffbrown@google.com> 2010-11-12 14:53:43 -0800
commit46e75294d540fe807d78aec2582ae02cc38c7d42 (patch)
tree260678b7532242c8dd31e3aba47710e9516a3c12
parent1a22bdb01ac4068c2876fe2d02f3c4c729669a1c (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--api/current.xml13
-rw-r--r--core/java/android/widget/MediaController.java3
-rw-r--r--core/java/android/widget/PopupWindow.java16
-rwxr-xr-xcore/res/res/values/attrs.xml13
-rw-r--r--core/res/res/values/public.xml5
-rw-r--r--include/ui/InputDispatcher.h4
-rw-r--r--libs/ui/InputDispatcher.cpp16
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/PhoneStatusBarService.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/StatusBarService.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/tablet/ShirtPocket.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java12
-rw-r--r--policy/src/com/android/internal/policy/impl/PhoneWindow.java10
12 files changed, 72 insertions, 29 deletions
diff --git a/api/current.xml b/api/current.xml
index 94a205111eff..ed1d929f61d7 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -10371,6 +10371,17 @@
visibility="public"
>
</field>
+<field name="windowEnableSplitTouch"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16843560"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="windowEnterAnimation"
type="int"
transient="false"
@@ -246481,7 +246492,7 @@
deprecated="not deprecated"
visibility="public"
>
-<parameter name="t" type="T">
+<parameter name="arg0" type="T">
</parameter>
</method>
</interface>
diff --git a/core/java/android/widget/MediaController.java b/core/java/android/widget/MediaController.java
index 27a6ad33dee9..690164c11430 100644
--- a/core/java/android/widget/MediaController.java
+++ b/core/java/android/widget/MediaController.java
@@ -298,7 +298,8 @@ public class MediaController extends FrameLayout {
p.y = anchorpos[1] + mAnchor.getHeight() - p.height;
p.format = PixelFormat.TRANSLUCENT;
p.type = WindowManager.LayoutParams.TYPE_APPLICATION_PANEL;
- p.flags |= WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
+ p.flags |= WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM
+ | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH;
p.token = null;
p.windowAnimations = 0; // android.R.style.DropDownAnimationDown;
mWindowManager.addView(mDecor, p);
diff --git a/core/java/android/widget/PopupWindow.java b/core/java/android/widget/PopupWindow.java
index 95678c6add04..0f61cd4b59fe 100644
--- a/core/java/android/widget/PopupWindow.java
+++ b/core/java/android/widget/PopupWindow.java
@@ -25,6 +25,7 @@ import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.StateListDrawable;
+import android.os.Build;
import android.os.IBinder;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
@@ -87,7 +88,7 @@ public class PopupWindow {
private boolean mTouchable = true;
private boolean mOutsideTouchable = false;
private boolean mClippingEnabled = true;
- private boolean mSplitTouchEnabled;
+ private int mSplitTouchEnabled = -1;
private boolean mLayoutInScreen;
private boolean mClipToScreen;
@@ -602,14 +603,17 @@ public class PopupWindow {
* @hide
*/
public boolean isSplitTouchEnabled() {
- return mSplitTouchEnabled;
+ if (mSplitTouchEnabled < 0 && mContext != null) {
+ return mContext.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.HONEYCOMB;
+ }
+ return mSplitTouchEnabled == 1;
}
/**
* <p>Allows the popup window to split touches across other windows that also
- * support split touch. When this flag is not set, the first pointer
+ * support split touch. When this flag is false, the first pointer
* that goes down determines the window to which all subsequent touches
- * go until all pointers go up. When this flag is set, each pointer
+ * go until all pointers go up. When this flag is true, each pointer
* (not necessarily the first) that goes down determines the window
* to which all subsequent touches of that pointer will go until that
* pointer goes up thereby enabling touches with multiple pointers
@@ -620,7 +624,7 @@ public class PopupWindow {
* @hide
*/
public void setSplitTouchEnabled(boolean enabled) {
- mSplitTouchEnabled = enabled;
+ mSplitTouchEnabled = enabled ? 1 : 0;
}
/**
@@ -993,7 +997,7 @@ public class PopupWindow {
if (!mClippingEnabled) {
curFlags |= WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
}
- if (mSplitTouchEnabled) {
+ if (isSplitTouchEnabled()) {
curFlags |= WindowManager.LayoutParams.FLAG_SPLIT_TOUCH;
}
if (mLayoutInScreen) {
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index d3052605b5ef..d6684febb04b 100755
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -345,6 +345,18 @@
because there will be no such interaction coming. -->
<attr name="windowNoDisplay" format="boolean" />
+ <!-- Flag indicating that this window should allow touches to be split
+ across other windows that also support split touch.
+ The default value is true for applications with a targetSdkVersion
+ of Honeycomb or newer; false otherwise.
+ When this flag is false, the first pointer that goes down determines
+ the window to which all subsequent touches go until all pointers go up.
+ When this flag is true, each pointer (not necessarily the first) that
+ goes down determines the window to which all subsequent touches of that
+ pointer will go until that pointers go up thereby enabling touches
+ with multiple pointers to be split across multiple windows. -->
+ <attr name="windowEnableSplitTouch" format="boolean" />
+
<!-- ============ -->
<!-- Alert Dialog styles -->
<!-- ============ -->
@@ -1227,6 +1239,7 @@
<attr name="windowActionBar" />
<attr name="windowActionModeOverlay" />
<attr name="windowActionBarOverlay" />
+ <attr name="windowEnableSplitTouch" />
</declare-styleable>
<!-- The set of attributes that describe a AlertDialog's theme. -->
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index cecf470c849e..28df99566bfa 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -1365,12 +1365,13 @@
<public type="attr" name="selectableItemBackground" />
<public type="attr" name="autoAdvanceViewId" />
<public type="attr" name="useIntrinsicSizeAsMinimum" />
-
<public type="attr" name="actionModeCutDrawable" />
<public type="attr" name="actionModeCopyDrawable" />
<public type="attr" name="actionModePasteDrawable" />
<public type="attr" name="textEditPasteWindowLayout" />
<public type="attr" name="textEditNoPasteWindowLayout" />
+ <public type="attr" name="textIsSelectable" />
+ <public type="attr" name="windowEnableSplitTouch" />
<public type="anim" name="animator_fade_in" />
<public type="anim" name="animator_fade_out" />
@@ -1440,6 +1441,4 @@
<public type="style" name="Theme.Holo.DialogWhenLarge" />
<public type="string" name="selectTextMode" />
-
- <public type="attr" name="textIsSelectable" />
</resources>
diff --git a/include/ui/InputDispatcher.h b/include/ui/InputDispatcher.h
index d09ff412dea3..15a39257957f 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 7ddb3c75ee2c..db7d4487c9bd 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;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/PhoneStatusBarService.java b/packages/SystemUI/src/com/android/systemui/statusbar/PhoneStatusBarService.java
index b174973ffba9..d3d228529fb0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/PhoneStatusBarService.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/PhoneStatusBarService.java
@@ -298,7 +298,8 @@ public class PhoneStatusBarService extends StatusBarService {
| WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
| WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
| WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
- | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
+ | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM
+ | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH,
PixelFormat.TRANSLUCENT);
lp.gravity = Gravity.TOP | Gravity.FILL_HORIZONTAL;
lp.y += height * 1.5; // FIXME
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarService.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarService.java
index 00b39c57d391..776b59caa44b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarService.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarService.java
@@ -109,7 +109,8 @@ public abstract class StatusBarService extends SystemUI implements CommandQueue.
height,
WindowManager.LayoutParams.TYPE_STATUS_BAR,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
- | WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING,
+ | WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING
+ | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH,
PixelFormat.RGBX_8888);
lp.gravity = getStatusBarGravity();
lp.setTitle("StatusBar");
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/ShirtPocket.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/ShirtPocket.java
index 7ee3c191a6e4..09c8cd2f864d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/ShirtPocket.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/ShirtPocket.java
@@ -197,7 +197,8 @@ public class ShirtPocket extends FrameLayout {
250,
WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL,
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
- | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
+ | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM
+ | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH,
PixelFormat.TRANSLUCENT);
lp.gravity = Gravity.BOTTOM | Gravity.RIGHT;
// int pos[] = new int[2];
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java
index 29f0fe2ac485..da44f4313a7d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java
@@ -153,7 +153,8 @@ public class TabletStatusBarService extends StatusBarService {
ViewGroup.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL,
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
- | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
+ | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM
+ | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH,
PixelFormat.TRANSLUCENT);
lp.gravity = Gravity.BOTTOM | Gravity.RIGHT;
lp.setTitle("NotificationPanel");
@@ -188,7 +189,8 @@ public class TabletStatusBarService extends StatusBarService {
ViewGroup.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL,
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
- | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
+ | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM
+ | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH,
PixelFormat.TRANSLUCENT);
lp.gravity = Gravity.BOTTOM | Gravity.RIGHT;
lp.setTitle("NotificationPeekWindow");
@@ -208,7 +210,8 @@ public class TabletStatusBarService extends StatusBarService {
ViewGroup.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL,
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
- | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
+ | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM
+ | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH,
PixelFormat.TRANSLUCENT);
lp.gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL;
lp.setTitle("SystemPanel");
@@ -232,7 +235,8 @@ public class TabletStatusBarService extends StatusBarService {
ViewGroup.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL,
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
- | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
+ | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM
+ | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH,
PixelFormat.TRANSLUCENT);
lp.gravity = Gravity.BOTTOM | Gravity.LEFT;
lp.setTitle("RecentsPanel");
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
index 1bded54c053c..71bf9567c01b 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
@@ -22,6 +22,7 @@ import static android.view.WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR;
import static android.view.WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
import static android.view.WindowManager.LayoutParams.FLAG_NEEDS_MENU_KEY;
+import static android.view.WindowManager.LayoutParams.FLAG_SPLIT_TOUCH;
import com.android.internal.view.BaseSurfaceHolder;
import com.android.internal.view.RootViewSurfaceTaker;
@@ -497,7 +498,8 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
WRAP_CONTENT, WRAP_CONTENT,
st.x, st.y, WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG,
WindowManager.LayoutParams.FLAG_DITHER
- | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
+ | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM
+ | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH,
st.decorView.mDefaultOpacity);
lp.gravity = st.gravity;
@@ -2164,6 +2166,12 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
setFlags(FLAG_SHOW_WALLPAPER, FLAG_SHOW_WALLPAPER&(~getForcedWindowFlags()));
}
+ if (a.getBoolean(com.android.internal.R.styleable.Window_windowEnableSplitTouch,
+ getContext().getApplicationInfo().targetSdkVersion
+ >= android.os.Build.VERSION_CODES.HONEYCOMB)) {
+ setFlags(FLAG_SPLIT_TOUCH, FLAG_SPLIT_TOUCH&(~getForcedWindowFlags()));
+ }
+
if (getContext().getApplicationInfo().targetSdkVersion
< android.os.Build.VERSION_CODES.HONEYCOMB) {
addFlags(WindowManager.LayoutParams.FLAG_NEEDS_MENU_KEY);