diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index 48b327d0e5fdb..c1f971af3ea6b 100644
--- a/packages/SystemUI/res/values/config.xml
+++ b/packages/SystemUI/res/values/config.xml
@@ -109,7 +109,7 @@
700
- 3
+ 1
250
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
index 9ea346b381854..2d90e1ac35c3b 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
@@ -577,23 +577,33 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
public void onEnterAnimationTriggered() {
// Fade in the scrims
if (mConfig.hasStatusBarScrim() && mConfig.shouldAnimateStatusBarScrim()) {
- mStatusBarScrimView.setVisibility(View.VISIBLE);
mStatusBarScrimView.setTranslationY(-mStatusBarScrimView.getMeasuredHeight());
mStatusBarScrimView.animate()
.translationY(0)
.setStartDelay(mConfig.taskBarEnterAnimDelay)
.setDuration(mConfig.navBarScrimEnterDuration)
.setInterpolator(mConfig.quintOutInterpolator)
+ .withStartAction(new Runnable() {
+ @Override
+ public void run() {
+ mStatusBarScrimView.setVisibility(View.VISIBLE);
+ }
+ })
.start();
}
if (mConfig.hasNavBarScrim() && mConfig.shouldAnimateNavBarScrim()) {
- mNavBarScrimView.setVisibility(View.VISIBLE);
mNavBarScrimView.setTranslationY(mNavBarScrimView.getMeasuredHeight());
mNavBarScrimView.animate()
.translationY(0)
.setStartDelay(mConfig.taskBarEnterAnimDelay)
.setDuration(mConfig.navBarScrimEnterDuration)
.setInterpolator(mConfig.quintOutInterpolator)
+ .withStartAction(new Runnable() {
+ @Override
+ public void run() {
+ mNavBarScrimView.setVisibility(View.VISIBLE);
+ }
+ })
.start();
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/ReferenceCountedTrigger.java b/packages/SystemUI/src/com/android/systemui/recents/ReferenceCountedTrigger.java
index 2f89e6d2123d0..d52554616a899 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/ReferenceCountedTrigger.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/ReferenceCountedTrigger.java
@@ -18,6 +18,8 @@ package com.android.systemui.recents;
import android.content.Context;
+import java.util.ArrayList;
+
/**
* A ref counted trigger that does some logic when the count is first incremented, or last
* decremented. Not thread safe as it's not currently needed.
@@ -26,8 +28,8 @@ public class ReferenceCountedTrigger {
Context mContext;
int mCount;
- Runnable mFirstIncRunnable;
- Runnable mLastDecRunnable;
+ ArrayList mFirstIncRunnables = new ArrayList();
+ ArrayList mLastDecRunnables = new ArrayList();
Runnable mErrorRunnable;
// Convenience runnables
@@ -47,15 +49,18 @@ public class ReferenceCountedTrigger {
public ReferenceCountedTrigger(Context context, Runnable firstIncRunnable,
Runnable lastDecRunnable, Runnable errorRunanable) {
mContext = context;
- mFirstIncRunnable = firstIncRunnable;
- mLastDecRunnable = lastDecRunnable;
+ if (firstIncRunnable != null) mFirstIncRunnables.add(firstIncRunnable);
+ if (lastDecRunnable != null) mLastDecRunnables.add(lastDecRunnable);
mErrorRunnable = errorRunanable;
}
/** Increments the ref count */
public void increment() {
- if (mCount == 0 && mFirstIncRunnable != null) {
- mFirstIncRunnable.run();
+ if (mCount == 0 && !mFirstIncRunnables.isEmpty()) {
+ int numRunnables = mFirstIncRunnables.size();
+ for (int i = 0; i < numRunnables; i++) {
+ mFirstIncRunnables.get(i).run();
+ }
}
mCount++;
}
@@ -65,11 +70,19 @@ public class ReferenceCountedTrigger {
return mIncrementRunnable;
}
+ /** Adds a runnable to the last-decrement runnables list. */
+ public void addLastDecrementRunnable(Runnable r) {
+ mLastDecRunnables.add(r);
+ }
+
/** Decrements the ref count */
public void decrement() {
mCount--;
- if (mCount == 0 && mLastDecRunnable != null) {
- mLastDecRunnable.run();
+ if (mCount == 0 && !mLastDecRunnables.isEmpty()) {
+ int numRunnables = mLastDecRunnables.size();
+ for (int i = 0; i < numRunnables; i++) {
+ mLastDecRunnables.get(i).run();
+ }
} else if (mCount < 0) {
if (mErrorRunnable != null) {
mErrorRunnable.run();
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 55f93354544ce..8f61e72e0f3cb 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
@@ -100,6 +100,16 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
Rect mTmpRect2 = new Rect();
LayoutInflater mInflater;
+ Runnable mReturnAllViewsToPoolRunnable = new Runnable() {
+ @Override
+ public void run() {
+ int childCount = getChildCount();
+ for (int i = childCount - 1; i >= 0; i--) {
+ mViewPool.returnViewToPool((TaskView) getChildAt(i));
+ }
+ }
+ };
+
public TaskStackView(Context context, TaskStack stack) {
super(context);
mConfig = RecentsConfiguration.getInstance();
@@ -904,6 +914,9 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
TaskView tv = (TaskView) getChildAt(i);
tv.startExitToHomeAnimation(ctx);
}
+
+ // Add a runnable to the post animation ref counter to clear all the views
+ ctx.postAnimationTrigger.addLastDecrementRunnable(mReturnAllViewsToPoolRunnable);
}
@Override
@@ -936,15 +949,14 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
public void onStackTaskRemoved(TaskStack stack, Task t) {
// Remove the view associated with this task, we can't rely on updateTransforms
// to work here because the task is no longer in the list
- int childCount = getChildCount();
- for (int i = childCount - 1; i >= 0; i--) {
- TaskView tv = (TaskView) getChildAt(i);
- if (tv.getTask() == t) {
- mViewPool.returnViewToPool(tv);
- break;
- }
+ TaskView tv = getChildViewForTask(t);
+ if (tv != null) {
+ mViewPool.returnViewToPool(tv);
}
+ // Notify the callback that we've removed the task and it can clean up after it
+ mCb.onTaskRemoved(t);
+
// Update the min/max scroll and animate other task views into their new positions
updateMinMaxScroll(true);
int movement = (int) (Constants.Values.TaskStackView.StackOverlapPct * mTaskRect.height());
@@ -1193,7 +1205,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
// Request that this tasks's data be filled
RecentsTaskLoader loader = RecentsTaskLoader.getInstance();
loader.loadTaskData(task);
-
// Find the index where this task should be placed in the children
int insertIndex = -1;
int childCount = getChildCount();
@@ -1275,8 +1286,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
Task task = tv.getTask();
// Remove the task from the view
mStack.removeTask(task);
- // Notify the callback that we've removed the task and it can clean up after it
- mCb.onTaskRemoved(task);
}
/**** View.OnClickListener Implementation ****/