Made alt-tab loop.

Change-Id: Ie80413e0cbdfe611810d8ac40c1aad65dd610193
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 0068f84..a8a18fc 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
@@ -581,10 +581,13 @@
 
         int direction = (forward ? -1 : 1);
         int newIndex = mFocusedTaskIndex + direction;
-        if (newIndex >= 0 && newIndex <= (numTasks - 1)) {
-            newIndex = Math.max(0, Math.min(numTasks - 1, newIndex));
-            focusTask(newIndex, true, animateFocusedState);
+        if (newIndex < 0) {
+            newIndex = numTasks - 1;
+        } else if (newIndex > (numTasks - 1)) {
+            newIndex = 0;
         }
+
+        focusTask(newIndex, true, animateFocusedState);
     }
 
     /** Dismisses the focused task. */
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewHeader.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewHeader.java
index 6db4020..29aef69 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewHeader.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewHeader.java
@@ -256,6 +256,12 @@
 
     /** Unbinds the bar view from the task */
     void unbindFromTask() {
+        mBackground.jumpToCurrentState();
+
+        if (mFocusAnimator != null) {
+            mFocusAnimator.cancel();
+        }
+
         mApplicationIcon.setImageDrawable(null);
     }