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

Commit 2e2f49e8 authored by Jerry Chang's avatar Jerry Chang Committed by Android (Google) Code Review
Browse files

Merge "Accept snapshot list when cancelling recents animation" into sc-v2-dev

parents 6ae13e1c 331f46fa
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ import com.android.quickstep.views.RecentsView;
import com.android.systemui.shared.recents.model.ThumbnailData;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Set;
import java.util.function.Supplier;
import java.util.stream.Stream;
@@ -459,7 +460,7 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
        }

        @Override
        public void onRecentsAnimationCanceled(ThumbnailData thumbnailData) {
        public void onRecentsAnimationCanceled(HashMap<Integer, ThumbnailData> thumbnailDatas) {
            endGestureStateOverride(true);
        }

+6 −4
Original line number Diff line number Diff line
@@ -121,6 +121,7 @@ import com.android.systemui.shared.system.TaskStackChangeListener;
import com.android.systemui.shared.system.TaskStackChangeListeners;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.function.Consumer;

/**
@@ -399,9 +400,10 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
        // Set up a entire animation lifecycle callback to notify the current recents view when
        // the animation is canceled
        mGestureState.runOnceAtState(STATE_RECENTS_ANIMATION_CANCELED, () -> {
                ThumbnailData snapshot = mGestureState.consumeRecentsAnimationCanceledSnapshot();
                if (snapshot != null) {
                    mRecentsView.switchToScreenshot(snapshot, () -> {
                HashMap<Integer, ThumbnailData> snapshots =
                        mGestureState.consumeRecentsAnimationCanceledSnapshot();
                if (snapshots != null) {
                    mRecentsView.switchToScreenshot(snapshots, () -> {
                        if (mRecentsAnimationController != null) {
                            mRecentsAnimationController.cleanupScreenshot();
                        }
@@ -809,7 +811,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
    }

    @Override
    public void onRecentsAnimationCanceled(ThumbnailData thumbnailData) {
    public void onRecentsAnimationCanceled(HashMap<Integer, ThumbnailData> thumbnailDatas) {
        ActiveGestureLog.INSTANCE.addLog("cancelRecentsAnimation");
        mActivityInitListener.unregister();
        mStateCallback.setStateOnUiThread(STATE_GESTURE_CANCELLED | STATE_HANDLER_INVALIDATED);
+4 −2
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ import com.android.quickstep.views.TaskView;
import com.android.systemui.shared.recents.model.ThumbnailData;
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;

import java.util.HashMap;
import java.util.function.Consumer;
import java.util.function.Predicate;

@@ -192,7 +193,8 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T

    public void closeOverlay() { }

    public void switchRunningTaskViewToScreenshot(ThumbnailData thumbnailData, Runnable runnable) {
    public void switchRunningTaskViewToScreenshot(HashMap<Integer, ThumbnailData> thumbnailDatas,
            Runnable runnable) {
        ACTIVITY_TYPE activity = getCreatedActivity();
        if (activity == null) {
            return;
@@ -204,7 +206,7 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
            }
            return;
        }
        recentsView.switchToScreenshot(thumbnailData, runnable);
        recentsView.switchToScreenshot(thumbnailDatas, runnable);
    }

    /**
+10 −8
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ import com.android.systemui.shared.system.RemoteAnimationTargetCompat;

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;

@@ -139,7 +140,7 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL
    private Set<Integer> mPreviouslyAppearedTaskIds = new HashSet<>();
    private int mLastStartedTaskId = -1;
    private RecentsAnimationController mRecentsAnimationController;
    private ThumbnailData mRecentsAnimationCanceledSnapshot;
    private HashMap<Integer, ThumbnailData> mRecentsAnimationCanceledSnapshots;

    /** The time when the swipe up gesture is triggered. */
    private long mSwipeUpStartTimeMs;
@@ -354,16 +355,16 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL
    }

    @Override
    public void onRecentsAnimationCanceled(ThumbnailData thumbnailData) {
        mRecentsAnimationCanceledSnapshot = thumbnailData;
    public void onRecentsAnimationCanceled(HashMap<Integer, ThumbnailData> thumbnailDatas) {
        mRecentsAnimationCanceledSnapshots = thumbnailDatas;
        mStateCallback.setState(STATE_RECENTS_ANIMATION_CANCELED);
        mStateCallback.setState(STATE_RECENTS_ANIMATION_ENDED);
        if (mRecentsAnimationCanceledSnapshot != null) {
        if (mRecentsAnimationCanceledSnapshots != null) {
            // Clean up the screenshot to finalize the recents animation cancel
            if (mRecentsAnimationController != null) {
                mRecentsAnimationController.cleanupScreenshot();
            }
            mRecentsAnimationCanceledSnapshot = null;
            mRecentsAnimationCanceledSnapshots = null;
        }
    }

@@ -378,9 +379,10 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL
     * while STATE_RECENTS_ANIMATION_CANCELED state is being set, and the caller is responsible for
     * calling {@link RecentsAnimationController#cleanupScreenshot()}.
     */
    ThumbnailData consumeRecentsAnimationCanceledSnapshot() {
        ThumbnailData data = mRecentsAnimationCanceledSnapshot;
        mRecentsAnimationCanceledSnapshot = null;
    HashMap<Integer, ThumbnailData> consumeRecentsAnimationCanceledSnapshot() {
        HashMap<Integer, ThumbnailData> data =
                new HashMap<Integer, ThumbnailData>(mRecentsAnimationCanceledSnapshots);
        mRecentsAnimationCanceledSnapshots = null;
        return data;
    }

+2 −1
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import com.android.systemui.shared.recents.model.ThumbnailData;
import com.android.systemui.shared.system.InteractionJankMonitorWrapper;

import java.util.ArrayList;
import java.util.HashMap;

/**
 * Helper class to handle various atomic commands for switching between Overview.
@@ -211,7 +212,7 @@ public class OverviewCommandHelper {
            }

            @Override
            public void onRecentsAnimationCanceled(ThumbnailData thumbnailData) {
            public void onRecentsAnimationCanceled(HashMap<Integer, ThumbnailData> thumbnailDatas) {
                interactionHandler.onGestureCancelled();
                cmd.removeListener(this);

Loading