Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 69c9e433 authored by Winson Chung's avatar Winson Chung Committed by Android (Google) Code Review
Browse files

Merge "Break out of quickscrub if task fails to launch" into ub-launcher3-master

parents d9f52ae7 f8e04b64
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@ public class QuickScrubController implements OnAlarmListener {
    private int mQuickScrubSection;
    private boolean mStartedFromHome;
    private boolean mFinishedTransitionToQuickScrub;
    private int mLaunchingTaskId;
    private Runnable mOnFinishedTransitionToQuickScrubRunnable;
    private ActivityControlHelper mActivityControlHelper;
    private TouchInteractionLog mTouchInteractionLog;
@@ -105,6 +106,7 @@ public class QuickScrubController implements OnAlarmListener {
            if (taskView != null) {
                mWaitingForTaskLaunch = true;
                mTouchInteractionLog.launchTaskStart();
                mLaunchingTaskId = taskView.getTask().key.id;
                taskView.launchTask(true, (result) -> {
                    mTouchInteractionLog.launchTaskEnd(result);
                    if (!result) {
@@ -146,6 +148,7 @@ public class QuickScrubController implements OnAlarmListener {
        mActivityControlHelper = null;
        mOnFinishedTransitionToQuickScrubRunnable = null;
        mRecentsView.setNextPageSwitchRunnable(null);
        mLaunchingTaskId = 0;
    }

    /**
@@ -211,6 +214,18 @@ public class QuickScrubController implements OnAlarmListener {
        }
    }

    public void onTaskRemoved(int taskId) {
        if (mLaunchingTaskId == taskId) {
            // The task has been removed mid-launch, break out of quickscrub and return the user
            // to where they were before (and notify the launch failed)
            TaskView taskView = mRecentsView.getTaskView(taskId);
            if (taskView != null) {
                taskView.notifyTaskLaunchFailed(TAG);
            }
            breakOutOfQuickScrub();
        }
    }

    public void snapToNextTaskIfAvailable() {
        if (mInQuickScrub && mRecentsView.getChildCount() > 0) {
            int duration = mStartedFromHome ? QUICK_SCRUB_FROM_HOME_START_DURATION
+4 −0
Original line number Diff line number Diff line
@@ -183,6 +183,10 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
            if (!mHandleTaskStackChanges) {
                return;
            }

            // Notify the quick scrub controller that a particular task has been removed
            mQuickScrubController.onTaskRemoved(taskId);

            BackgroundExecutor.get().submit(() -> {
                TaskView taskView = getTaskView(taskId);
                if (taskView == null) {