Fixing issue with swipe-dismiss animation clobbering home animation.
am: eca47ef
* commit 'eca47ef813c49c8d8cee2cdc93c296bbc59ed73b':
Fixing issue with swipe-dismiss animation clobbering home animation.
Change-Id: I7b18f4c0eaac8acbbac4b4d6ce4ad2b189095456
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java
index 270d981..fc7bba5 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java
@@ -416,7 +416,7 @@
int prevFocusState = mFocusState;
mFocusState = focusState;
updateFrontBackTransforms();
- if (mCb != null) {
+ if (mCb != null && (prevFocusState != focusState)) {
mCb.onFocusStateChanged(prevFocusState, focusState);
}
}
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 48f9453..6732b17 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
@@ -647,7 +647,7 @@
*/
private void relayoutTaskViews(AnimationProps animation, boolean ignoreTaskOverrides) {
// If we had a deferred animation, cancel that
- mDeferredTaskViewLayoutAnimation = null;
+ cancelDeferredTaskViewLayoutAnimation();
// Synchronize the current set of TaskViews
bindVisibleTaskViews(mStackScroller.getStackScroll(),
@@ -739,23 +739,12 @@
/**
* Cancels all {@link TaskView} animations.
- *
- * @see #cancelAllTaskViewAnimations(ArraySet<Task.TaskKey>)
*/
void cancelAllTaskViewAnimations() {
- cancelAllTaskViewAnimations(mIgnoreTasks);
- }
-
- /**
- * Cancels all {@link TaskView} animations.
- *
- * @param ignoreTasksSet The set of tasks to continue running their animations.
- */
- void cancelAllTaskViewAnimations(ArraySet<Task.TaskKey> ignoreTasksSet) {
List<TaskView> taskViews = getTaskViews();
for (int i = taskViews.size() - 1; i >= 0; i--) {
final TaskView tv = taskViews.get(i);
- if (!ignoreTasksSet.contains(tv.getTask().key)) {
+ if (!mIgnoreTasks.contains(tv.getTask().key)) {
tv.cancelTransformAnimation();
}
}
@@ -1675,8 +1664,10 @@
public final void onBusEvent(DismissRecentsToHomeAnimationStarted event) {
// Stop any scrolling
+ cancelDeferredTaskViewLayoutAnimation();
mStackScroller.stopScroller();
mStackScroller.stopBoundScrollAnimation();
+ mTouchHandler.finishAnimations();
// Start the task animations
mAnimationHelper.startExitToHomeAnimation(event.animated, event.getAnimationTrigger());
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 9edf9d6..81242fd 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java
@@ -188,6 +188,18 @@
return true;
}
+ /**
+ * Finishes all scroll-fling and swipe animations currently running.
+ */
+ public void finishAnimations() {
+ Utilities.cancelAnimationWithoutCallbacks(mScrollFlingAnimator);
+ ArrayMap<View, Animator> existingAnimators = new ArrayMap<>(mSwipeHelperAnimations);
+ for (int i = 0; i < existingAnimators.size(); i++) {
+ existingAnimators.get(existingAnimators.keyAt(i)).end();
+ }
+ mSwipeHelperAnimations.clear();
+ }
+
private boolean handleTouchEvent(MotionEvent ev) {
// Short circuit if we have no children
if (mSv.getTaskViews().size() == 0) {
@@ -207,19 +219,11 @@
mActiveTaskView = findViewAtPoint(mDownX, mDownY);
// Stop the current scroll if it is still flinging
+ mSv.cancelDeferredTaskViewLayoutAnimation();
mScroller.stopScroller();
mScroller.stopBoundScrollAnimation();
mScroller.resetDeltaScroll();
- Utilities.cancelAnimationWithoutCallbacks(mScrollFlingAnimator);
-
- // Finish any existing task animations from the delete
- mSv.cancelAllTaskViewAnimations();
- // Finish any of the swipe helper animations
- ArrayMap<View, Animator> existingAnimators = new ArrayMap<>(mSwipeHelperAnimations);
- for (int i = 0; i < existingAnimators.size(); i++) {
- existingAnimators.get(existingAnimators.keyAt(i)).end();
- }
- mSwipeHelperAnimations.clear();
+ finishAnimations();
// Initialize the velocity tracker
initOrResetVelocityTracker();