Search in sources :

Example 6 with HideRecentsEvent

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

the class RecentsImpl method hideRecents.

public void hideRecents(boolean triggeredFromAltTab, boolean triggeredFromHomeKey) {
    if (triggeredFromAltTab && mFastAltTabTrigger.isDozing()) {
        // The user has released alt-tab before the trigger has run, so just show the next
        // task immediately
        showNextTask();
        // Cancel the fast alt-tab trigger
        mFastAltTabTrigger.stopDozing();
        return;
    }
    // Defer to the activity to handle hiding recents, if it handles it, then it must still
    // be visible
    EventBus.getDefault().post(new HideRecentsEvent(triggeredFromAltTab, triggeredFromHomeKey));
}
Also used : HideRecentsEvent(com.android.systemui.recents.events.activity.HideRecentsEvent)

Example 7 with HideRecentsEvent

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

the class TaskStackViewTouchHandler method maybeHideRecentsFromBackgroundTap.

/** Hides recents if the up event at (x, y) is a tap on the background area. */
void maybeHideRecentsFromBackgroundTap(int x, int y) {
    // Ignore the up event if it's too far from its start position. The user might have been
    // trying to scroll or swipe.
    int dx = Math.abs(mDownX - x);
    int dy = Math.abs(mDownY - y);
    if (dx > mScrollTouchSlop || dy > mScrollTouchSlop) {
        return;
    }
    // Shift the tap position toward the center of the task stack and check to see if it would
    // have hit a view. The user might have tried to tap on a task and missed slightly.
    int shiftedX = x;
    if (x > (mSv.getRight() - mSv.getLeft()) / 2) {
        shiftedX -= mWindowTouchSlop;
    } else {
        shiftedX += mWindowTouchSlop;
    }
    if (findViewAtPoint(shiftedX, y) != null) {
        return;
    }
    // Disallow tapping above and below the stack to dismiss recents
    if (x > mSv.mLayoutAlgorithm.mStackRect.left && x < mSv.mLayoutAlgorithm.mStackRect.right) {
        return;
    }
    // If tapping on the freeform workspace background, just launch the first freeform task
    SystemServicesProxy ssp = Recents.getSystemServices();
    if (ssp.hasFreeformWorkspaceSupport()) {
        Rect freeformRect = mSv.mLayoutAlgorithm.mFreeformRect;
        if (freeformRect.top <= y && y <= freeformRect.bottom) {
            if (mSv.launchFreeformTasks()) {
                // TODO: Animate Recents away as we launch the freeform tasks
                return;
            }
        }
    }
    // The user intentionally tapped on the background, which is like a tap on the "desktop".
    // Hide recents and transition to the launcher.
    EventBus.getDefault().send(new HideRecentsEvent(false, true));
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) Rect(android.graphics.Rect) HideRecentsEvent(com.android.systemui.recents.events.activity.HideRecentsEvent)

Example 8 with HideRecentsEvent

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

the class RecentsImpl method hideRecents.

public void hideRecents(boolean triggeredFromAltTab, boolean triggeredFromHomeKey) {
    if (triggeredFromAltTab && mFastAltTabTrigger.isDozing()) {
        // The user has released alt-tab before the trigger has run, so just show the next
        // task immediately
        showNextTask();
        // Cancel the fast alt-tab trigger
        mFastAltTabTrigger.stopDozing();
        return;
    }
    // Defer to the activity to handle hiding recents, if it handles it, then it must still
    // be visible
    EventBus.getDefault().post(new HideRecentsEvent(triggeredFromAltTab, triggeredFromHomeKey));
}
Also used : HideRecentsEvent(com.android.systemui.recents.events.activity.HideRecentsEvent)

Example 9 with HideRecentsEvent

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

the class TaskStackView method onBusEvent.

public final void onBusEvent(LaunchNextTaskRequestEvent event) {
    if (mAwaitingFirstLayout) {
        mLaunchNextAfterFirstMeasure = true;
        return;
    }
    final Task launchTask = mStack.getNextLaunchTarget();
    if (launchTask != null) {
        launchTask(launchTask);
        MetricsLogger.action(getContext(), MetricsEvent.OVERVIEW_LAUNCH_PREVIOUS_TASK, launchTask.key.getComponent().toString());
    } else if (mStack.getTaskCount() == 0) {
        // If there are no tasks, then just hide recents back to home.
        EventBus.getDefault().send(new HideRecentsEvent(false, true));
    }
}
Also used : Task(com.android.systemui.recents.model.Task) HideRecentsEvent(com.android.systemui.recents.events.activity.HideRecentsEvent)

Example 10 with HideRecentsEvent

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

the class TaskStackView method onBusEvent.

public final void onBusEvent(LaunchNextTaskRequestEvent event) {
    if (mAwaitingFirstLayout) {
        mLaunchNextAfterFirstMeasure = true;
        return;
    }
    final Task launchTask = mStack.getNextLaunchTarget();
    if (launchTask != null) {
        launchTask(launchTask);
        MetricsLogger.action(getContext(), MetricsEvent.OVERVIEW_LAUNCH_PREVIOUS_TASK, launchTask.key.getComponent().toString());
    } else if (mStack.getTaskCount() == 0) {
        // If there are no tasks, then just hide recents back to home.
        EventBus.getDefault().send(new HideRecentsEvent(false, true));
    }
}
Also used : Task(com.android.systemui.recents.model.Task) HideRecentsEvent(com.android.systemui.recents.events.activity.HideRecentsEvent)

Aggregations

HideRecentsEvent (com.android.systemui.recents.events.activity.HideRecentsEvent)15 Rect (android.graphics.Rect)5 SystemServicesProxy (com.android.systemui.recents.misc.SystemServicesProxy)5 Task (com.android.systemui.recents.model.Task)5 LaunchTaskEvent (com.android.systemui.recents.events.activity.LaunchTaskEvent)1