Search in sources :

Example 11 with EnterRecentsWindowAnimationCompletedEvent

use of com.android.systemui.recents.events.activity.EnterRecentsWindowAnimationCompletedEvent in project android_frameworks_base by DirtyUnicorns.

the class RecentsTvActivity method onEnterAnimationComplete.

@Override
public void onEnterAnimationComplete() {
    super.onEnterAnimationComplete();
    if (mLaunchedFromHome) {
        mHomeRecentsEnterExitAnimationHolder.startEnterAnimation(mPipManager.isPipShown());
    }
    EventBus.getDefault().send(new EnterRecentsWindowAnimationCompletedEvent());
}
Also used : EnterRecentsWindowAnimationCompletedEvent(com.android.systemui.recents.events.activity.EnterRecentsWindowAnimationCompletedEvent)

Example 12 with EnterRecentsWindowAnimationCompletedEvent

use of com.android.systemui.recents.events.activity.EnterRecentsWindowAnimationCompletedEvent in project android_frameworks_base by DirtyUnicorns.

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 13 with EnterRecentsWindowAnimationCompletedEvent

use of com.android.systemui.recents.events.activity.EnterRecentsWindowAnimationCompletedEvent in project android_frameworks_base by crdroidandroid.

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 14 with EnterRecentsWindowAnimationCompletedEvent

use of com.android.systemui.recents.events.activity.EnterRecentsWindowAnimationCompletedEvent in project android_frameworks_base by crdroidandroid.

the class RecentsActivity method reloadStackView.

/**
     * Reloads the stack views upon launching Recents.
     */
private void reloadStackView() {
    // If the Recents component has preloaded a load plan, then use that to prevent
    // reconstructing the task stack
    RecentsTaskLoader loader = Recents.getTaskLoader();
    RecentsTaskLoadPlan loadPlan = RecentsImpl.consumeInstanceLoadPlan();
    if (loadPlan == null) {
        loadPlan = loader.createLoadPlan(this);
    }
    // Start loading tasks according to the load plan
    RecentsConfiguration config = Recents.getConfiguration();
    RecentsActivityLaunchState launchState = config.getLaunchState();
    if (!loadPlan.hasTasks()) {
        loader.preloadTasks(loadPlan, launchState.launchedToTaskId, !launchState.launchedFromHome);
    }
    RecentsTaskLoadPlan.Options loadOpts = new RecentsTaskLoadPlan.Options();
    loadOpts.runningTaskId = launchState.launchedToTaskId;
    loadOpts.numVisibleTasks = launchState.launchedNumVisibleTasks;
    loadOpts.numVisibleTaskThumbnails = launchState.launchedNumVisibleThumbnails;
    loader.loadTasks(this, loadPlan, loadOpts);
    TaskStack stack = loadPlan.getTaskStack();
    mRecentsView.onReload(mIsVisible, stack.getTaskCount() == 0);
    mRecentsView.updateStack(stack, true);
    // Update the nav bar scrim, but defer the animation until the enter-window event
    boolean animateNavBarScrim = !launchState.launchedViaDockGesture;
    mScrimViews.updateNavBarScrim(animateNavBarScrim, stack.getTaskCount() > 0, null);
    mRecentsView.startFABanimation();
    // If this is a new instance relaunched by AM, without going through the normal mechanisms,
    // then we have to manually trigger the enter animation state
    boolean wasLaunchedByAm = !launchState.launchedFromHome && !launchState.launchedFromApp;
    if (wasLaunchedByAm) {
        EventBus.getDefault().send(new EnterRecentsWindowAnimationCompletedEvent());
    }
    // Keep track of whether we launched from the nav bar button or via alt-tab
    if (launchState.launchedWithAltTab) {
        MetricsLogger.count(this, "overview_trigger_alttab", 1);
    } else {
        MetricsLogger.count(this, "overview_trigger_nav_btn", 1);
    }
    // Keep track of whether we launched from an app or from home
    if (launchState.launchedFromApp) {
        Task launchTarget = stack.getLaunchTarget();
        int launchTaskIndexInStack = launchTarget != null ? stack.indexOfStackTask(launchTarget) : 0;
        MetricsLogger.count(this, "overview_source_app", 1);
        // If from an app, track the stack index of the app in the stack (for affiliated tasks)
        MetricsLogger.histogram(this, "overview_source_app_index", launchTaskIndexInStack);
    } else {
        MetricsLogger.count(this, "overview_source_home", 1);
    }
    // Keep track of the total stack task count
    int taskCount = mRecentsView.getStack().getTaskCount();
    MetricsLogger.histogram(this, "overview_task_count", taskCount);
    setImmersiveRecents();
    // After we have resumed, set the visible state until the next onStop() call
    mIsVisible = true;
}
Also used : EnterRecentsWindowAnimationCompletedEvent(com.android.systemui.recents.events.activity.EnterRecentsWindowAnimationCompletedEvent) ActivityOptions(android.app.ActivityOptions) TaskStack(com.android.systemui.recents.model.TaskStack) Task(com.android.systemui.recents.model.Task) AsyncTask(android.os.AsyncTask) RecentsTaskLoadPlan(com.android.systemui.recents.model.RecentsTaskLoadPlan) RecentsTaskLoader(com.android.systemui.recents.model.RecentsTaskLoader)

Example 15 with EnterRecentsWindowAnimationCompletedEvent

use of com.android.systemui.recents.events.activity.EnterRecentsWindowAnimationCompletedEvent in project android_frameworks_base by ResurrectionRemix.

the class RecentsActivity method reloadStackView.

/**
     * Reloads the stack views upon launching Recents.
     */
private void reloadStackView() {
    // If the Recents component has preloaded a load plan, then use that to prevent
    // reconstructing the task stack
    RecentsTaskLoader loader = Recents.getTaskLoader();
    RecentsTaskLoadPlan loadPlan = RecentsImpl.consumeInstanceLoadPlan();
    if (loadPlan == null) {
        loadPlan = loader.createLoadPlan(this);
    }
    // Start loading tasks according to the load plan
    RecentsConfiguration config = Recents.getConfiguration();
    RecentsActivityLaunchState launchState = config.getLaunchState();
    if (!loadPlan.hasTasks()) {
        loader.preloadTasks(loadPlan, launchState.launchedToTaskId, !launchState.launchedFromHome);
    }
    RecentsTaskLoadPlan.Options loadOpts = new RecentsTaskLoadPlan.Options();
    loadOpts.runningTaskId = launchState.launchedToTaskId;
    loadOpts.numVisibleTasks = launchState.launchedNumVisibleTasks;
    loadOpts.numVisibleTaskThumbnails = launchState.launchedNumVisibleThumbnails;
    loader.loadTasks(this, loadPlan, loadOpts);
    TaskStack stack = loadPlan.getTaskStack();
    mRecentsView.onReload(mIsVisible, stack.getTaskCount() == 0);
    mRecentsView.updateStack(stack, true);
    // Update the nav bar scrim, but defer the animation until the enter-window event
    boolean animateNavBarScrim = !launchState.launchedViaDockGesture;
    mScrimViews.updateNavBarScrim(animateNavBarScrim, stack.getTaskCount() > 0, null);
    mRecentsView.startFABanimation();
    // If this is a new instance relaunched by AM, without going through the normal mechanisms,
    // then we have to manually trigger the enter animation state
    boolean wasLaunchedByAm = !launchState.launchedFromHome && !launchState.launchedFromApp;
    if (wasLaunchedByAm) {
        EventBus.getDefault().send(new EnterRecentsWindowAnimationCompletedEvent());
    }
    // Keep track of whether we launched from the nav bar button or via alt-tab
    if (launchState.launchedWithAltTab) {
        MetricsLogger.count(this, "overview_trigger_alttab", 1);
    } else {
        MetricsLogger.count(this, "overview_trigger_nav_btn", 1);
    }
    // Keep track of whether we launched from an app or from home
    if (launchState.launchedFromApp) {
        Task launchTarget = stack.getLaunchTarget();
        int launchTaskIndexInStack = launchTarget != null ? stack.indexOfStackTask(launchTarget) : 0;
        MetricsLogger.count(this, "overview_source_app", 1);
        // If from an app, track the stack index of the app in the stack (for affiliated tasks)
        MetricsLogger.histogram(this, "overview_source_app_index", launchTaskIndexInStack);
    } else {
        MetricsLogger.count(this, "overview_source_home", 1);
    }
    // Keep track of the total stack task count
    int taskCount = mRecentsView.getStack().getTaskCount();
    MetricsLogger.histogram(this, "overview_task_count", taskCount);
    setImmersiveRecents();
    boolean showClearAllRecents = Settings.System.getIntForUser(getContentResolver(), Settings.System.SHOW_CLEAR_ALL_RECENTS, 0, UserHandle.USER_CURRENT) != 0;
    // After we have resumed, set the visible state until the next onStop() call
    mIsVisible = true;
}
Also used : EnterRecentsWindowAnimationCompletedEvent(com.android.systemui.recents.events.activity.EnterRecentsWindowAnimationCompletedEvent) ActivityOptions(android.app.ActivityOptions) TaskStack(com.android.systemui.recents.model.TaskStack) Task(com.android.systemui.recents.model.Task) AsyncTask(android.os.AsyncTask) RecentsTaskLoadPlan(com.android.systemui.recents.model.RecentsTaskLoadPlan) RecentsTaskLoader(com.android.systemui.recents.model.RecentsTaskLoader)

Aggregations

EnterRecentsWindowAnimationCompletedEvent (com.android.systemui.recents.events.activity.EnterRecentsWindowAnimationCompletedEvent)15 Task (com.android.systemui.recents.model.Task)10 ActivityOptions (android.app.ActivityOptions)5 View (android.view.View)5 RecentsActivityLaunchState (com.android.systemui.recents.RecentsActivityLaunchState)5 RecentsConfiguration (com.android.systemui.recents.RecentsConfiguration)5 RecentsVisibilityChangedEvent (com.android.systemui.recents.events.component.RecentsVisibilityChangedEvent)5 DeleteTaskDataEvent (com.android.systemui.recents.events.ui.DeleteTaskDataEvent)5 SystemServicesProxy (com.android.systemui.recents.misc.SystemServicesProxy)5 RecentsTaskLoadPlan (com.android.systemui.recents.model.RecentsTaskLoadPlan)5 RecentsTaskLoader (com.android.systemui.recents.model.RecentsTaskLoader)5 TaskStack (com.android.systemui.recents.model.TaskStack)5 RecentsTvView (com.android.systemui.recents.tv.views.RecentsTvView)5 TaskCardView (com.android.systemui.recents.tv.views.TaskCardView)5 TaskStackHorizontalGridView (com.android.systemui.recents.tv.views.TaskStackHorizontalGridView)5 AsyncTask (android.os.AsyncTask)2