Search in sources :

Example 86 with Task

use of com.android.systemui.recents.model.Task in project android_frameworks_base by AOSPA.

the class TaskStackView method onReturnViewToPool.

@Override
public void onReturnViewToPool(TaskView tv) {
    final Task task = tv.getTask();
    // Unbind the task from the task view
    unbindTaskView(tv, task);
    // Reset the view properties and view state
    tv.clearAccessibilityFocus();
    tv.resetViewProperties();
    tv.setFocusedState(false, false);
    tv.setClipViewInStack(false);
    if (mScreenPinningEnabled) {
        tv.hideActionButton(false, /* fadeOut */
        0, /* duration */
        false, /* scaleDown */
        null);
    }
    // Detach the view from the hierarchy
    detachViewFromParent(tv);
    // Update the task views list after removing the task view
    updateTaskViewsList();
}
Also used : Task(com.android.systemui.recents.model.Task)

Example 87 with Task

use of com.android.systemui.recents.model.Task in project android_frameworks_base by AOSPA.

the class TaskStackView method onBusEvent.

public final void onBusEvent(UpdateFreeformTaskViewVisibilityEvent event) {
    List<TaskView> taskViews = getTaskViews();
    int taskViewCount = taskViews.size();
    for (int i = 0; i < taskViewCount; i++) {
        TaskView tv = taskViews.get(i);
        Task task = tv.getTask();
        if (task.isFreeformTask()) {
            tv.setVisibility(event.visible ? View.VISIBLE : View.INVISIBLE);
        }
    }
}
Also used : GridTaskView(com.android.systemui.recents.views.grid.GridTaskView) Task(com.android.systemui.recents.model.Task)

Example 88 with Task

use of com.android.systemui.recents.model.Task in project android_frameworks_base by AOSPA.

the class TaskStackView method setFocusedTask.

/**
     * Sets the focused task to the provided (bounded focusTaskIndex).
     *
     * @return whether or not the stack will scroll as a part of this focus change
     */
public boolean setFocusedTask(int focusTaskIndex, boolean scrollToTask, boolean requestViewFocus, int timerIndicatorDuration) {
    // Find the next task to focus
    int newFocusedTaskIndex = mStack.getTaskCount() > 0 ? Utilities.clamp(focusTaskIndex, 0, mStack.getTaskCount() - 1) : -1;
    final Task newFocusedTask = (newFocusedTaskIndex != -1) ? mStack.getStackTasks().get(newFocusedTaskIndex) : null;
    // Reset the last focused task state if changed
    if (mFocusedTask != null) {
        // Cancel the timer indicator, if applicable
        if (timerIndicatorDuration > 0) {
            final TaskView tv = getChildViewForTask(mFocusedTask);
            if (tv != null) {
                tv.getHeaderView().cancelFocusTimerIndicator();
            }
        }
        resetFocusedTask(mFocusedTask);
    }
    boolean willScroll = false;
    mFocusedTask = newFocusedTask;
    if (newFocusedTask != null) {
        // Start the timer indicator, if applicable
        if (timerIndicatorDuration > 0) {
            final TaskView tv = getChildViewForTask(mFocusedTask);
            if (tv != null) {
                tv.getHeaderView().startFocusTimerIndicator(timerIndicatorDuration);
            } else {
                // The view is null; set a flag for later
                mStartTimerIndicatorDuration = timerIndicatorDuration;
            }
        }
        if (scrollToTask) {
            // Cancel any running enter animations at this point when we scroll or change focus
            if (!mEnterAnimationComplete) {
                cancelAllTaskViewAnimations();
            }
            mLayoutAlgorithm.clearUnfocusedTaskOverrides();
            willScroll = mAnimationHelper.startScrollToFocusedTaskAnimation(newFocusedTask, requestViewFocus);
        } else {
            // Focus the task view
            TaskView newFocusedTaskView = getChildViewForTask(newFocusedTask);
            if (newFocusedTaskView != null) {
                newFocusedTaskView.setFocusedState(true, requestViewFocus);
            }
        }
        // Any time a task view gets the focus, we move the focus frame around it.
        if (mTaskViewFocusFrame != null) {
            mTaskViewFocusFrame.moveGridTaskViewFocus(getChildViewForTask(newFocusedTask));
        }
    }
    return willScroll;
}
Also used : Task(com.android.systemui.recents.model.Task) GridTaskView(com.android.systemui.recents.views.grid.GridTaskView)

Example 89 with Task

use of com.android.systemui.recents.model.Task in project android_frameworks_base by AOSPA.

the class TaskStackView method getCurrentTaskTransforms.

/**
     * Returns the current task transforms of all tasks, falling back to the stack layout if there
     * is no {@link TaskView} for the task.
     */
public void getCurrentTaskTransforms(ArrayList<Task> tasks, ArrayList<TaskViewTransform> transformsOut) {
    Utilities.matchTaskListSize(tasks, transformsOut);
    int focusState = mLayoutAlgorithm.getFocusState();
    for (int i = tasks.size() - 1; i >= 0; i--) {
        Task task = tasks.get(i);
        TaskViewTransform transform = transformsOut.get(i);
        TaskView tv = getChildViewForTask(task);
        if (tv != null) {
            transform.fillIn(tv);
        } else {
            mLayoutAlgorithm.getStackTransform(task, mStackScroller.getStackScroll(), focusState, transform, null, true, /* forceUpdate */
            false);
        }
        transform.visible = true;
    }
}
Also used : Task(com.android.systemui.recents.model.Task) GridTaskView(com.android.systemui.recents.views.grid.GridTaskView)

Example 90 with Task

use of com.android.systemui.recents.model.Task in project android_frameworks_base by AOSPA.

the class TaskStackView method computeVisibleTaskTransforms.

/**
     * Computes the task transforms at the current stack scroll for all visible tasks. If a valid
     * target stack scroll is provided (ie. is different than {@param curStackScroll}), then the
     * visible range includes all tasks at the target stack scroll. This is useful for ensure that
     * all views necessary for a transition or animation will be visible at the start.
     *
     * This call ignores freeform tasks.
     *
     * @param taskTransforms The set of task view transforms to reuse, this list will be sized to
     *                       match the size of {@param tasks}
     * @param tasks The set of tasks for which to generate transforms
     * @param curStackScroll The current stack scroll
     * @param targetStackScroll The stack scroll that we anticipate we are going to be scrolling to.
     *                          The range of the union of the visible views at the current and
     *                          target stack scrolls will be returned.
     * @param ignoreTasksSet The set of tasks to skip for purposes of calculaing the visible range.
     *                       Transforms will still be calculated for the ignore tasks.
     * @return the front and back most visible task indices (there may be non visible tasks in
     *         between this range)
     */
int[] computeVisibleTaskTransforms(ArrayList<TaskViewTransform> taskTransforms, ArrayList<Task> tasks, float curStackScroll, float targetStackScroll, ArraySet<Task.TaskKey> ignoreTasksSet, boolean ignoreTaskOverrides) {
    int taskCount = tasks.size();
    int[] visibleTaskRange = mTmpIntPair;
    visibleTaskRange[0] = -1;
    visibleTaskRange[1] = -1;
    boolean useTargetStackScroll = Float.compare(curStackScroll, targetStackScroll) != 0;
    // We can reuse the task transforms where possible to reduce object allocation
    Utilities.matchTaskListSize(tasks, taskTransforms);
    // Update the stack transforms
    TaskViewTransform frontTransform = null;
    TaskViewTransform frontTransformAtTarget = null;
    TaskViewTransform transform = null;
    TaskViewTransform transformAtTarget = null;
    for (int i = taskCount - 1; i >= 0; i--) {
        Task task = tasks.get(i);
        // Calculate the current and (if necessary) the target transform for the task
        transform = mLayoutAlgorithm.getStackTransform(task, curStackScroll, taskTransforms.get(i), frontTransform, ignoreTaskOverrides);
        if (useTargetStackScroll && !transform.visible) {
            // If we have a target stack scroll and the task is not currently visible, then we
            // just update the transform at the new scroll
            // TODO: Optimize this
            transformAtTarget = mLayoutAlgorithm.getStackTransform(task, targetStackScroll, new TaskViewTransform(), frontTransformAtTarget);
            if (transformAtTarget.visible) {
                transform.copyFrom(transformAtTarget);
            }
        }
        // visible stack indices
        if (ignoreTasksSet.contains(task.key)) {
            continue;
        }
        // the visible stack indices
        if (task.isFreeformTask()) {
            continue;
        }
        frontTransform = transform;
        frontTransformAtTarget = transformAtTarget;
        if (transform.visible) {
            if (visibleTaskRange[0] < 0) {
                visibleTaskRange[0] = i;
            }
            visibleTaskRange[1] = i;
        }
    }
    return visibleTaskRange;
}
Also used : Task(com.android.systemui.recents.model.Task)

Aggregations

Task (com.android.systemui.recents.model.Task)225 TaskStack (com.android.systemui.recents.model.TaskStack)56 GridTaskView (com.android.systemui.recents.views.grid.GridTaskView)43 RecentsActivityLaunchState (com.android.systemui.recents.RecentsActivityLaunchState)30 SystemServicesProxy (com.android.systemui.recents.misc.SystemServicesProxy)25 ArrayList (java.util.ArrayList)23 ActivityOptions (android.app.ActivityOptions)20 RecentsConfiguration (com.android.systemui.recents.RecentsConfiguration)20 RecentsTaskLoadPlan (com.android.systemui.recents.model.RecentsTaskLoadPlan)20 RecentsTaskLoader (com.android.systemui.recents.model.RecentsTaskLoader)20 Resources (android.content.res.Resources)15 AppTransitionAnimationSpec (android.view.AppTransitionAnimationSpec)15 LaunchTaskEvent (com.android.systemui.recents.events.activity.LaunchTaskEvent)11 TimeInterpolator (android.animation.TimeInterpolator)10 ActivityManager (android.app.ActivityManager)10 Bitmap (android.graphics.Bitmap)10 Rect (android.graphics.Rect)10 RectF (android.graphics.RectF)10 Interpolator (android.view.animation.Interpolator)10 PathInterpolator (android.view.animation.PathInterpolator)10