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

Commit ac9cee5a authored by Fedor Kudasov's avatar Fedor Kudasov
Browse files

Annotate RecentsView with @Nullable

Bug: 205828770
Test: m LauncherGoResLib
Change-Id: I44a4f7ce4258e54d43ca2c5a3937c81a4a686f80
parent 3618de30
Loading
Loading
Loading
Loading
+38 −5
Original line number Original line Diff line number Diff line
@@ -157,6 +157,7 @@ import com.android.quickstep.TaskOverlayFactory;
import com.android.quickstep.TaskThumbnailCache;
import com.android.quickstep.TaskThumbnailCache;
import com.android.quickstep.TaskViewUtils;
import com.android.quickstep.TaskViewUtils;
import com.android.quickstep.ViewUtils;
import com.android.quickstep.ViewUtils;
import com.android.quickstep.util.GroupTask;
import com.android.quickstep.util.LayoutUtils;
import com.android.quickstep.util.LayoutUtils;
import com.android.quickstep.util.RecentsOrientedState;
import com.android.quickstep.util.RecentsOrientedState;
import com.android.quickstep.util.SplitScreenBounds;
import com.android.quickstep.util.SplitScreenBounds;
@@ -166,7 +167,6 @@ import com.android.quickstep.util.TaskViewSimulator;
import com.android.quickstep.util.TransformParams;
import com.android.quickstep.util.TransformParams;
import com.android.quickstep.util.VibratorWrapper;
import com.android.quickstep.util.VibratorWrapper;
import com.android.systemui.plugins.ResourceProvider;
import com.android.systemui.plugins.ResourceProvider;
import com.android.quickstep.util.GroupTask;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.recents.model.Task.TaskKey;
import com.android.systemui.shared.recents.model.Task.TaskKey;
import com.android.systemui.shared.recents.model.ThumbnailData;
import com.android.systemui.shared.recents.model.ThumbnailData;
@@ -383,7 +383,9 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T


    protected final RecentsOrientedState mOrientationState;
    protected final RecentsOrientedState mOrientationState;
    protected final BaseActivityInterface<STATE_TYPE, ACTIVITY_TYPE> mSizeStrategy;
    protected final BaseActivityInterface<STATE_TYPE, ACTIVITY_TYPE> mSizeStrategy;
    @Nullable
    protected RecentsAnimationController mRecentsAnimationController;
    protected RecentsAnimationController mRecentsAnimationController;
    @Nullable
    protected SurfaceTransactionApplier mSyncTransactionApplier;
    protected SurfaceTransactionApplier mSyncTransactionApplier;
    protected int mTaskWidth;
    protected int mTaskWidth;
    protected int mTaskHeight;
    protected int mTaskHeight;
@@ -394,12 +396,15 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
    // mTaskGridVerticalDiff and mTopBottomRowHeightDiff summed together provides the top
    // mTaskGridVerticalDiff and mTopBottomRowHeightDiff summed together provides the top
    // position for bottom row of grid tasks.
    // position for bottom row of grid tasks.


    @Nullable
    protected RemoteTargetHandle[] mRemoteTargetHandles;
    protected RemoteTargetHandle[] mRemoteTargetHandles;
    protected final Rect mLastComputedTaskSize = new Rect();
    protected final Rect mLastComputedTaskSize = new Rect();
    protected final Rect mLastComputedGridSize = new Rect();
    protected final Rect mLastComputedGridSize = new Rect();
    protected final Rect mLastComputedGridTaskSize = new Rect();
    protected final Rect mLastComputedGridTaskSize = new Rect();
    // How much a task that is directly offscreen will be pushed out due to RecentsView scale/pivot.
    // How much a task that is directly offscreen will be pushed out due to RecentsView scale/pivot.
    @Nullable
    protected Float mLastComputedTaskStartPushOutDistance = null;
    protected Float mLastComputedTaskStartPushOutDistance = null;
    @Nullable
    protected Float mLastComputedTaskEndPushOutDistance = null;
    protected Float mLastComputedTaskEndPushOutDistance = null;
    protected boolean mEnableDrawingLiveTile = false;
    protected boolean mEnableDrawingLiveTile = false;
    protected final Rect mTempRect = new Rect();
    protected final Rect mTempRect = new Rect();
@@ -454,11 +459,13 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
    private final IntSet mTopRowIdSet = new IntSet();
    private final IntSet mTopRowIdSet = new IntSet();


    // The GestureEndTarget that is still in progress.
    // The GestureEndTarget that is still in progress.
    @Nullable
    protected GestureState.GestureEndTarget mCurrentGestureEndTarget;
    protected GestureState.GestureEndTarget mCurrentGestureEndTarget;


    // TODO(b/187528071): Remove these and replace with a real scrim.
    // TODO(b/187528071): Remove these and replace with a real scrim.
    private float mColorTint;
    private float mColorTint;
    private final int mTintingColor;
    private final int mTintingColor;
    @Nullable
    private ObjectAnimator mTintingAnimator;
    private ObjectAnimator mTintingAnimator;


    private int mOverScrollShift = 0;
    private int mOverScrollShift = 0;
@@ -542,6 +549,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
    private int mTaskViewIdCount;
    private int mTaskViewIdCount;
    private final int[] INVALID_TASK_IDS = new int[]{-1, -1};
    private final int[] INVALID_TASK_IDS = new int[]{-1, -1};
    protected boolean mRunningTaskTileHidden;
    protected boolean mRunningTaskTileHidden;
    @Nullable
    private Task[] mTmpRunningTasks;
    private Task[] mTmpRunningTasks;
    protected int mFocusedTaskViewId = -1;
    protected int mFocusedTaskViewId = -1;


@@ -556,7 +564,9 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
    private int mDownX;
    private int mDownX;
    private int mDownY;
    private int mDownY;


    @Nullable
    private PendingAnimation mPendingAnimation;
    private PendingAnimation mPendingAnimation;
    @Nullable
    private LayoutTransition mLayoutTransition;
    private LayoutTransition mLayoutTransition;


    @ViewDebug.ExportedProperty(category = "launcher")
    @ViewDebug.ExportedProperty(category = "launcher")
@@ -581,7 +591,9 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
    private final Point mLastMeasureSize = new Point();
    private final Point mLastMeasureSize = new Point();
    private final int mEmptyMessagePadding;
    private final int mEmptyMessagePadding;
    private boolean mShowEmptyMessage;
    private boolean mShowEmptyMessage;
    @Nullable
    private OnEmptyMessageUpdatedListener mOnEmptyMessageUpdatedListener;
    private OnEmptyMessageUpdatedListener mOnEmptyMessageUpdatedListener;
    @Nullable
    private Layout mEmptyTextLayout;
    private Layout mEmptyTextLayout;


    /**
    /**
@@ -596,8 +608,11 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
     * ensure this View doesn't go back into the {@link #mTaskViewPool},
     * ensure this View doesn't go back into the {@link #mTaskViewPool},
     * see {@link #onViewRemoved(View)}
     * see {@link #onViewRemoved(View)}
     */
     */
    @Nullable
    private TaskView mSplitHiddenTaskView;
    private TaskView mSplitHiddenTaskView;
    @Nullable
    private TaskView mSecondSplitHiddenTaskView;
    private TaskView mSecondSplitHiddenTaskView;
    @Nullable
    private StagedSplitBounds mSplitBoundsConfig;
    private StagedSplitBounds mSplitBoundsConfig;
    private final Toast mSplitToast = Toast.makeText(getContext(),
    private final Toast mSplitToast = Toast.makeText(getContext(),
            R.string.toast_split_select_app, Toast.LENGTH_SHORT);
            R.string.toast_split_select_app, Toast.LENGTH_SHORT);
@@ -613,12 +628,15 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
     * removed from recentsView
     * removed from recentsView
     */
     */
    private int mSplitHiddenTaskViewIndex;
    private int mSplitHiddenTaskViewIndex;
    @Nullable
    private FloatingTaskView mFirstFloatingTaskView;
    private FloatingTaskView mFirstFloatingTaskView;
    @Nullable
    private FloatingTaskView mSecondFloatingTaskView;
    private FloatingTaskView mSecondFloatingTaskView;


    /**
    /**
     * The task to be removed and immediately re-added. Should not be added to task pool.
     * The task to be removed and immediately re-added. Should not be added to task pool.
     */
     */
    @Nullable
    private TaskView mMovingTaskView;
    private TaskView mMovingTaskView;


    private OverviewActionsView mActionsView;
    private OverviewActionsView mActionsView;
@@ -638,10 +656,12 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
                }
                }
            };
            };


    @Nullable
    private RunnableList mSideTaskLaunchCallback;
    private RunnableList mSideTaskLaunchCallback;
    @Nullable
    private TaskLaunchListener mTaskLaunchListener;
    private TaskLaunchListener mTaskLaunchListener;


    public RecentsView(Context context, AttributeSet attrs, int defStyleAttr,
    public RecentsView(Context context, @Nullable AttributeSet attrs, int defStyleAttr,
            BaseActivityInterface sizeStrategy) {
            BaseActivityInterface sizeStrategy) {
        super(context, attrs, defStyleAttr);
        super(context, attrs, defStyleAttr);
        setEnableFreeScroll(true);
        setEnableFreeScroll(true);
@@ -782,6 +802,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
    }
    }


    @Override
    @Override
    @Nullable
    public Task onTaskThumbnailChanged(int taskId, ThumbnailData thumbnailData) {
    public Task onTaskThumbnailChanged(int taskId, ThumbnailData thumbnailData) {
        if (mHandleTaskStackChanges) {
        if (mHandleTaskStackChanges) {
            TaskView taskView = getTaskViewByTaskId(taskId);
            TaskView taskView = getTaskViewByTaskId(taskId);
@@ -1017,6 +1038,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
        }
        }
    }
    }


    @Nullable
    private TaskView getLastGridTaskView() {
    private TaskView getLastGridTaskView() {
        IntArray topRowIdArray = getTopRowIdArray();
        IntArray topRowIdArray = getTopRowIdArray();
        IntArray bottomRowIdArray = getBottomRowIdArray();
        IntArray bottomRowIdArray = getBottomRowIdArray();
@@ -1068,6 +1090,10 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
        return getScrollForPage(taskIndex) == getPagedOrientationHandler().getPrimaryScroll(this);
        return getScrollForPage(taskIndex) == getPagedOrientationHandler().getPrimaryScroll(this);
    }
    }


    /**
     * Returns a {@link TaskView} that has taskId matching {@code taskId} or null if no match.
     */
    @Nullable
    public TaskView getTaskViewByTaskId(int taskId) {
    public TaskView getTaskViewByTaskId(int taskId) {
        if (taskId == -1) {
        if (taskId == -1) {
            return null;
            return null;
@@ -1918,6 +1944,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
        return getTaskViewFromTaskViewId(mFocusedTaskViewId);
        return getTaskViewFromTaskViewId(mFocusedTaskViewId);
    }
    }


    @Nullable
    private TaskView getTaskViewFromTaskViewId(int taskViewId) {
    private TaskView getTaskViewFromTaskViewId(int taskViewId) {
        if (taskViewId == -1) {
        if (taskViewId == -1) {
            return null;
            return null;
@@ -4384,12 +4411,15 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
        }
        }
    }
    }


    public void finishRecentsAnimation(boolean toRecents, Runnable onFinishComplete) {
    /**
     * Finish recents animation.
     */
    public void finishRecentsAnimation(boolean toRecents, @Nullable Runnable onFinishComplete) {
        finishRecentsAnimation(toRecents, true /* shouldPip */, onFinishComplete);
        finishRecentsAnimation(toRecents, true /* shouldPip */, onFinishComplete);
    }
    }


    public void finishRecentsAnimation(boolean toRecents, boolean shouldPip,
    public void finishRecentsAnimation(boolean toRecents, boolean shouldPip,
            Runnable onFinishComplete) {
            @Nullable Runnable onFinishComplete) {
        // TODO(b/197232424#comment#10) Move this back into onRecentsAnimationComplete(). Maybe?
        // TODO(b/197232424#comment#10) Move this back into onRecentsAnimationComplete(). Maybe?
        cleanupRemoteTargets();
        cleanupRemoteTargets();
        if (!toRecents && ENABLE_QUICKSTEP_LIVE_TILE.get()) {
        if (!toRecents && ENABLE_QUICKSTEP_LIVE_TILE.get()) {
@@ -4901,10 +4931,13 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T


    private static class PinnedStackAnimationListener<T extends BaseActivity> extends
    private static class PinnedStackAnimationListener<T extends BaseActivity> extends
            IPipAnimationListener.Stub {
            IPipAnimationListener.Stub {
        @Nullable
        private T mActivity;
        private T mActivity;
        @Nullable
        private RecentsView mRecentsView;
        private RecentsView mRecentsView;


        public void setActivityAndRecentsView(T activity, RecentsView recentsView) {
        public void setActivityAndRecentsView(@Nullable T activity,
                @Nullable RecentsView recentsView) {
            mActivity = activity;
            mActivity = activity;
            mRecentsView = recentsView;
            mRecentsView = recentsView;
        }
        }