Lines Matching defs:task

108     // How long until we reset a task when the user returns to it.  Currently
357 final TaskRecord task = mTaskHistory.get(taskNdx);
358 final ArrayList<ActivityRecord> activities = task.mActivities;
374 * @param taskId If non-zero, we'll attempt to skip over records with the same task ID.
380 TaskRecord task = mTaskHistory.get(taskNdx);
381 if (task.taskId == taskId) {
384 ArrayList<ActivityRecord> activities = task.mActivities;
397 // Iterate to find the first non-empty task stack. Note that this code can
418 final TaskRecord task = mTaskHistory.get(taskNdx);
419 if (task.taskId == id) {
420 return task;
429 final TaskRecord task = r.task;
430 if (task.mActivities.contains(r) && mTaskHistory.contains(task)) {
431 if (task.stack != this) Slog.w(TAG,
432 "Illegal state! task does not point to stack it is in.");
469 * Returns the top activity in any existing task matching the given
470 * Intent. Returns null if no such task is found.
481 if (DEBUG_TASKS) Slog.d(TAG, "Looking for task of " + target + " in " + this);
483 final TaskRecord task = mTaskHistory.get(taskNdx);
484 if (task.userId != userId) {
485 // Looking for a different task.
486 if (DEBUG_TASKS) Slog.d(TAG, "Skipping " + task + ": different user");
489 final ActivityRecord r = task.getTopActivity();
492 if (DEBUG_TASKS) Slog.d(TAG, "Skipping " + task + ": mismatch root " + r);
497 + r.task.intent.getComponent().flattenToShortString()
498 + "/aff=" + r.task.affinity + " to new cls="
500 if (task.affinity != null) {
501 if (task.affinity.equals(info.taskAffinity)) {
505 } else if (task.intent != null && task.intent.getComponent().equals(cls)) {
511 } else if (task.affinityIntent != null
512 && task.affinityIntent.getComponent().equals(cls)) {
519 Slog.d(TAG, "Not a match: " + task);
539 TaskRecord task = mTaskHistory.get(taskNdx);
540 if (task.userId != mCurrentUser) {
543 final ArrayList<ActivityRecord> activities = task.mActivities;
570 TaskRecord task = mTaskHistory.get(i);
571 if (task.userId == userId) {
573 " moving " + task + " to top");
575 mTaskHistory.add(task);
590 r.task.touchActiveTime();
591 mService.addRecentTaskLocked(r.task);
687 TaskRecord tr = who.task;
690 // If this task is being excluded from recents, we don't want to take
741 prev.task.touchActiveTime();
888 // them out. Or if r is the last of activity of the last task the stack
1020 final TaskRecord task = mTaskHistory.get(taskNdx);
1021 final ArrayList<ActivityRecord> activities = task.mActivities;
1104 } else if (task.mOnTopOfHome) {
1105 // Work our way down from r to bottom of task and see if there are any
1107 int rIndex = task.mActivities.indexOf(r);
1109 final ActivityRecord blocker = task.mActivities.get(rIndex);
1117 // Got to task bottom without finding a visible activity, show home.
1259 final TaskRecord nextTask = next.task;
1260 final TaskRecord prevTask = prev != null ? prev.task : null;
1276 // This task is going away but it was supposed to return to the home task.
1277 // Now the task above it has to return to the home task instead.
1449 mWindowManager.prepareAppTransition(prev.task == next.task
1461 mWindowManager.prepareAppTransition(prev.task == next.task
1504 next.task.touchActiveTime();
1505 mService.addRecentTaskLocked(next.task);
1564 next.task.taskId, next.shortComponentName);
1640 private void insertTaskAtTop(TaskRecord task) {
1645 if (!isHomeStack() && (fromHome || topTask() != task)) {
1646 task.mOnTopOfHome = fromHome;
1649 mTaskHistory.remove(task);
1650 // Now put task at top.
1652 if (task.userId != mCurrentUser) {
1661 mTaskHistory.add(stackNdx, task);
1666 TaskRecord rTask = r.task;
1669 // Last activity in task had been removed or ActivityManagerService is reusing task.
1675 TaskRecord task = null;
1677 // If starting in an existing task, find where that is...
1680 task = mTaskHistory.get(taskNdx);
1681 if (task == r.task) {
1686 if (DEBUG_ADD_REMOVE) Slog.i(TAG, "Adding activity " + r + " to task "
1687 + task, new RuntimeException("here").fillInStackTrace());
1688 task.addActivityToTop(r);
1690 mWindowManager.addAppToken(task.mActivities.indexOf(r), r.appToken,
1691 r.task.taskId, mStackId, r.info.screenOrientation, r.fullscreen,
1701 } else if (task.numFullscreen > 0) {
1713 if (task == r.task && mTaskHistory.indexOf(task) != (mTaskHistory.size() - 1)) {
1719 task = r.task;
1722 if (DEBUG_ADD_REMOVE) Slog.i(TAG, "Adding activity " + r + " to stack to task " + task,
1724 task.addActivityToTop(r);
1730 // switching to a new task, or the next activity's process is
1752 mWindowManager.addAppToken(task.mActivities.indexOf(r),
1753 r.appToken, r.task.taskId, mStackId, r.info.screenOrientation, r.fullscreen,
1760 // If the caller has requested that the target task be
1776 // (1) The current activity is in a different task.
1777 if (prev.task != r.task) {
1795 mWindowManager.addAppToken(task.mActivities.indexOf(r), r.appToken,
1796 r.task.taskId, mStackId, r.info.screenOrientation, r.fullscreen,
1814 TaskRecord task = mTaskHistory.get(taskNdx);
1815 final ArrayList<ActivityRecord> activities = task.mActivities;
1820 group.taskId = task.taskId;
1832 * Perform a reset of the given task, if needed as part of launching it.
1833 * Returns the new HistoryRecord at the top of the task.
1837 * We are inside of the task being reset... we'll either finish this activity, push it out
1838 * for another task, or leave it as-is.
1839 * @param task The task containing the Activity (taskTop) that might be reset.
1843 final ActivityOptions resetTargetTaskIfNeededLocked(TaskRecord task, boolean forceReset) {
1849 // We only do this for activities that are not the root of the task (since if we finish
1850 // the root, we may no longer have the task!).
1851 final ArrayList<ActivityRecord> activities = task.mActivities;
1880 && !target.taskAffinity.equals(task.affinity)) {
1882 // task, then we need to move it out of here. We will
1891 && target.taskAffinity.equals(bottom.task.affinity)) {
1893 // same task affinity as the one we are moving,
1894 // then merge it into the same task.
1895 target.setTask(bottom.task, bottom.thumbHolder, false);
1897 + " out to bottom task " + bottom.task);
1901 target.task.affinityIntent = target.intent;
1903 + " out to new task " + target.task);
1906 final TaskRecord targetTask = target.task;
1926 if (DEBUG_ADD_REMOVE) Slog.i(TAG, "Removing activity " + p + " from task="
1927 + task + " adding to task=" + targetTask,
1930 + " out to target's task " + target.task);
1945 // because it asks for it, or the task should be
1993 * TaskRecord looking for an affinity with the task of resetTaskIfNeededLocked.taskTop.
1994 * @param affinityTask The task we are looking for an affinity to.
1995 * @param task Task that resetTaskIfNeededLocked.taskTop belongs to.
1996 * @param topTaskIsHigher True if #task has already been processed by resetTaskIfNeededLocked.
1999 private int resetAffinityTaskIfNeededLocked(TaskRecord affinityTask, TaskRecord task,
2002 final int taskId = task.taskId;
2003 final String taskAffinity = task.affinity;
2029 // This activity has an affinity for our task. Either remove it if we are
2030 // clearing or move it over to our task. Note that
2032 // task that is not at the top but who has activities above
2034 // case, and we will need to later pull that task to the front
2037 // someone starts an activity in a new task from an activity
2038 // in a task that is not currently on top.)
2041 if (DEBUG_TASKS) Slog.v(TAG, "Finishing task at index " + start + " to " + i);
2051 taskInsertionPoint = task.mActivities.size();
2056 if (DEBUG_TASKS) Slog.v(TAG, "Reparenting from task=" + affinityTask + ":"
2057 + start + "-" + i + " to task=" + task + ":" + taskInsertionPoint);
2060 p.setTask(task, null, false);
2061 task.addActivityAtIndex(taskInsertionPoint, p);
2064 + " to stack at " + task,
2067 + " in to resetting task " + task);
2080 ArrayList<ActivityRecord> taskActivities = task.mActivities;
2103 && taskTop.task.getInactiveDuration() > ACTIVITY_INACTIVE_RESET_TIME) {
2109 final TaskRecord task = taskTop.task;
2112 * for remaining tasks. Used for later tasks to reparent to task. */
2118 // Preserve the location for reparenting in the new task.
2124 if (targetTask == task) {
2125 topOptions = resetTargetTaskIfNeededLocked(task, forceReset);
2128 reparentInsertionPoint = resetAffinityTaskIfNeededLocked(targetTask, task,
2133 int taskNdx = mTaskHistory.indexOf(task);
2140 // was removed from the task, propagate them to the new real top.
2277 int taskNdx = mTaskHistory.indexOf(r.task);
2278 int activityNdx = r.task.mActivities.indexOf(r);
2309 ArrayList<ActivityRecord> activities = r.task.mActivities;
2361 r.task.taskId, r.shortComponentName, reason);
2362 final ArrayList<ActivityRecord> activities = r.task.mActivities;
2367 // The next activity is now the front of the task.
2372 // be cleared when the task is reset, don't lose that information,
2438 // them out. Or if r is the last of activity of the last task the stack
2489 final TaskRecord task = srec.task;
2490 final ArrayList<ActivityRecord> activities = task.mActivities;
2492 if (!mTaskHistory.contains(task) || (start < 0)) {
2640 final TaskRecord task = r.task;
2641 if (task != null && task.removeActivity(r)) {
2644 if (mStackSupervisor.isFrontStack(this) && task == topTask() && task.mOnTopOfHome) {
2647 mStackSupervisor.removeTask(task);
2737 r.task.taskId, r.shortComponentName, reason);
2912 r.task.taskId, r.shortComponentName,
2962 final TaskRecord task = mTaskHistory.get(taskNdx);
2963 if (task.isHomeTask()) {
2964 if (DEBUG_TASKS || DEBUG_STACK) Slog.d(TAG, "moveHomeTaskToTop: moving " + task);
2966 mTaskHistory.add(top, task);
2967 mWindowManager.moveTaskToTop(task.taskId);
2974 final TaskRecord task = taskForIdLocked(taskId);
2975 if (task != null) {
2981 // we'll just indicate that this task returns to the home task.
2982 task.mOnTopOfHome = true;
2984 moveTaskToFrontLocked(task, null, options);
3008 // Shift all activities with this task up to the top
3012 if (DEBUG_TRANSITION) Slog.v(TAG, "Prepare to front transition: task=" + tr);
3037 * activities for a specific task (gathering them if disjoint) into a single group at the
3051 // current task to be selected.
3073 "Prepare to back transition: task=" + taskId);
3083 // There is an assumption that moving a task to the back moves it behind the home activity.
3088 final TaskRecord task = mTaskHistory.get(taskNdx);
3089 if (task.mOnTopOfHome) {
3093 // Set the last task before tr to go to home.
3094 task.mOnTopOfHome = true;
3114 final TaskRecord task = mResumedActivity != null ? mResumedActivity.task : null;
3115 if (task == tr && task.mOnTopOfHome || numTasks <= 1) {
3116 task.mOnTopOfHome = false;
3125 TaskRecord task) {
3130 r.userId, System.identityHashCode(r), task.taskId,
3272 r.task.taskId, r.shortComponentName);
3341 && (samePackage || r.task == lastTask)
3359 lastTask = r.task;
3376 final TaskRecord task = mTaskHistory.get(taskNdx);
3381 final ArrayList<ActivityRecord> activities = task.mActivities;
3385 // Initialize state for next task if needed.
3391 // Add 'r' into the current task.
3399 + ": task=" + r.task);
3403 ci.id = task.taskId;
3406 ci.lastActiveTime = task.lastActiveTime;
3485 final TaskRecord task = mTaskHistory.get(taskNdx);
3489 " Task id #" + task.taskId);
3551 boolean removeTask(TaskRecord task) {
3552 final int taskNdx = mTaskHistory.indexOf(task);
3554 if (task.mOnTopOfHome && taskNdx < topTaskNdx) {
3557 mTaskHistory.remove(task);
3562 TaskRecord task = new TaskRecord(taskId, info, intent);
3563 addTask(task, toTop);
3564 return task;
3571 void addTask(final TaskRecord task, final boolean toTop) {
3572 task.stack = this;
3574 insertTaskAtTop(task);
3576 mTaskHistory.add(0, task);