Search in sources :

Example 26 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)

Example 27 with RecentsConfiguration

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

the class RecentsView method onReload.

/**
     * Called from RecentsActivity when it is relaunched.
     */
public void onReload(boolean isResumingFromVisible, boolean isTaskStackEmpty) {
    RecentsConfiguration config = Recents.getConfiguration();
    RecentsActivityLaunchState launchState = config.getLaunchState();
    if (mTaskStackView == null) {
        isResumingFromVisible = false;
        mTaskStackView = new TaskStackView(getContext());
        mTaskStackView.setSystemInsets(mSystemInsets);
        addView(mTaskStackView);
    }
    // Reset the state
    mAwaitingFirstLayout = !isResumingFromVisible;
    mLastTaskLaunchedWasFreeform = false;
    // Update the stack
    mTaskStackView.onReload(isResumingFromVisible);
    if (isResumingFromVisible) {
        // If we are already visible, then restore the background scrim
        animateBackgroundScrim(1f, DEFAULT_UPDATE_SCRIM_DURATION);
    } else {
        // the tasks for the home animation.
        if (launchState.launchedViaDockGesture || launchState.launchedFromApp || isTaskStackEmpty) {
            mBackgroundScrim.setAlpha(255);
        } else {
            mBackgroundScrim.setAlpha(0);
        }
    }
}
Also used : RecentsActivityLaunchState(com.android.systemui.recents.RecentsActivityLaunchState) RecentsConfiguration(com.android.systemui.recents.RecentsConfiguration)

Example 28 with RecentsConfiguration

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

the class RecentsTvActivity method updateRecentsTasks.

private void updateRecentsTasks() {
    RecentsTaskLoader loader = Recents.getTaskLoader();
    RecentsTaskLoadPlan plan = RecentsImpl.consumeInstanceLoadPlan();
    if (plan == null) {
        plan = loader.createLoadPlan(this);
    }
    RecentsConfiguration config = Recents.getConfiguration();
    RecentsActivityLaunchState launchState = config.getLaunchState();
    if (!plan.hasTasks()) {
        loader.preloadTasks(plan, -1, !launchState.launchedFromHome);
    }
    int numVisibleTasks = TaskCardView.getNumberOfVisibleTasks(getApplicationContext());
    mLaunchedFromHome = launchState.launchedFromHome;
    TaskStack stack = plan.getTaskStack();
    RecentsTaskLoadPlan.Options loadOpts = new RecentsTaskLoadPlan.Options();
    loadOpts.runningTaskId = launchState.launchedToTaskId;
    loadOpts.numVisibleTasks = numVisibleTasks;
    loadOpts.numVisibleTaskThumbnails = numVisibleTasks;
    loader.loadTasks(this, plan, loadOpts);
    List stackTasks = stack.getStackTasks();
    Collections.reverse(stackTasks);
    if (mTaskStackViewAdapter == null) {
        mTaskStackViewAdapter = new TaskStackHorizontalViewAdapter(stackTasks);
        mTaskStackHorizontalGridView = mRecentsView.setTaskStackViewAdapter(mTaskStackViewAdapter);
        mHomeRecentsEnterExitAnimationHolder = new HomeRecentsEnterExitAnimationHolder(getApplicationContext(), mTaskStackHorizontalGridView);
    } else {
        mTaskStackViewAdapter.setNewStackTasks(stackTasks);
    }
    mRecentsView.init(stack);
    if (launchState.launchedToTaskId != -1) {
        ArrayList<Task> tasks = stack.getStackTasks();
        int taskCount = tasks.size();
        for (int i = 0; i < taskCount; i++) {
            Task t = tasks.get(i);
            if (t.key.id == launchState.launchedToTaskId) {
                t.isLaunchTarget = true;
                break;
            }
        }
    }
}
Also used : ActivityOptions(android.app.ActivityOptions) Task(com.android.systemui.recents.model.Task) RecentsTaskLoadPlan(com.android.systemui.recents.model.RecentsTaskLoadPlan) RecentsTaskLoader(com.android.systemui.recents.model.RecentsTaskLoader) HomeRecentsEnterExitAnimationHolder(com.android.systemui.recents.tv.animations.HomeRecentsEnterExitAnimationHolder) TaskStack(com.android.systemui.recents.model.TaskStack) RecentsActivityLaunchState(com.android.systemui.recents.RecentsActivityLaunchState) RecentsConfiguration(com.android.systemui.recents.RecentsConfiguration) TaskStackHorizontalViewAdapter(com.android.systemui.recents.tv.views.TaskStackHorizontalViewAdapter) ArrayList(java.util.ArrayList) List(java.util.List)

Example 29 with RecentsConfiguration

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

the class RecentsTvActivity method onResume.

@Override
public void onResume() {
    super.onResume();
    mPipRecentsOverlayManager.onRecentsResumed();
    // Update the recent tasks
    updateRecentsTasks();
    // If this is a new instance from a configuration change, then we have to manually trigger
    // the enter animation state, or if recents was relaunched by AM, without going through
    // the normal mechanisms
    RecentsConfiguration config = Recents.getConfiguration();
    RecentsActivityLaunchState launchState = config.getLaunchState();
    boolean wasLaunchedByAm = !launchState.launchedFromHome && !launchState.launchedFromApp;
    if (wasLaunchedByAm) {
        EventBus.getDefault().send(new EnterRecentsWindowAnimationCompletedEvent());
    }
    // Notify that recents is now visible
    SystemServicesProxy ssp = Recents.getSystemServices();
    EventBus.getDefault().send(new RecentsVisibilityChangedEvent(this, true));
    if (mTaskStackHorizontalGridView.getStack().getTaskCount() > 1 && !mLaunchedFromHome) {
        // If there are 2 or more tasks, and we are not launching from home
        // set the selected position to the 2nd task to allow for faster app switching
        mTaskStackHorizontalGridView.setSelectedPosition(1);
    } else {
        mTaskStackHorizontalGridView.setSelectedPosition(0);
    }
    mRecentsView.getViewTreeObserver().addOnPreDrawListener(this);
    View dismissPlaceholder = findViewById(R.id.dismiss_placeholder);
    mTalkBackEnabled = ssp.isTouchExplorationEnabled();
    if (mTalkBackEnabled) {
        dismissPlaceholder.setAccessibilityTraversalBefore(R.id.task_list);
        dismissPlaceholder.setAccessibilityTraversalAfter(R.id.dismiss_placeholder);
        mTaskStackHorizontalGridView.setAccessibilityTraversalAfter(R.id.dismiss_placeholder);
        mTaskStackHorizontalGridView.setAccessibilityTraversalBefore(R.id.pip);
        dismissPlaceholder.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                mTaskStackHorizontalGridView.requestFocus();
                mTaskStackHorizontalGridView.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED);
                Task focusedTask = mTaskStackHorizontalGridView.getFocusedTask();
                if (focusedTask != null) {
                    mTaskStackViewAdapter.removeTask(focusedTask);
                    EventBus.getDefault().send(new DeleteTaskDataEvent(focusedTask));
                }
            }
        });
    }
    // Initialize PIP UI
    if (mPipManager.isPipShown()) {
        if (mTalkBackEnabled) {
            // If talkback is on, use the mPipView to handle focus changes
            // between recents row and PIP controls.
            mPipView.setVisibility(View.VISIBLE);
        } else {
            mPipView.setVisibility(View.GONE);
        }
        // When PIP view has focus, recents overlay view will takes the focus
        // as if it's the part of the Recents UI.
        mPipRecentsOverlayManager.requestFocus(mTaskStackViewAdapter.getItemCount() > 0);
    } else {
        mPipView.setVisibility(View.GONE);
        mPipRecentsOverlayManager.removePipRecentsOverlayView();
    }
}
Also used : EnterRecentsWindowAnimationCompletedEvent(com.android.systemui.recents.events.activity.EnterRecentsWindowAnimationCompletedEvent) SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) Task(com.android.systemui.recents.model.Task) RecentsActivityLaunchState(com.android.systemui.recents.RecentsActivityLaunchState) RecentsConfiguration(com.android.systemui.recents.RecentsConfiguration) RecentsVisibilityChangedEvent(com.android.systemui.recents.events.component.RecentsVisibilityChangedEvent) DeleteTaskDataEvent(com.android.systemui.recents.events.ui.DeleteTaskDataEvent) RecentsTvView(com.android.systemui.recents.tv.views.RecentsTvView) TaskCardView(com.android.systemui.recents.tv.views.TaskCardView) TaskStackHorizontalGridView(com.android.systemui.recents.tv.views.TaskStackHorizontalGridView) View(android.view.View)

Example 30 with RecentsConfiguration

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

the class RecentsTvActivity method onStop.

@Override
protected void onStop() {
    super.onStop();
    mIgnoreAltTabRelease = false;
    // Notify that recents is now hidden
    EventBus.getDefault().send(new RecentsVisibilityChangedEvent(this, false));
    // Workaround for b/22542869, if the RecentsActivity is started again, but without going
    // through SystemUI, we need to reset the config launch flags to ensure that we do not
    // wait on the system to send a signal that was never queued.
    RecentsConfiguration config = Recents.getConfiguration();
    RecentsActivityLaunchState launchState = config.getLaunchState();
    launchState.reset();
    // Workaround for b/28333917.
    finish();
}
Also used : RecentsActivityLaunchState(com.android.systemui.recents.RecentsActivityLaunchState) RecentsConfiguration(com.android.systemui.recents.RecentsConfiguration) RecentsVisibilityChangedEvent(com.android.systemui.recents.events.component.RecentsVisibilityChangedEvent)

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