Search in sources :

Example 31 with MutableBoolean

use of android.util.MutableBoolean in project android_frameworks_base by ResurrectionRemix.

the class RecentsImpl method showRecents.

public void showRecents(boolean triggeredFromAltTab, boolean draggingInRecents, boolean animate, boolean launchedWhileDockingTask, boolean fromHome, int growTarget) {
    mTriggeredFromAltTab = triggeredFromAltTab;
    mDraggingInRecents = draggingInRecents;
    mLaunchedWhileDocking = launchedWhileDockingTask;
    if (mFastAltTabTrigger.isAsleep()) {
        // Fast alt-tab duration has elapsed, fall through to showing Recents and reset
        mFastAltTabTrigger.stopDozing();
    } else if (mFastAltTabTrigger.isDozing()) {
        //       is inversely proportional to the FAST_ALT_TAB_DELAY_MS duration though.
        if (!triggeredFromAltTab) {
            return;
        }
        mFastAltTabTrigger.stopDozing();
    } else if (triggeredFromAltTab) {
        // The fast alt-tab detector is not yet running, so start the trigger and wait for the
        // hideRecents() call, or for the fast alt-tab duration to elapse
        mFastAltTabTrigger.startDozing();
        return;
    }
    try {
        // Check if the top task is in the home stack, and start the recents activity
        SystemServicesProxy ssp = Recents.getSystemServices();
        boolean forceVisible = launchedWhileDockingTask || draggingInRecents;
        MutableBoolean isHomeStackVisible = new MutableBoolean(forceVisible);
        if (forceVisible || !ssp.isRecentsActivityVisible(isHomeStackVisible)) {
            ActivityManager.RunningTaskInfo runningTask = ssp.getRunningTask();
            startRecentsActivity(runningTask, isHomeStackVisible.value || fromHome, animate, growTarget);
        }
    } catch (ActivityNotFoundException e) {
        Log.e(TAG, "Failed to launch RecentsActivity", e);
    }
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) ActivityNotFoundException(android.content.ActivityNotFoundException) MutableBoolean(android.util.MutableBoolean) ActivityManager(android.app.ActivityManager)

Example 32 with MutableBoolean

use of android.util.MutableBoolean in project android_frameworks_base by ResurrectionRemix.

the class RecentsImpl method preloadRecents.

public void preloadRecents() {
    // Preload only the raw task list into a new load plan (which will be consumed by the
    // RecentsActivity) only if there is a task to animate to.
    SystemServicesProxy ssp = Recents.getSystemServices();
    MutableBoolean isHomeStackVisible = new MutableBoolean(true);
    if (!ssp.isRecentsActivityVisible(isHomeStackVisible)) {
        ActivityManager.RunningTaskInfo runningTask = ssp.getRunningTask();
        RecentsTaskLoader loader = Recents.getTaskLoader();
        sInstanceLoadPlan = loader.createLoadPlan(mContext);
        sInstanceLoadPlan.preloadRawTasks(!isHomeStackVisible.value);
        loader.preloadTasks(sInstanceLoadPlan, runningTask.id, !isHomeStackVisible.value);
        TaskStack stack = sInstanceLoadPlan.getTaskStack();
        if (stack.getTaskCount() > 0) {
            // Only preload the icon (but not the thumbnail since it may not have been taken for
            // the pausing activity)
            preloadIcon(runningTask.id);
            // At this point, we don't know anything about the stack state.  So only calculate
            // the dimensions of the thumbnail that we need for the transition into Recents, but
            // do not draw it until we construct the activity options when we start Recents
            updateHeaderBarLayout(stack, null);
        }
    }
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) TaskStack(com.android.systemui.recents.model.TaskStack) MutableBoolean(android.util.MutableBoolean) RecentsTaskLoader(com.android.systemui.recents.model.RecentsTaskLoader) ActivityManager(android.app.ActivityManager)

Example 33 with MutableBoolean

use of android.util.MutableBoolean in project android_frameworks_base by DirtyUnicorns.

the class RecentsImpl method showRecents.

public void showRecents(boolean triggeredFromAltTab, boolean draggingInRecents, boolean animate, boolean launchedWhileDockingTask, boolean fromHome, int growTarget) {
    mTriggeredFromAltTab = triggeredFromAltTab;
    mDraggingInRecents = draggingInRecents;
    mLaunchedWhileDocking = launchedWhileDockingTask;
    if (mFastAltTabTrigger.isAsleep()) {
        // Fast alt-tab duration has elapsed, fall through to showing Recents and reset
        mFastAltTabTrigger.stopDozing();
    } else if (mFastAltTabTrigger.isDozing()) {
        //       is inversely proportional to the FAST_ALT_TAB_DELAY_MS duration though.
        if (!triggeredFromAltTab) {
            return;
        }
        mFastAltTabTrigger.stopDozing();
    } else if (triggeredFromAltTab) {
        // The fast alt-tab detector is not yet running, so start the trigger and wait for the
        // hideRecents() call, or for the fast alt-tab duration to elapse
        mFastAltTabTrigger.startDozing();
        return;
    }
    try {
        // Check if the top task is in the home stack, and start the recents activity
        SystemServicesProxy ssp = Recents.getSystemServices();
        boolean forceVisible = launchedWhileDockingTask || draggingInRecents;
        MutableBoolean isHomeStackVisible = new MutableBoolean(forceVisible);
        if (forceVisible || !ssp.isRecentsActivityVisible(isHomeStackVisible)) {
            ActivityManager.RunningTaskInfo runningTask = ssp.getRunningTask();
            startRecentsActivity(runningTask, isHomeStackVisible.value || fromHome, animate, growTarget);
        }
    } catch (ActivityNotFoundException e) {
        Log.e(TAG, "Failed to launch RecentsActivity", e);
    }
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) ActivityNotFoundException(android.content.ActivityNotFoundException) MutableBoolean(android.util.MutableBoolean) ActivityManager(android.app.ActivityManager)

Example 34 with MutableBoolean

use of android.util.MutableBoolean in project android_frameworks_base by DirtyUnicorns.

the class TaskStackViewTouchHandler method onBeginDrag.

@Override
public void onBeginDrag(View v) {
    TaskView tv = (TaskView) v;
    // Disable clipping with the stack while we are swiping
    tv.setClipViewInStack(false);
    // Disallow touch events from this task view
    tv.setTouchEnabled(false);
    // Disallow parents from intercepting touch events
    final ViewParent parent = mSv.getParent();
    if (parent != null) {
        parent.requestDisallowInterceptTouchEvent(true);
    }
    // Add this task to the set of tasks we are deleting
    mSv.addIgnoreTask(tv.getTask());
    // Determine if we are animating the other tasks while dismissing this task
    mCurrentTasks = new ArrayList<Task>(mSv.getStack().getStackTasks());
    MutableBoolean isFrontMostTask = new MutableBoolean(false);
    Task anchorTask = mSv.findAnchorTask(mCurrentTasks, isFrontMostTask);
    TaskStackLayoutAlgorithm layoutAlgorithm = mSv.getStackAlgorithm();
    TaskStackViewScroller stackScroller = mSv.getScroller();
    if (anchorTask != null) {
        // Get the current set of task transforms
        mSv.getCurrentTaskTransforms(mCurrentTasks, mCurrentTaskTransforms);
        // Get the stack scroll of the task to anchor to (since we are removing something, the
        // front most task will be our anchor task)
        float prevAnchorTaskScroll = 0;
        boolean pullStackForward = mCurrentTasks.size() > 0;
        if (pullStackForward) {
            prevAnchorTaskScroll = layoutAlgorithm.getStackScrollForTask(anchorTask);
        }
        // Calculate where the views would be without the deleting tasks
        mSv.updateLayoutAlgorithm(false);
        float newStackScroll = stackScroller.getStackScroll();
        if (isFrontMostTask.value) {
            // Bound the stack scroll to pull tasks forward if necessary
            newStackScroll = stackScroller.getBoundedStackScroll(newStackScroll);
        } else if (pullStackForward) {
            // Otherwise, offset the scroll by the movement of the anchor task
            float anchorTaskScroll = layoutAlgorithm.getStackScrollForTaskIgnoreOverrides(anchorTask);
            float stackScrollOffset = (anchorTaskScroll - prevAnchorTaskScroll);
            if (layoutAlgorithm.getFocusState() != TaskStackLayoutAlgorithm.STATE_FOCUSED) {
                // If we are focused, we don't want the front task to move, but otherwise, we
                // allow the back task to move up, and the front task to move back
                stackScrollOffset *= 0.75f;
            }
            newStackScroll = stackScroller.getBoundedStackScroll(stackScroller.getStackScroll() + stackScrollOffset);
        }
        // Pick up the newly visible views, not including the deleting tasks
        mSv.bindVisibleTaskViews(newStackScroll, true);
        // Get the final set of task transforms (with task removed)
        mSv.getLayoutTaskTransforms(newStackScroll, TaskStackLayoutAlgorithm.STATE_UNFOCUSED, mCurrentTasks, true, /* ignoreTaskOverrides */
        mFinalTaskTransforms);
        // Set the target to scroll towards upon dismissal
        mTargetStackScroll = newStackScroll;
    /*
             * Post condition: All views that will be visible as a part of the gesture are retrieved
             *                 and at their initial positions.  The stack is still at the current
             *                 scroll, but the layout is updated without the task currently being
             *                 dismissed.  The final layout is in the unfocused stack state, which
             *                 will be applied when the current task is dismissed.
             */
    }
}
Also used : Task(com.android.systemui.recents.model.Task) ViewParent(android.view.ViewParent) MutableBoolean(android.util.MutableBoolean)

Example 35 with MutableBoolean

use of android.util.MutableBoolean in project android_frameworks_base by crdroidandroid.

the class RecentsImpl method showRecents.

public void showRecents(boolean triggeredFromAltTab, boolean draggingInRecents, boolean animate, boolean launchedWhileDockingTask, boolean fromHome, int growTarget) {
    mTriggeredFromAltTab = triggeredFromAltTab;
    mDraggingInRecents = draggingInRecents;
    mLaunchedWhileDocking = launchedWhileDockingTask;
    if (mFastAltTabTrigger.isAsleep()) {
        // Fast alt-tab duration has elapsed, fall through to showing Recents and reset
        mFastAltTabTrigger.stopDozing();
    } else if (mFastAltTabTrigger.isDozing()) {
        //       is inversely proportional to the FAST_ALT_TAB_DELAY_MS duration though.
        if (!triggeredFromAltTab) {
            return;
        }
        mFastAltTabTrigger.stopDozing();
    } else if (triggeredFromAltTab) {
        // The fast alt-tab detector is not yet running, so start the trigger and wait for the
        // hideRecents() call, or for the fast alt-tab duration to elapse
        mFastAltTabTrigger.startDozing();
        return;
    }
    try {
        // Check if the top task is in the home stack, and start the recents activity
        SystemServicesProxy ssp = Recents.getSystemServices();
        boolean forceVisible = launchedWhileDockingTask || draggingInRecents;
        MutableBoolean isHomeStackVisible = new MutableBoolean(forceVisible);
        if (forceVisible || !ssp.isRecentsActivityVisible(isHomeStackVisible)) {
            ActivityManager.RunningTaskInfo runningTask = ssp.getRunningTask();
            startRecentsActivity(runningTask, isHomeStackVisible.value || fromHome, animate, growTarget);
        }
    } catch (ActivityNotFoundException e) {
        Log.e(TAG, "Failed to launch RecentsActivity", e);
    }
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) ActivityNotFoundException(android.content.ActivityNotFoundException) MutableBoolean(android.util.MutableBoolean) ActivityManager(android.app.ActivityManager)

Aggregations

MutableBoolean (android.util.MutableBoolean)38 ActivityManager (android.app.ActivityManager)15 SystemServicesProxy (com.android.systemui.recents.misc.SystemServicesProxy)15 ActivityNotFoundException (android.content.ActivityNotFoundException)10 ApplicationInfo (android.content.pm.ApplicationInfo)5 LongSparseArray (android.util.LongSparseArray)5 Pair (android.util.Pair)5 SparseArray (android.util.SparseArray)5 ViewParent (android.view.ViewParent)5 IterateRecentsEvent (com.android.systemui.recents.events.activity.IterateRecentsEvent)5 LaunchNextTaskRequestEvent (com.android.systemui.recents.events.activity.LaunchNextTaskRequestEvent)5 ToggleRecentsEvent (com.android.systemui.recents.events.activity.ToggleRecentsEvent)5 RecentsTaskLoader (com.android.systemui.recents.model.RecentsTaskLoader)5 Task (com.android.systemui.recents.model.Task)5 TaskStack (com.android.systemui.recents.model.TaskStack)5 Method (java.lang.reflect.Method)5 ArrayList (java.util.ArrayList)5 LaunchMostRecentTaskRequestEvent (com.android.systemui.recents.events.activity.LaunchMostRecentTaskRequestEvent)4 CursorWindow (android.database.CursorWindow)1 DbStats (android.database.sqlite.SQLiteDebug.DbStats)1