/** Launches the task that Recents was launched from, if possible */
  public boolean launchPreviousTask() {
    // Get the first stack view
    int childCount = getChildCount();
    for (int i = 0; i < childCount; i++) {
      View child = getChildAt(i);
      if (child != mSearchBar) {
        TaskStackView stackView = (TaskStackView) child;
        TaskStack stack = stackView.mStack;
        ArrayList<Task> tasks = stack.getTasks();

        // Find the launch task in the stack
        if (!tasks.isEmpty()) {
          int taskCount = tasks.size();
          for (int j = 0; j < taskCount; j++) {
            if (tasks.get(j).isLaunchTarget) {
              Task task = tasks.get(j);
              TaskView tv = stackView.getChildViewForTask(task);
              onTaskViewClicked(stackView, tv, stack, task, false);
              return true;
            }
          }
        }
      }
    }
    return false;
  }
Example #2
0
  /** Launches the task that Recents was launched from, if possible */
  public boolean launchPreviousTask() {
    Log.d(TAG, "launchPreviousTask: ");
    // Get the first stack view
    List<TaskStackView> stackViews = getTaskStackViews();
    int stackCount = stackViews.size();
    for (int i = 0; i < stackCount; i++) {
      TaskStackView stackView = stackViews.get(i);
      TaskStack stack = stackView.getStack();
      ArrayList<Task> tasks = stack.getTasks();

      // Find the launch task in the stack
      if (!tasks.isEmpty()) {
        int taskCount = tasks.size();
        for (int j = 0; j < taskCount; j++) {
          if (tasks.get(j).isLaunchTarget) {
            Task task = tasks.get(j);
            TaskView tv = stackView.getChildViewForTask(task);
            onTaskViewClicked(stackView, tv, stack, task, false);
            return true;
          }
        }
      }
    }
    return false;
  }