summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Winson <winsonc@google.com> 2016-01-22 09:41:09 -0800
committer Winson <winsonc@google.com> 2016-01-22 09:41:09 -0800
commit35a8b04140598a5b5c4865254b942adb6a830991 (patch)
tree0c663f72e3374b6a8ea1c3c04983c736672592f3
parent4c84a8c481093e81c2e27de4cecf92c41992f4a1 (diff)
Fixing crash with retrieving the first stack task.
- We should be retrieving the first stack task for calculating the thumbnail transition, regardless of whether it is freeform or not. Bug: 26739531 Change-Id: I27037a480201396011d7f9b8d094b4d9afe66f0e
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java8
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java8
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java3
3 files changed, 10 insertions, 9 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java
index 3eee08766c73..f8cbf656dfa0 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java
@@ -651,7 +651,7 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub implements
mDummyStackView.updateLayoutForStack(stack);
final Task toTask = new Task();
final TaskViewTransform toTransform = getThumbnailTransitionTransform(stack, stackView,
- topTask.id, toTask);
+ toTask);
ForegroundThread.getHandler().postAtFrontOfQueue(new Runnable() {
@Override
public void run() {
@@ -721,7 +721,7 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub implements
// Update the destination rect
Task toTask = new Task();
TaskViewTransform toTransform = getThumbnailTransitionTransform(stack, stackView,
- topTask.id, toTask);
+ toTask);
RectF toTaskRect = toTransform.rect;
Bitmap thumbnail = getThumbnailBitmap(topTask, toTask, toTransform);
if (thumbnail != null) {
@@ -754,14 +754,14 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub implements
* Returns the transition rect for the given task id.
*/
private TaskViewTransform getThumbnailTransitionTransform(TaskStack stack,
- TaskStackView stackView, int runningTaskId, Task runningTaskOut) {
+ TaskStackView stackView, Task runningTaskOut) {
// Find the running task in the TaskStack
Task launchTask = stack.getLaunchTarget();
if (launchTask != null) {
runningTaskOut.copyFrom(launchTask);
} else {
// If no task is specified or we can not find the task just use the front most one
- launchTask = stack.getStackFrontMostTask();
+ launchTask = stack.getStackFrontMostTask(true /* includeFreeform */);
runningTaskOut.copyFrom(launchTask);
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java b/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java
index c73273e6f258..de1daa8ea988 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java
@@ -527,9 +527,9 @@ public class TaskStack {
*/
public void removeTask(Task t, TaskViewAnimation animation) {
if (mStackTaskList.contains(t)) {
- boolean wasFrontMostTask = (getStackFrontMostTask() == t);
+ boolean wasFrontMostTask = (getStackFrontMostTask(false /* includeFreeform */) == t);
removeTaskImpl(mStackTaskList, t);
- Task newFrontMostTask = getStackFrontMostTask();
+ Task newFrontMostTask = getStackFrontMostTask(false /* includeFreeform */);
if (mCb != null) {
// Notify that a task has been removed
mCb.onStackTaskRemoved(this, t, wasFrontMostTask, newFrontMostTask, animation);
@@ -616,14 +616,14 @@ public class TaskStack {
/**
* Gets the front-most task in the stack.
*/
- public Task getStackFrontMostTask() {
+ public Task getStackFrontMostTask(boolean includeFreeformTasks) {
ArrayList<Task> stackTasks = mStackTaskList.getTasks();
if (stackTasks.isEmpty()) {
return null;
}
for (int i = stackTasks.size() - 1; i >= 0; i--) {
Task task = stackTasks.get(i);
- if (!task.isFreeformTask()) {
+ if (!task.isFreeformTask() || includeFreeformTasks) {
return task;
}
}
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 809d4eed7a11..de045f46f9f9 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
@@ -1427,7 +1427,8 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
}
// Restore the action button visibility if it is the front most task view
- if (mScreenPinningEnabled && tv.getTask() == mStack.getStackFrontMostTask()) {
+ if (mScreenPinningEnabled && tv.getTask() ==
+ mStack.getStackFrontMostTask(false /* includeFreeform */)) {
tv.showActionButton(false /* fadeIn */, 0 /* fadeInDuration */);
}
}