Search in sources :

Example 16 with RecentsConfiguration

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

the class RecentsTvImpl method startRecentsActivity.

protected void startRecentsActivity(ActivityManager.RunningTaskInfo runningTask, ActivityOptions opts, boolean fromHome, boolean fromThumbnail) {
    // Update the configuration based on the launch options
    RecentsConfiguration config = Recents.getConfiguration();
    RecentsActivityLaunchState launchState = config.getLaunchState();
    launchState.launchedFromHome = fromHome;
    launchState.launchedFromApp = fromThumbnail;
    launchState.launchedToTaskId = (runningTask != null) ? runningTask.id : -1;
    launchState.launchedWithAltTab = mTriggeredFromAltTab;
    Intent intent = new Intent();
    intent.setClassName(RECENTS_PACKAGE, RECENTS_TV_ACTIVITY);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS | Intent.FLAG_ACTIVITY_TASK_ON_HOME);
    if (opts != null) {
        mContext.startActivityAsUser(intent, opts.toBundle(), UserHandle.CURRENT);
    } else {
        mContext.startActivityAsUser(intent, UserHandle.CURRENT);
    }
    EventBus.getDefault().send(new RecentsActivityStartingEvent());
}
Also used : RecentsActivityStartingEvent(com.android.systemui.recents.events.activity.RecentsActivityStartingEvent) RecentsActivityLaunchState(com.android.systemui.recents.RecentsActivityLaunchState) RecentsConfiguration(com.android.systemui.recents.RecentsConfiguration) Intent(android.content.Intent)

Example 17 with RecentsConfiguration

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

the class TaskStackAnimationHelper method prepareForEnterAnimation.

/**
     * Prepares the stack views and puts them in their initial animation state while visible, before
     * the in-app enter animations start (after the window-transition completes).
     */
public void prepareForEnterAnimation() {
    RecentsConfiguration config = Recents.getConfiguration();
    RecentsActivityLaunchState launchState = config.getLaunchState();
    Resources res = mStackView.getResources();
    Resources appResources = mStackView.getContext().getApplicationContext().getResources();
    TaskStackLayoutAlgorithm stackLayout = mStackView.getStackAlgorithm();
    TaskStackViewScroller stackScroller = mStackView.getScroller();
    TaskStack stack = mStackView.getStack();
    Task launchTargetTask = stack.getLaunchTarget();
    // Break early if there are no tasks
    if (stack.getTaskCount() == 0) {
        return;
    }
    int offscreenYOffset = stackLayout.mStackRect.height();
    int taskViewAffiliateGroupEnterOffset = res.getDimensionPixelSize(R.dimen.recents_task_stack_animation_affiliate_enter_offset);
    int launchedWhileDockingOffset = res.getDimensionPixelSize(R.dimen.recents_task_stack_animation_launched_while_docking_offset);
    boolean isLandscape = appResources.getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
    // Prepare each of the task views for their enter animation from front to back
    List<TaskView> taskViews = mStackView.getTaskViews();
    for (int i = taskViews.size() - 1; i >= 0; i--) {
        TaskView tv = taskViews.get(i);
        Task task = tv.getTask();
        boolean currentTaskOccludesLaunchTarget = launchTargetTask != null && launchTargetTask.group != null && launchTargetTask.group.isTaskAboveTask(task, launchTargetTask);
        boolean hideTask = launchTargetTask != null && launchTargetTask.isFreeformTask() && task.isFreeformTask();
        // Get the current transform for the task, which will be used to position it offscreen
        stackLayout.getStackTransform(task, stackScroller.getStackScroll(), mTmpTransform, null);
        if (hideTask) {
            tv.setVisibility(View.INVISIBLE);
        } else if (launchState.launchedFromApp && !launchState.launchedViaDockGesture) {
            if (task.isLaunchTarget) {
                tv.onPrepareLaunchTargetForEnterAnimation();
            } else if (currentTaskOccludesLaunchTarget) {
                // Move the task view slightly lower so we can animate it in
                mTmpTransform.rect.offset(0, taskViewAffiliateGroupEnterOffset);
                mTmpTransform.alpha = 0f;
                mStackView.updateTaskViewToTransform(tv, mTmpTransform, AnimationProps.IMMEDIATE);
                tv.setClipViewInStack(false);
            }
        } else if (launchState.launchedFromHome) {
            // Move the task view off screen (below) so we can animate it in
            mTmpTransform.rect.offset(0, offscreenYOffset);
            mTmpTransform.alpha = 0f;
            mStackView.updateTaskViewToTransform(tv, mTmpTransform, AnimationProps.IMMEDIATE);
        } else if (launchState.launchedViaDockGesture) {
            int offset = isLandscape ? launchedWhileDockingOffset : (int) (offscreenYOffset * 0.9f);
            mTmpTransform.rect.offset(0, offset);
            mTmpTransform.alpha = 0f;
            mStackView.updateTaskViewToTransform(tv, mTmpTransform, AnimationProps.IMMEDIATE);
        }
    }
}
Also used : TaskStack(com.android.systemui.recents.model.TaskStack) Task(com.android.systemui.recents.model.Task) RecentsActivityLaunchState(com.android.systemui.recents.RecentsActivityLaunchState) RecentsConfiguration(com.android.systemui.recents.RecentsConfiguration) Resources(android.content.res.Resources)

Example 18 with RecentsConfiguration

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

the class TaskStackLayoutAlgorithm method getDimensionForDevice.

/**
     * Retrieves resources that are constant regardless of the current configuration of the device.
     */
public static int getDimensionForDevice(Context ctx, int phonePortResId, int phoneLandResId, int tabletPortResId, int tabletLandResId, int xlargeTabletPortResId, int xlargeTabletLandResId, int gridLayoutResId) {
    RecentsConfiguration config = Recents.getConfiguration();
    Resources res = ctx.getResources();
    boolean isLandscape = Utilities.getAppConfiguration(ctx).orientation == Configuration.ORIENTATION_LANDSCAPE;
    if (config.isGridEnabled) {
        return res.getDimensionPixelSize(gridLayoutResId);
    } else if (config.isXLargeScreen) {
        return res.getDimensionPixelSize(isLandscape ? xlargeTabletLandResId : xlargeTabletPortResId);
    } else if (config.isLargeScreen) {
        return res.getDimensionPixelSize(isLandscape ? tabletLandResId : tabletPortResId);
    } else {
        return res.getDimensionPixelSize(isLandscape ? phoneLandResId : phonePortResId);
    }
}
Also used : RecentsConfiguration(com.android.systemui.recents.RecentsConfiguration) Resources(android.content.res.Resources)

Example 19 with RecentsConfiguration

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

the class RecentsViewTouchHandler method getDockStatesForCurrentOrientation.

/**
     * Returns the preferred dock states for the current orientation.
     */
public TaskStack.DockState[] getDockStatesForCurrentOrientation() {
    boolean isLandscape = mRv.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
    RecentsConfiguration config = Recents.getConfiguration();
    if (config.isLargeScreen) {
        return isLandscape ? DockRegion.TABLET_LANDSCAPE : DockRegion.TABLET_PORTRAIT;
    } else {
        return isLandscape ? DockRegion.PHONE_LANDSCAPE : DockRegion.PHONE_PORTRAIT;
    }
}
Also used : RecentsConfiguration(com.android.systemui.recents.RecentsConfiguration)

Example 20 with RecentsConfiguration

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

the class RecentsTvView method init.

/**
     * Initialize the view.
     */
public void init(TaskStack stack) {
    RecentsConfiguration config = Recents.getConfiguration();
    RecentsActivityLaunchState launchState = config.getLaunchState();
    mStack = stack;
    mTaskStackHorizontalView.init(stack);
    if (stack.getStackTaskCount() > 0) {
        hideEmptyView();
    } else {
        showEmptyView();
    }
    // Layout with the new stack
    requestLayout();
}
Also used : RecentsActivityLaunchState(com.android.systemui.recents.RecentsActivityLaunchState) RecentsConfiguration(com.android.systemui.recents.RecentsConfiguration)

Aggregations

RecentsConfiguration (com.android.systemui.recents.RecentsConfiguration)86 RecentsActivityLaunchState (com.android.systemui.recents.RecentsActivityLaunchState)45 Resources (android.content.res.Resources)20 Task (com.android.systemui.recents.model.Task)20 SystemServicesProxy (com.android.systemui.recents.misc.SystemServicesProxy)15 TaskStack (com.android.systemui.recents.model.TaskStack)15 ValueAnimator (android.animation.ValueAnimator)10 RecentsVisibilityChangedEvent (com.android.systemui.recents.events.component.RecentsVisibilityChangedEvent)10 Animator (android.animation.Animator)5 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)5 ActivityOptions (android.app.ActivityOptions)5 Intent (android.content.Intent)5 ActivityInfo (android.content.pm.ActivityInfo)5 BitmapDrawable (android.graphics.drawable.BitmapDrawable)5 Drawable (android.graphics.drawable.Drawable)5 View (android.view.View)5 EnterRecentsWindowAnimationCompletedEvent (com.android.systemui.recents.events.activity.EnterRecentsWindowAnimationCompletedEvent)5 RecentsActivityStartingEvent (com.android.systemui.recents.events.activity.RecentsActivityStartingEvent)5 DeleteTaskDataEvent (com.android.systemui.recents.events.ui.DeleteTaskDataEvent)5 RecentsTaskLoadPlan (com.android.systemui.recents.model.RecentsTaskLoadPlan)5