Search in sources :

Example 1 with LaunchMostRecentTaskRequestEvent

use of com.android.systemui.recents.events.activity.LaunchMostRecentTaskRequestEvent 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 2 with LaunchMostRecentTaskRequestEvent

use of com.android.systemui.recents.events.activity.LaunchMostRecentTaskRequestEvent 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 3 with LaunchMostRecentTaskRequestEvent

use of com.android.systemui.recents.events.activity.LaunchMostRecentTaskRequestEvent 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)

Example 4 with LaunchMostRecentTaskRequestEvent

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

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

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