diff options
-rw-r--r-- | api/current.xml | 13 | ||||
-rw-r--r-- | core/java/android/widget/MediaController.java | 3 | ||||
-rw-r--r-- | core/java/android/widget/PopupWindow.java | 16 | ||||
-rwxr-xr-x | core/res/res/values/attrs.xml | 13 | ||||
-rw-r--r-- | core/res/res/values/public.xml | 5 | ||||
-rw-r--r-- | include/ui/InputDispatcher.h | 4 | ||||
-rw-r--r-- | libs/ui/InputDispatcher.cpp | 16 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/PhoneStatusBarService.java | 3 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/StatusBarService.java | 3 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/tablet/ShirtPocket.java | 3 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java | 12 | ||||
-rw-r--r-- | policy/src/com/android/internal/policy/impl/PhoneWindow.java | 10 |
12 files changed, 72 insertions, 29 deletions
diff --git a/api/current.xml b/api/current.xml index 94a2051..ed1d929 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 27a6ad3..690164c 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 95678c6..0f61cd4 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 d305260..d6684fe 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 cecf470..28df995 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 d09ff41..15a3925 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 7ddb3c7..db7d448 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 b174973..d3d2285 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 00b39c5..776b59c 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 7ee3c19..09c8cd2 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 29f0fe2..da44f43 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 1bded54..71bf956 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); |