summaryrefslogtreecommitdiffstats
path: root/go
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2019-04-25 01:17:06 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-04-25 01:17:06 +0000
commitc2b14d9fc8419610daea48c1b15cc73c8da7057a (patch)
tree6a0a5acb5671d649c4928186f62b6366000ba194 /go
parentd0d39f1769cb54402dc3cdc284811f61e53dc6b9 (diff)
parent71d3e30fd182a7e4f43718e1b916ef702102ee8f (diff)
downloadandroid_packages_apps_Trebuchet-c2b14d9fc8419610daea48c1b15cc73c8da7057a.tar.gz
android_packages_apps_Trebuchet-c2b14d9fc8419610daea48c1b15cc73c8da7057a.tar.bz2
android_packages_apps_Trebuchet-c2b14d9fc8419610daea48c1b15cc73c8da7057a.zip
Merge "Fix overview cmd launching wrong task in landscape" into ub-launcher3-qt-dev
Diffstat (limited to 'go')
-rw-r--r--go/quickstep/src/com/android/quickstep/TaskActionController.java17
-rw-r--r--go/quickstep/src/com/android/quickstep/TaskAdapter.java3
-rw-r--r--go/quickstep/src/com/android/quickstep/views/IconRecentsView.java32
3 files changed, 39 insertions, 13 deletions
diff --git a/go/quickstep/src/com/android/quickstep/TaskActionController.java b/go/quickstep/src/com/android/quickstep/TaskActionController.java
index 09e23672d..0e921c0db 100644
--- a/go/quickstep/src/com/android/quickstep/TaskActionController.java
+++ b/go/quickstep/src/com/android/quickstep/TaskActionController.java
@@ -20,6 +20,8 @@ import static com.android.quickstep.TaskAdapter.TASKS_START_POSITION;
import android.app.ActivityOptions;
import android.view.View;
+import androidx.annotation.NonNull;
+
import com.android.quickstep.views.TaskItemView;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.system.ActivityManagerWrapper;
@@ -39,11 +41,11 @@ public final class TaskActionController {
}
/**
- * Launch the task associated with the task holder, animating into the app.
+ * Launch the task associated with the task holder, animating into the app from the task view.
*
* @param viewHolder the task view holder to launch
*/
- public void launchTask(TaskHolder viewHolder) {
+ public void launchTaskFromView(@NonNull TaskHolder viewHolder) {
if (!viewHolder.getTask().isPresent()) {
return;
}
@@ -61,6 +63,17 @@ public final class TaskActionController {
}
/**
+ * Launch the task directly with a basic animation.
+ *
+ * @param task the task to launch
+ */
+ public void launchTask(@NonNull Task task) {
+ ActivityOptions opts = ActivityOptions.makeBasic();
+ ActivityManagerWrapper.getInstance().startActivityFromRecentsAsync(task.key, opts,
+ null /* resultCallback */, null /* resultCallbackHandler */);
+ }
+
+ /**
* Removes the task holder and the task, updating the model and the view.
*
* @param viewHolder the task view holder to remove
diff --git a/go/quickstep/src/com/android/quickstep/TaskAdapter.java b/go/quickstep/src/com/android/quickstep/TaskAdapter.java
index 4f2b422e5..509bf29a4 100644
--- a/go/quickstep/src/com/android/quickstep/TaskAdapter.java
+++ b/go/quickstep/src/com/android/quickstep/TaskAdapter.java
@@ -83,7 +83,8 @@ public final class TaskAdapter extends Adapter<ViewHolder> {
TaskItemView itemView = (TaskItemView) LayoutInflater.from(parent.getContext())
.inflate(R.layout.task_item_view, parent, false);
TaskHolder taskHolder = new TaskHolder(itemView);
- itemView.setOnClickListener(view -> mTaskActionController.launchTask(taskHolder));
+ itemView.setOnClickListener(
+ view -> mTaskActionController.launchTaskFromView(taskHolder));
return taskHolder;
case ITEM_TYPE_CLEAR_ALL:
View clearView = LayoutInflater.from(parent.getContext())
diff --git a/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java b/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java
index b8c482dd9..cf6eb6d33 100644
--- a/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java
+++ b/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java
@@ -59,6 +59,8 @@ import com.android.quickstep.TaskSwipeCallback;
import com.android.systemui.shared.recents.model.Task;
import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
import java.util.Optional;
/**
@@ -263,23 +265,33 @@ public final class IconRecentsView extends FrameLayout {
* the app. In that case, we launch the next most recent.
*/
public void handleOverviewCommand() {
- // TODO(130735711): Need to address case where most recent task is off screen/unattached.
- ArrayList<TaskItemView> taskViews = getTaskViews();
- int taskViewsSize = taskViews.size();
- if (taskViewsSize <= 1) {
+ List<Task> tasks = mTaskLoader.getCurrentTaskList();
+ int tasksSize = tasks.size();
+ if (tasksSize == 0) {
// Do nothing
return;
}
- TaskHolder taskToLaunch;
- if (mTransitionedFromApp && taskViewsSize > 1) {
+ Task taskToLaunch;
+ if (mTransitionedFromApp && tasksSize > 1) {
// Launch the next most recent app
- TaskItemView itemView = taskViews.get(1);
- taskToLaunch = (TaskHolder) mTaskRecyclerView.getChildViewHolder(itemView);
+ taskToLaunch = tasks.get(1);
} else {
// Launch the most recent app
- TaskItemView itemView = taskViews.get(0);
- taskToLaunch = (TaskHolder) mTaskRecyclerView.getChildViewHolder(itemView);
+ taskToLaunch = tasks.get(0);
+ }
+
+ // See if view for this task is attached, and if so, animate launch from that view.
+ ArrayList<TaskItemView> itemViews = getTaskViews();
+ for (int i = 0, size = itemViews.size(); i < size; i++) {
+ TaskItemView taskView = itemViews.get(i);
+ TaskHolder holder = (TaskHolder) mTaskRecyclerView.getChildViewHolder(taskView);
+ if (Objects.equals(holder.getTask(), Optional.of(taskToLaunch))) {
+ mTaskActionController.launchTaskFromView(holder);
+ return;
+ }
}
+
+ // Otherwise, just use a basic launch animation.
mTaskActionController.launchTask(taskToLaunch);
}