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

Commit 953a8eb3 authored by Winson Chung's avatar Winson Chung
Browse files

Fix crash when swiping up from task that doesn't appear in the list

Bug: 74567248
Test: Clear all tasks, open assistant and swipe up
Change-Id: Ie5e81ffbc921f76eb6b279f38b5e7aa423fc5af2
parent d55869fa
Loading
Loading
Loading
Loading
+12 −8
Original line number Diff line number Diff line
@@ -520,6 +520,9 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {

                // Make sure the window follows the first task if it moves, e.g. during quick scrub.
                View firstTask = mRecentsView.getPageAt(0);
                // The first task may be null if we are swiping up from a task that does not
                // appear in the list (ie. the assistant)
                if (firstTask != null) {
                    int scrollForFirstTask = mRecentsView.getScrollForPage(0);
                    int offsetFromFirstTask = (scrollForFirstTask - mRecentsView.getScrollX());
                    synchronized (mTargetRect) {
@@ -529,6 +532,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
                        float offsetY = mRecentsView.getTranslationY();
                        mTargetRect.offset(offsetX, offsetY);
                    }
                }
                if (mRecentsAnimationWrapper.controller != null) {

                    // TODO: This logic is spartanic!
+5 −2
Original line number Diff line number Diff line
@@ -569,9 +569,12 @@ public abstract class RecentsView<T extends BaseActivity>
        // Load the tasks (if the loading is already
        mLoadPlanId = mModel.loadTasks(runningTaskId, this::applyLoadPlan);

        // Hide the task that we are animating into
        // Hide the task that we are animating into, ignore if there is no associated task (ie. the
        // assistant)
        if (getPageAt(mCurrentPage) != null) {
            getPageAt(mCurrentPage).setAlpha(0);
        }
    }

    public QuickScrubController getQuickScrubController() {
        return mQuickScrubController;