disable alt-tab traversal when touching
Change-Id: I87d6d4040432b35bfaa75570a4d81b682cb7d03b
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
index 8c49ff4..aa7d238 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
@@ -220,6 +220,8 @@
mStackScroller.reset();
mStartEnterAnimationCompleted = false;
+
+ mTouchHandler.reset();
}
/** Requests that the views be synchronized with the model */
@@ -585,6 +587,10 @@
* task into view.
*/
public void focusNextTask(boolean forward) {
+ if (mTouchHandler.isTouching()) {
+ return;
+ }
+
// Find the next index to focus
int numTasks = mStack.getTaskCount();
if (numTasks == 0) return;
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java
index 25fb71e..9d8b25a 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java
@@ -57,6 +57,7 @@
float mPagingTouchSlop;
// Used to calculate when a tap is outside a task view rectangle.
final int mWindowTouchSlop;
+ boolean mIsTouching;
SwipeHelper mSwipeHelper;
boolean mInterceptedBySwipeHelper;
@@ -149,6 +150,7 @@
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN: {
// Save the touch down info
+ mIsTouching = true;
mInitialMotionX = mLastMotionX = (int) ev.getX();
mInitialMotionY = mLastMotionY = (int) ev.getY();
mInitialP = mLastP = mSv.mLayoutAlgorithm.screenYToCurveProgress(mLastMotionY);
@@ -210,7 +212,9 @@
break;
}
case MotionEvent.ACTION_CANCEL:
+ /* falls through */
case MotionEvent.ACTION_UP: {
+ mIsTouching = false;
// Animate the scroll back if we've cancelled
mScroller.animateBoundScroll();
// Reset the drag state and the velocity tracker
@@ -255,6 +259,7 @@
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN: {
// Save the touch down info
+ mIsTouching = true;
mInitialMotionX = mLastMotionX = (int) ev.getX();
mInitialMotionY = mLastMotionY = (int) ev.getY();
mInitialP = mLastP = mSv.mLayoutAlgorithm.screenYToCurveProgress(mLastMotionY);
@@ -321,6 +326,7 @@
break;
}
case MotionEvent.ACTION_UP: {
+ mIsTouching = false;
mVelocityTracker.computeCurrentVelocity(1000, mMaximumVelocity);
int velocity = (int) mVelocityTracker.getYVelocity(mActivePointerId);
if (mIsScrolling && (Math.abs(velocity) > mMinimumVelocity)) {
@@ -367,6 +373,7 @@
break;
}
case MotionEvent.ACTION_CANCEL: {
+ mIsTouching = false;
if (mScroller.isScrollOutOfBounds()) {
// Animate the scroll back into bounds
mScroller.animateBoundScroll();
@@ -447,6 +454,8 @@
@Override
public void onBeginDrag(View v) {
+ mIsTouching = true;
+
TaskView tv = (TaskView) v;
// Disable clipping with the stack while we are swiping
tv.setClipViewInStack(false);
@@ -468,6 +477,8 @@
@Override
public void onChildDismissed(View v) {
+ mIsTouching = false;
+
TaskView tv = (TaskView) v;
// Re-enable clipping with the stack (we will reuse this view)
tv.setClipViewInStack(true);
@@ -482,6 +493,8 @@
@Override
public void onSnapBackCompleted(View v) {
+ mIsTouching = false;
+
TaskView tv = (TaskView) v;
// Re-enable clipping with the stack
tv.setClipViewInStack(true);
@@ -493,6 +506,14 @@
@Override
public void onDragCancelled(View v) {
- // Do nothing
+ mIsTouching = false;
+ }
+
+ public boolean isTouching() {
+ return mIsTouching;
+ }
+
+ public void reset() {
+ mIsTouching = false;
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
index 70bbad6..adbe035 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
@@ -240,6 +240,7 @@
/** Resets this view's properties */
void resetViewProperties() {
+ unsetFocusedTask();
setDim(0);
setLayerType(View.LAYER_TYPE_NONE, null);
TaskViewTransform.reset(this);