summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2016-11-11 23:44:29 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2016-11-11 23:44:34 +0000
commitaf6da8d62974a8003c0e977d2f6a8b865dbb07ce (patch)
treee333fc6d75236182cef5608141b6405f12bc331b
parentdf4ccaaaa84265552def10e46b81bf9e977b589d (diff)
parent058c4a2abd72752bd96a2e41790c1c5b8aff0622 (diff)
Merge "Fix a bug where the wrong task was selected coming from home"
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/grid/RecentsGridActivity.java15
1 files changed, 6 insertions, 9 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recents/grid/RecentsGridActivity.java b/packages/SystemUI/src/com/android/systemui/recents/grid/RecentsGridActivity.java
index 2c874bf9a39f..e804b52b5a8a 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/grid/RecentsGridActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/grid/RecentsGridActivity.java
@@ -60,7 +60,6 @@ import com.android.systemui.recents.model.TaskStack;
import com.android.systemui.recents.views.TaskView;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
/**
@@ -177,9 +176,7 @@ public class RecentsGridActivity extends Activity implements ViewTreeObserver.On
loadOpts.numVisibleTaskThumbnails = numVisibleTasks;
loader.loadTasks(this, plan, loadOpts);
- List<Task> stackTasks = mTaskStack.getStackTasks();
- Collections.reverse(stackTasks);
- mTasks = stackTasks;
+ mTasks = mTaskStack.getStackTasks();
updateControlVisibility();
@@ -255,7 +252,10 @@ public class RecentsGridActivity extends Activity implements ViewTreeObserver.On
removeTaskViews();
for (int i = 0; i < rects.size(); i++) {
Rect rect = rects.get(i);
- View taskView = mTaskViews.get(i);
+ // We keep the same ordering in the model as other Recents flavors (older tasks are
+ // first in the stack) so that the logic can be similar, but we reverse the order
+ // when placing views on the screen so that most recent tasks are displayed first.
+ View taskView = mTaskViews.get(rects.size() - 1 - i);
taskView.setLayoutParams(new FrameLayout.LayoutParams(rect.width(), rect.height()));
taskView.setTranslationX(rect.left);
taskView.setTranslationY(rect.top);
@@ -368,10 +368,7 @@ public class RecentsGridActivity extends Activity implements ViewTreeObserver.On
public final void onBusEvent(LaunchNextTaskRequestEvent event) {
if (mTaskStack.getTaskCount() > 0) {
- // The task to launch is the second most recent, which is at index 1 given our ordering.
- // If there is only one task, launch that one instead.
- int launchTaskIndex = (mTaskStack.getStackTaskCount() > 1) ? 1 : 0;
- Task launchTask = mTaskStack.getStackTasks().get(launchTaskIndex);
+ Task launchTask = mTaskStack.getNextLaunchTarget();
TaskView launchTaskView = getChildViewForTask(launchTask);
if (launchTaskView != null) {
EventBus.getDefault().send(new LaunchTaskEvent(launchTaskView,