Search in sources :

Example 1 with LaunchNextTaskRequestEvent

use of com.android.systemui.recents.events.activity.LaunchNextTaskRequestEvent in project platform_frameworks_base by android.

the class TaskStackView method onMeasure.

/**
     * This is called with the full window width and height to allow stack view children to
     * perform the full screen transition down.
     */
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    mInMeasureLayout = true;
    int width = MeasureSpec.getSize(widthMeasureSpec);
    int height = MeasureSpec.getSize(heightMeasureSpec);
    // Update the stable stack bounds, but only update the current stack bounds if the stable
    // bounds have changed.  This is because we may get spurious measures while dragging where
    // our current stack bounds reflect the target drop region.
    mLayoutAlgorithm.getTaskStackBounds(mDisplayRect, new Rect(0, 0, width, height), mLayoutAlgorithm.mSystemInsets.top, mLayoutAlgorithm.mSystemInsets.left, mLayoutAlgorithm.mSystemInsets.right, mTmpRect);
    if (!mTmpRect.equals(mStableStackBounds)) {
        mStableStackBounds.set(mTmpRect);
        mStackBounds.set(mTmpRect);
        mStableWindowRect.set(0, 0, width, height);
        mWindowRect.set(0, 0, width, height);
    }
    // Compute the rects in the stack algorithm
    mStableLayoutAlgorithm.initialize(mDisplayRect, mStableWindowRect, mStableStackBounds, TaskStackLayoutAlgorithm.StackState.getStackStateForStack(mStack));
    mLayoutAlgorithm.initialize(mDisplayRect, mWindowRect, mStackBounds, TaskStackLayoutAlgorithm.StackState.getStackStateForStack(mStack));
    updateLayoutAlgorithm(false);
    // If this is the first layout, then scroll to the front of the stack, then update the
    // TaskViews with the stack so that we can lay them out
    boolean resetToInitialState = (width != mLastWidth || height != mLastHeight) && mResetToInitialStateWhenResized;
    if (mAwaitingFirstLayout || mInitialState != INITIAL_STATE_UPDATE_NONE || resetToInitialState) {
        if (mInitialState != INITIAL_STATE_UPDATE_LAYOUT_ONLY || resetToInitialState) {
            updateToInitialState();
            mResetToInitialStateWhenResized = false;
        }
        if (!mAwaitingFirstLayout) {
            mInitialState = INITIAL_STATE_UPDATE_NONE;
        }
    }
    // initial state has been updated
    if (mLaunchNextAfterFirstMeasure) {
        mLaunchNextAfterFirstMeasure = false;
        EventBus.getDefault().post(new LaunchNextTaskRequestEvent());
    }
    // Rebind all the views, including the ignore ones
    bindVisibleTaskViews(mStackScroller.getStackScroll(), false);
    // Measure each of the TaskViews
    mTmpTaskViews.clear();
    mTmpTaskViews.addAll(getTaskViews());
    mTmpTaskViews.addAll(mViewPool.getViews());
    int taskViewCount = mTmpTaskViews.size();
    for (int i = 0; i < taskViewCount; i++) {
        measureTaskView(mTmpTaskViews.get(i));
    }
    setMeasuredDimension(width, height);
    mLastWidth = width;
    mLastHeight = height;
    mInMeasureLayout = false;
}
Also used : LaunchNextTaskRequestEvent(com.android.systemui.recents.events.activity.LaunchNextTaskRequestEvent) Rect(android.graphics.Rect)

Example 2 with LaunchNextTaskRequestEvent

use of com.android.systemui.recents.events.activity.LaunchNextTaskRequestEvent in project platform_frameworks_base by android.

the class RecentsImpl method toggleRecents.

public void toggleRecents(int growTarget) {
    // Skip this toggle if we are already waiting to trigger recents via alt-tab
    if (mFastAltTabTrigger.isDozing()) {
        return;
    }
    mDraggingInRecents = false;
    mLaunchedWhileDocking = false;
    mTriggeredFromAltTab = false;
    try {
        SystemServicesProxy ssp = Recents.getSystemServices();
        MutableBoolean isHomeStackVisible = new MutableBoolean(true);
        long elapsedTime = SystemClock.elapsedRealtime() - mLastToggleTime;
        if (ssp.isRecentsActivityVisible(isHomeStackVisible)) {
            RecentsDebugFlags debugFlags = Recents.getDebugFlags();
            RecentsConfiguration config = Recents.getConfiguration();
            RecentsActivityLaunchState launchState = config.getLaunchState();
            if (!launchState.launchedWithAltTab) {
                // If the user taps quickly
                if (!debugFlags.isPagingEnabled() || (ViewConfiguration.getDoubleTapMinTime() < elapsedTime && elapsedTime < ViewConfiguration.getDoubleTapTimeout())) {
                    // Launch the next focused task
                    EventBus.getDefault().post(new LaunchNextTaskRequestEvent());
                } else {
                    // Notify recents to move onto the next task
                    EventBus.getDefault().post(new IterateRecentsEvent());
                }
            } else {
                // account
                if (elapsedTime < MIN_TOGGLE_DELAY_MS) {
                    return;
                }
                EventBus.getDefault().post(new ToggleRecentsEvent());
                mLastToggleTime = SystemClock.elapsedRealtime();
            }
            return;
        } else {
            // account
            if (elapsedTime < MIN_TOGGLE_DELAY_MS) {
                return;
            }
            // Otherwise, start the recents activity
            ActivityManager.RunningTaskInfo runningTask = ssp.getRunningTask();
            startRecentsActivity(runningTask, isHomeStackVisible.value, true, /* animate */
            growTarget);
            // Only close the other system windows if we are actually showing recents
            ssp.sendCloseSystemWindows(BaseStatusBar.SYSTEM_DIALOG_REASON_RECENT_APPS);
            mLastToggleTime = SystemClock.elapsedRealtime();
        }
    } catch (ActivityNotFoundException e) {
        Log.e(TAG, "Failed to launch RecentsActivity", e);
    }
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) LaunchNextTaskRequestEvent(com.android.systemui.recents.events.activity.LaunchNextTaskRequestEvent) ActivityNotFoundException(android.content.ActivityNotFoundException) IterateRecentsEvent(com.android.systemui.recents.events.activity.IterateRecentsEvent) MutableBoolean(android.util.MutableBoolean) ToggleRecentsEvent(com.android.systemui.recents.events.activity.ToggleRecentsEvent) ActivityManager(android.app.ActivityManager)

Example 3 with LaunchNextTaskRequestEvent

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

the class RecentsImpl method toggleRecents.

public void toggleRecents(int growTarget) {
    // Skip this toggle if we are already waiting to trigger recents via alt-tab
    if (mFastAltTabTrigger.isDozing()) {
        return;
    }
    mDraggingInRecents = false;
    mLaunchedWhileDocking = false;
    mTriggeredFromAltTab = false;
    try {
        SystemServicesProxy ssp = Recents.getSystemServices();
        MutableBoolean isHomeStackVisible = new MutableBoolean(true);
        long elapsedTime = SystemClock.elapsedRealtime() - mLastToggleTime;
        if (ssp.isRecentsActivityVisible(isHomeStackVisible)) {
            RecentsDebugFlags debugFlags = Recents.getDebugFlags();
            RecentsConfiguration config = Recents.getConfiguration();
            RecentsActivityLaunchState launchState = config.getLaunchState();
            if (!launchState.launchedWithAltTab) {
                // Has the user tapped quickly?
                boolean isQuickTap = ViewConfiguration.getDoubleTapMinTime() < elapsedTime && elapsedTime < ViewConfiguration.getDoubleTapTimeout();
                if (Recents.getConfiguration().isGridEnabled) {
                    if (isQuickTap) {
                        EventBus.getDefault().post(new LaunchNextTaskRequestEvent());
                    } else {
                        EventBus.getDefault().post(new LaunchMostRecentTaskRequestEvent());
                    }
                } else {
                    if (!debugFlags.isPagingEnabled() || isQuickTap) {
                        // Launch the next focused task
                        EventBus.getDefault().post(new LaunchNextTaskRequestEvent());
                    } else {
                        // Notify recents to move onto the next task
                        EventBus.getDefault().post(new IterateRecentsEvent());
                    }
                }
            } else {
                // account
                if (elapsedTime < MIN_TOGGLE_DELAY_MS) {
                    return;
                }
                EventBus.getDefault().post(new ToggleRecentsEvent());
                mLastToggleTime = SystemClock.elapsedRealtime();
            }
            return;
        } else {
            // account
            if (elapsedTime < MIN_TOGGLE_DELAY_MS) {
                return;
            }
            // Otherwise, start the recents activity
            ActivityManager.RunningTaskInfo runningTask = ssp.getRunningTask();
            startRecentsActivity(runningTask, isHomeStackVisible.value, true, /* animate */
            growTarget);
            // Only close the other system windows if we are actually showing recents
            ssp.sendCloseSystemWindows(BaseStatusBar.SYSTEM_DIALOG_REASON_RECENT_APPS);
            mLastToggleTime = SystemClock.elapsedRealtime();
        }
    } catch (ActivityNotFoundException e) {
        Log.e(TAG, "Failed to launch RecentsActivity", e);
    }
}
Also used : IterateRecentsEvent(com.android.systemui.recents.events.activity.IterateRecentsEvent) MutableBoolean(android.util.MutableBoolean) ToggleRecentsEvent(com.android.systemui.recents.events.activity.ToggleRecentsEvent) ActivityManager(android.app.ActivityManager) SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) LaunchNextTaskRequestEvent(com.android.systemui.recents.events.activity.LaunchNextTaskRequestEvent) ActivityNotFoundException(android.content.ActivityNotFoundException) LaunchMostRecentTaskRequestEvent(com.android.systemui.recents.events.activity.LaunchMostRecentTaskRequestEvent)

Example 4 with LaunchNextTaskRequestEvent

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

the class RecentsImpl method toggleRecents.

public void toggleRecents(int growTarget) {
    // Skip this toggle if we are already waiting to trigger recents via alt-tab
    if (mFastAltTabTrigger.isDozing()) {
        return;
    }
    mDraggingInRecents = false;
    mLaunchedWhileDocking = false;
    mTriggeredFromAltTab = false;
    try {
        SystemServicesProxy ssp = Recents.getSystemServices();
        MutableBoolean isHomeStackVisible = new MutableBoolean(true);
        long elapsedTime = SystemClock.elapsedRealtime() - mLastToggleTime;
        if (ssp.isRecentsActivityVisible(isHomeStackVisible)) {
            RecentsDebugFlags debugFlags = Recents.getDebugFlags();
            RecentsConfiguration config = Recents.getConfiguration();
            RecentsActivityLaunchState launchState = config.getLaunchState();
            if (!launchState.launchedWithAltTab) {
                // Has the user tapped quickly?
                boolean isQuickTap = ViewConfiguration.getDoubleTapMinTime() < elapsedTime && elapsedTime < ViewConfiguration.getDoubleTapTimeout();
                if (Recents.getConfiguration().isGridEnabled) {
                    if (isQuickTap) {
                        EventBus.getDefault().post(new LaunchNextTaskRequestEvent());
                    } else {
                        EventBus.getDefault().post(new LaunchMostRecentTaskRequestEvent());
                    }
                } else {
                    if (!debugFlags.isPagingEnabled() || isQuickTap) {
                        // Launch the next focused task
                        EventBus.getDefault().post(new LaunchNextTaskRequestEvent());
                    } else {
                        // Notify recents to move onto the next task
                        EventBus.getDefault().post(new IterateRecentsEvent());
                    }
                }
            } else {
                // account
                if (elapsedTime < MIN_TOGGLE_DELAY_MS) {
                    return;
                }
                EventBus.getDefault().post(new ToggleRecentsEvent());
                mLastToggleTime = SystemClock.elapsedRealtime();
            }
            return;
        } else {
            // account
            if (elapsedTime < MIN_TOGGLE_DELAY_MS) {
                return;
            }
            // Otherwise, start the recents activity
            ActivityManager.RunningTaskInfo runningTask = ssp.getRunningTask();
            startRecentsActivity(runningTask, isHomeStackVisible.value, true, /* animate */
            growTarget);
            // Only close the other system windows if we are actually showing recents
            ssp.sendCloseSystemWindows(BaseStatusBar.SYSTEM_DIALOG_REASON_RECENT_APPS);
            mLastToggleTime = SystemClock.elapsedRealtime();
        }
    } catch (ActivityNotFoundException e) {
        Log.e(TAG, "Failed to launch RecentsActivity", e);
    }
}
Also used : IterateRecentsEvent(com.android.systemui.recents.events.activity.IterateRecentsEvent) MutableBoolean(android.util.MutableBoolean) ToggleRecentsEvent(com.android.systemui.recents.events.activity.ToggleRecentsEvent) ActivityManager(android.app.ActivityManager) SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) LaunchNextTaskRequestEvent(com.android.systemui.recents.events.activity.LaunchNextTaskRequestEvent) ActivityNotFoundException(android.content.ActivityNotFoundException) LaunchMostRecentTaskRequestEvent(com.android.systemui.recents.events.activity.LaunchMostRecentTaskRequestEvent)

Example 5 with LaunchNextTaskRequestEvent

use of com.android.systemui.recents.events.activity.LaunchNextTaskRequestEvent in project android_frameworks_base by AOSPA.

the class RecentsImpl method toggleRecents.

public void toggleRecents(int growTarget) {
    // Skip this toggle if we are already waiting to trigger recents via alt-tab
    if (mFastAltTabTrigger.isDozing()) {
        return;
    }
    mDraggingInRecents = false;
    mLaunchedWhileDocking = false;
    mTriggeredFromAltTab = false;
    try {
        SystemServicesProxy ssp = Recents.getSystemServices();
        MutableBoolean isHomeStackVisible = new MutableBoolean(true);
        long elapsedTime = SystemClock.elapsedRealtime() - mLastToggleTime;
        if (ssp.isRecentsActivityVisible(isHomeStackVisible)) {
            RecentsDebugFlags debugFlags = Recents.getDebugFlags();
            RecentsConfiguration config = Recents.getConfiguration();
            RecentsActivityLaunchState launchState = config.getLaunchState();
            if (!launchState.launchedWithAltTab) {
                // Has the user tapped quickly?
                boolean isQuickTap = ViewConfiguration.getDoubleTapMinTime() < elapsedTime && elapsedTime < ViewConfiguration.getDoubleTapTimeout();
                if (Recents.getConfiguration().isGridEnabled) {
                    if (isQuickTap) {
                        EventBus.getDefault().post(new LaunchNextTaskRequestEvent());
                    } else {
                        EventBus.getDefault().post(new LaunchMostRecentTaskRequestEvent());
                    }
                } else {
                    if (!debugFlags.isPagingEnabled() || isQuickTap) {
                        // Launch the next focused task
                        EventBus.getDefault().post(new LaunchNextTaskRequestEvent());
                    } else {
                        // Notify recents to move onto the next task
                        EventBus.getDefault().post(new IterateRecentsEvent());
                    }
                }
            } else {
                // account
                if (elapsedTime < MIN_TOGGLE_DELAY_MS) {
                    return;
                }
                EventBus.getDefault().post(new ToggleRecentsEvent());
                mLastToggleTime = SystemClock.elapsedRealtime();
            }
            return;
        } else {
            // account
            if (elapsedTime < MIN_TOGGLE_DELAY_MS) {
                return;
            }
            // Otherwise, start the recents activity
            ActivityManager.RunningTaskInfo runningTask = ssp.getRunningTask();
            startRecentsActivity(runningTask, isHomeStackVisible.value, true, /* animate */
            growTarget);
            // Only close the other system windows if we are actually showing recents
            ssp.sendCloseSystemWindows(BaseStatusBar.SYSTEM_DIALOG_REASON_RECENT_APPS);
            mLastToggleTime = SystemClock.elapsedRealtime();
        }
    } catch (ActivityNotFoundException e) {
        Log.e(TAG, "Failed to launch RecentsActivity", e);
    }
}
Also used : IterateRecentsEvent(com.android.systemui.recents.events.activity.IterateRecentsEvent) MutableBoolean(android.util.MutableBoolean) ToggleRecentsEvent(com.android.systemui.recents.events.activity.ToggleRecentsEvent) ActivityManager(android.app.ActivityManager) SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) LaunchNextTaskRequestEvent(com.android.systemui.recents.events.activity.LaunchNextTaskRequestEvent) ActivityNotFoundException(android.content.ActivityNotFoundException) LaunchMostRecentTaskRequestEvent(com.android.systemui.recents.events.activity.LaunchMostRecentTaskRequestEvent)

Aggregations

LaunchNextTaskRequestEvent (com.android.systemui.recents.events.activity.LaunchNextTaskRequestEvent)10 ActivityManager (android.app.ActivityManager)5 ActivityNotFoundException (android.content.ActivityNotFoundException)5 Rect (android.graphics.Rect)5 MutableBoolean (android.util.MutableBoolean)5 IterateRecentsEvent (com.android.systemui.recents.events.activity.IterateRecentsEvent)5 ToggleRecentsEvent (com.android.systemui.recents.events.activity.ToggleRecentsEvent)5 SystemServicesProxy (com.android.systemui.recents.misc.SystemServicesProxy)5 LaunchMostRecentTaskRequestEvent (com.android.systemui.recents.events.activity.LaunchMostRecentTaskRequestEvent)4