Loading quickstep/src/com/android/quickstep/util/RecentsViewUtils.kt +12 −14 Original line number Diff line number Diff line Loading @@ -50,32 +50,30 @@ class RecentsViewUtils { } /** * Counts [numChildren] that are [DesktopTaskView] instances. * Counts [TaskView]s that are [DesktopTaskView] instances. * * @param numChildren Quantity of children to transverse * @param getTaskViewAt Function that provides a TaskView given an index * @param taskViews List of [TaskView]s */ fun getDesktopTaskViewCount(numChildren: Int, getTaskViewAt: (Int) -> TaskView?): Int = (0 until numChildren).count { getTaskViewAt(it) is DesktopTaskView } fun getDesktopTaskViewCount(taskViews: List<TaskView>): Int = taskViews.count { it is DesktopTaskView } /** * Returns the first TaskView that should be displayed as a large tile. * * @param numChildren Quantity of children to transverse * @param getTaskViewAt Function that provides a TaskView given an index * @param taskViews List of [TaskView]s */ fun getFirstLargeTaskView(numChildren: Int, getTaskViewAt: (Int) -> TaskView?): TaskView? { return (0 until numChildren).firstNotNullOfOrNull { index -> val taskView = getTaskViewAt(index) if (taskView?.isLargeTile == true) taskView else null } } fun getFirstLargeTaskView(taskViews: List<TaskView>): TaskView? = taskViews.firstOrNull { it.isLargeTile } fun screenshotTasks( taskView: TaskView, recentsAnimationController: RecentsAnimationController recentsAnimationController: RecentsAnimationController, ): Map<Int, ThumbnailData> = taskView.taskContainers.associate { it.task.key.id to recentsAnimationController.screenshotTask(it.task.key.id) } /** Returns the current list of [TaskView] children. */ fun getTaskViews(taskViewCount: Int, requireTaskViewAt: (Int) -> TaskView): List<TaskView> = (0 until taskViewCount).map(requireTaskViewAt) } quickstep/src/com/android/quickstep/views/RecentsView.java +61 −87 Original line number Diff line number Diff line Loading @@ -841,8 +841,7 @@ public abstract class RecentsView< private final RecentsViewModel mRecentsViewModel; private final RecentsViewModelHelper mHelper; private final RecentsViewUtils mRecentsViewUtils = new RecentsViewUtils(); private final RecentsViewUtils mUtils = new RecentsViewUtils(); public RecentsView(Context context, @Nullable AttributeSet attrs, int defStyleAttr, BaseContainerInterface sizeStrategy) { Loading Loading @@ -1103,14 +1102,13 @@ public abstract class RecentsView< @Override public void onTaskIconChanged(@NonNull String pkg, @NonNull UserHandle user) { for (int i = 0; i < getTaskViewCount(); i++) { TaskView tv = requireTaskViewAt(i); Task task = tv.getFirstTask(); for (TaskView taskView : getTaskViews()) { Task task = taskView.getFirstTask(); if (pkg.equals(task.key.getPackageName()) && task.key.userId == user.getIdentifier()) { task.icon = null; if (tv.getTaskContainers().stream().anyMatch( if (taskView.getTaskContainers().stream().anyMatch( container -> container.getIconView().getDrawable() != null)) { tv.onTaskListVisibilityChanged(true /* visible */); taskView.onTaskListVisibilityChanged(true /* visible */); } } } Loading Loading @@ -1499,8 +1497,7 @@ public abstract class RecentsView< return null; } for (int i = 0; i < getTaskViewCount(); i++) { TaskView taskView = requireTaskViewAt(i); for (TaskView taskView : getTaskViews()) { if (taskView.containsTaskId(taskId)) { return taskView; } Loading @@ -1521,8 +1518,7 @@ public abstract class RecentsView< int[] taskIdsCopy = Arrays.copyOf(taskIds, taskIds.length); Arrays.sort(taskIdsCopy); for (int i = 0; i < getTaskViewCount(); i++) { TaskView taskView = requireTaskViewAt(i); for (TaskView taskView : getTaskViews()) { int[] taskViewIdsCopy = taskView.getTaskIds(); Arrays.sort(taskViewIdsCopy); if (Arrays.equals(taskIdsCopy, taskViewIdsCopy)) { Loading Loading @@ -1558,9 +1554,7 @@ public abstract class RecentsView< */ public void setTaskBorderEnabled(boolean enabled) { mBorderEnabled = enabled; int taskCount = getTaskViewCount(); for (int i = 0; i < taskCount; i++) { TaskView taskView = requireTaskViewAt(i); for (TaskView taskView : getTaskViews()) { taskView.setBorderEnabled(enabled); } mClearAllButton.setBorderEnabled(enabled); Loading Loading @@ -1627,9 +1621,7 @@ public abstract class RecentsView< super.onTouchEvent(ev); if (showAsGrid()) { int taskCount = getTaskViewCount(); for (int i = 0; i < taskCount; i++) { TaskView taskView = requireTaskViewAt(i); for (TaskView taskView : getTaskViews()) { if (isTaskViewVisible(taskView) && taskView.offerTouchToChildren(ev)) { // Keep consuming events to pass to delegate return true; Loading Loading @@ -1883,7 +1875,7 @@ public abstract class RecentsView< // Move Desktop Tasks to the end of the list if (enableLargeDesktopWindowingTile()) { taskGroups = mRecentsViewUtils.sortDesktopTasksToFront(taskGroups); taskGroups = mUtils.sortDesktopTasksToFront(taskGroups); } // Add views as children based on whether it's grouped or single task. Looping through Loading Loading @@ -1939,7 +1931,7 @@ public abstract class RecentsView< // Keep same previous focused task TaskView newFocusedTaskView = getTaskViewByTaskIds(focusedTaskIds); // If the list changed, maybe the focused task doesn't exist anymore int newFocusedTaskViewIndex = mRecentsViewUtils.getFocusedTaskIndex(taskGroups); int newFocusedTaskViewIndex = mUtils.getFocusedTaskIndex(taskGroups); if (newFocusedTaskView == null && getTaskViewCount() > newFocusedTaskViewIndex) { newFocusedTaskView = getTaskViewAt(newFocusedTaskViewIndex); } Loading Loading @@ -2030,15 +2022,13 @@ public abstract class RecentsView< } private void removeTasksViewsAndClearAllButton() { for (TaskView taskView : getTaskViews()) { if (isGestureActive() && taskView.isRunningTask()) { // This handles an edge case where applyLoadPlan happens during a gesture when the // only Task is one with excludeFromRecents, in which case we should not remove it. final int stubRunningTaskIndex = isGestureActive() ? getRunningTaskIndex() : -1; for (int i = getTaskViewCount() - 1; i >= 0; i--) { if (i == stubRunningTaskIndex) { continue; } removeView(requireTaskViewAt(i)); removeView(taskView); } if (getTaskViewCount() == 0 && indexOfChild(mClearAllButton) != -1) { removeView(mClearAllButton); Loading @@ -2059,7 +2049,7 @@ public abstract class RecentsView< * @return Number of children that are instances of DesktopTaskView */ private int getDesktopTaskViewCount() { return mRecentsViewUtils.getDesktopTaskViewCount(getChildCount(), this::getTaskViewAt); return mUtils.getDesktopTaskViewCount(getTaskViews()); } /** Loading @@ -2082,8 +2072,7 @@ public abstract class RecentsView< } public void resetTaskVisuals() { for (int i = getTaskViewCount() - 1; i >= 0; i--) { TaskView taskView = requireTaskViewAt(i); for (TaskView taskView : getTaskViews()) { if (Arrays.stream(taskView.getTaskIds()).noneMatch( taskId -> taskId == mIgnoreResetTaskId)) { taskView.resetViewTransforms(); Loading Loading @@ -2126,9 +2115,8 @@ public abstract class RecentsView< if (enableRefactorTaskThumbnail()) { mRecentsViewModel.updateFullscreenProgress(mFullscreenProgress); } int taskCount = getTaskViewCount(); for (int i = 0; i < taskCount; i++) { requireTaskViewAt(i).setFullscreenProgress(mFullscreenProgress); for (TaskView taskView : getTaskViews()) { taskView.setFullscreenProgress(mFullscreenProgress); } mClearAllButton.setFullscreenProgress(fullscreenProgress); Loading Loading @@ -2274,8 +2262,7 @@ public abstract class RecentsView< ? mLastComputedCarouselTaskSize.right - mLastComputedTaskSize.right : mLastComputedCarouselTaskSize.left - mLastComputedTaskSize.left; } for (int i = 0; i < taskCount; i++) { TaskView taskView = requireTaskViewAt(i); for (TaskView taskView : getTaskViews()) { taskView.updateTaskSize(mLastComputedTaskSize, mLastComputedGridTaskSize, mLastComputedCarouselTaskSize); taskView.setNonGridTranslationX(accumulatedTranslationX); Loading Loading @@ -2664,7 +2651,7 @@ public abstract class RecentsView< } private @Nullable TaskView getFirstLargeTaskView() { return mRecentsViewUtils.getFirstLargeTaskView(getChildCount(), this::getTaskViewAt); return mUtils.getFirstLargeTaskView(getTaskViews()); } @Nullable Loading @@ -2673,8 +2660,7 @@ public abstract class RecentsView< return null; } for (int i = 0; i < getTaskViewCount(); i++) { TaskView taskView = requireTaskViewAt(i); for (TaskView taskView : getTaskViews()) { if (taskView.getTaskViewId() == taskViewId) { return taskView; } Loading Loading @@ -2823,8 +2809,8 @@ public abstract class RecentsView< } private void updateChildTaskOrientations() { for (int i = 0; i < getTaskViewCount(); i++) { requireTaskViewAt(i).setOrientationState(mOrientationState); for (TaskView taskView : getTaskViews()) { taskView.setOrientationState(mOrientationState); } boolean shouldRotateMenuForFakeRotation = !mOrientationState.isRecentsActivityRotationAllowed(); Loading Loading @@ -3083,9 +3069,8 @@ public abstract class RecentsView< public void setTaskIconScaledDown(boolean isScaledDown) { if (mTaskIconScaledDown != isScaledDown) { mTaskIconScaledDown = isScaledDown; int taskCount = getTaskViewCount(); for (int i = 0; i < taskCount; i++) { requireTaskViewAt(i).setIconScaleAndDim(mTaskIconScaledDown ? 0 : 1); for (TaskView taskView : getTaskViews()) { taskView.setIconScaleAndDim(mTaskIconScaledDown ? 0 : 1); } } } Loading @@ -3098,9 +3083,7 @@ public abstract class RecentsView< public void animateUpTaskIconScale() { mTaskIconScaledDown = false; int taskCount = getTaskViewCount(); for (int i = 0; i < taskCount; i++) { TaskView taskView = requireTaskViewAt(i); for (TaskView taskView : getTaskViews()) { taskView.animateIconScaleAndDimIntoView(); } } Loading Loading @@ -3395,9 +3378,8 @@ public abstract class RecentsView< private void setGridProgress(float gridProgress) { mGridProgress = gridProgress; int taskCount = getTaskViewCount(); for (int i = 0; i < taskCount; i++) { requireTaskViewAt(i).setGridProgress(gridProgress); for (TaskView taskView : getTaskViews()) { taskView.setGridProgress(gridProgress); } mClearAllButton.setGridProgress(gridProgress); } Loading @@ -3407,14 +3389,10 @@ public abstract class RecentsView< mRecentsViewModel.updateThumbnailSplashProgress(taskThumbnailSplashAlpha); return; } int taskCount = getTaskViewCount(); if (taskCount == 0) { return; } mTaskThumbnailSplashAlpha = taskThumbnailSplashAlpha; for (int i = 0; i < taskCount; i++) { requireTaskViewAt(i).setTaskThumbnailSplashAlpha(taskThumbnailSplashAlpha); for (TaskView taskView : getTaskViews()) { taskView.setTaskThumbnailSplashAlpha(taskThumbnailSplashAlpha); } } Loading Loading @@ -3637,8 +3615,7 @@ public abstract class RecentsView< nextFocusedTaskFromTop = !mTopRowIdSet.isEmpty() && mTopRowIdSet.size() >= (taskCount - 1) / 2f; // Pick the next focused task from the preferred row. for (int i = 0; i < taskCount; i++) { TaskView taskView = requireTaskViewAt(i); for (TaskView taskView : getTaskViews()) { if (taskView == dismissedTaskView || taskView.isLargeTile()) { continue; } Loading Loading @@ -3766,8 +3743,7 @@ public abstract class RecentsView< END_DISMISS_TRANSLATION_INTERPOLATION_OFFSET + (taskCount - 1) * halfAdditionalDismissTranslationOffset, END_DISMISS_TRANSLATION_INTERPOLATION_OFFSET, 1); for (int i = 0; i < taskCount; i++) { TaskView taskView = requireTaskViewAt(i); for (TaskView taskView : getTaskViews()) { anim.setFloat(taskView, TaskView.GRID_END_TRANSLATION_X, longGridRowWidthDiff, clampToProgress(LINEAR, dismissTranslationInterpolationEnd, 1)); dismissTranslationInterpolationEnd = Utilities.boundToRange( Loading Loading @@ -4227,9 +4203,8 @@ public abstract class RecentsView< return new IntArray(0); } IntArray topArray = new IntArray(mTopRowIdSet.size()); int taskViewCount = getTaskViewCount(); for (int i = 0; i < taskViewCount; i++) { int taskViewId = requireTaskViewAt(i).getTaskViewId(); for (TaskView taskView : getTaskViews()) { int taskViewId = taskView.getTaskViewId(); if (mTopRowIdSet.contains(taskViewId)) { topArray.add(taskViewId); } Loading @@ -4246,9 +4221,7 @@ public abstract class RecentsView< return new IntArray(0); } IntArray bottomArray = new IntArray(bottomRowIdArraySize); int taskViewCount = getTaskViewCount(); for (int i = 0; i < taskViewCount; i++) { TaskView taskView = requireTaskViewAt(i); for (TaskView taskView : getTaskViews()) { int taskViewId = taskView.getTaskViewId(); if (!mTopRowIdSet.contains(taskViewId) && !taskView.isLargeTile()) { bottomArray.add(taskViewId); Loading Loading @@ -4308,9 +4281,8 @@ public abstract class RecentsView< } PendingAnimation anim = new PendingAnimation(duration); int count = getTaskViewCount(); for (int i = 0; i < count; i++) { addDismissedTaskAnimations(requireTaskViewAt(i), duration, anim); for (TaskView taskView : getTaskViews()) { addDismissedTaskAnimations(taskView, duration, anim); } mPendingAnimation = anim; Loading Loading @@ -4477,12 +4449,11 @@ public abstract class RecentsView< mContentAlpha = alpha; TaskView runningTaskView = getRunningTaskView(); for (int i = getTaskViewCount() - 1; i >= 0; i--) { TaskView child = requireTaskViewAt(i); if (runningTaskView != null && mRunningTaskTileHidden && child == runningTaskView) { for (TaskView taskView : getTaskViews()) { if (runningTaskView != null && mRunningTaskTileHidden && taskView == runningTaskView) { continue; } child.setStableAlpha(alpha); taskView.setStableAlpha(alpha); } mClearAllButton.setContentAlpha(mContentAlpha); int alphaInt = Math.round(alpha * 255); Loading Loading @@ -4591,6 +4562,13 @@ public abstract class RecentsView< return Objects.requireNonNull(getTaskViewAt(index)); } /** * Returns the current list of [TaskView] children. */ private List<TaskView> getTaskViews() { return mUtils.getTaskViews(getTaskViewCount(), this::requireTaskViewAt); } public void setOnEmptyMessageUpdatedListener(OnEmptyMessageUpdatedListener listener) { mOnEmptyMessageUpdatedListener = listener; } Loading Loading @@ -4895,9 +4873,9 @@ public abstract class RecentsView< protected void setTaskViewsResistanceTranslation(float translation) { mTaskViewsSecondaryTranslation = translation; for (int i = 0; i < getTaskViewCount(); i++) { TaskView task = requireTaskViewAt(i); task.getTaskResistanceTranslationProperty().set(task, translation / getScaleY()); for (TaskView taskView : getTaskViews()) { taskView.getTaskResistanceTranslationProperty().set(taskView, translation / getScaleY()); } runActionOnRemoteHandles( remoteTargetHandle -> remoteTargetHandle.getTaskViewSimulator() Loading @@ -4905,23 +4883,21 @@ public abstract class RecentsView< } private void updateTaskViewsSnapshotRadius() { for (int i = 0; i < getTaskViewCount(); i++) { requireTaskViewAt(i).updateSnapshotRadius(); for (TaskView taskView : getTaskViews()) { taskView.updateSnapshotRadius(); } } protected void setTaskViewsPrimarySplitTranslation(float translation) { mTaskViewsPrimarySplitTranslation = translation; for (int i = 0; i < getTaskViewCount(); i++) { TaskView task = requireTaskViewAt(i); task.getPrimarySplitTranslationProperty().set(task, translation); for (TaskView taskView : getTaskViews()) { taskView.getPrimarySplitTranslationProperty().set(taskView, translation); } } protected void setTaskViewsSecondarySplitTranslation(float translation) { mTaskViewsSecondarySplitTranslation = translation; for (int i = 0; i < getTaskViewCount(); i++) { TaskView taskView = requireTaskViewAt(i); for (TaskView taskView : getTaskViews()) { if (taskView == mSplitHiddenTaskView && !taskView.containsMultipleTasks()) { continue; } Loading Loading @@ -6088,9 +6064,7 @@ public abstract class RecentsView< private void updateEnabledOverlays() { TaskView focusedTaskView = getFocusedTaskView(); int taskCount = getTaskViewCount(); for (int i = 0; i < taskCount; i++) { TaskView taskView = requireTaskViewAt(i); for (TaskView taskView : getTaskViews()) { if (taskView == focusedTaskView) { continue; } Loading Loading @@ -6164,7 +6138,7 @@ public abstract class RecentsView< return; } Map<Integer, ThumbnailData> updatedThumbnails = mRecentsViewUtils.screenshotTasks(taskView, Map<Integer, ThumbnailData> updatedThumbnails = mUtils.screenshotTasks(taskView, mRecentsAnimationController); if (enableRefactorTaskThumbnail()) { mHelper.switchToScreenshot(taskView, updatedThumbnails, onFinishRunnable); Loading Loading @@ -6262,8 +6236,8 @@ public abstract class RecentsView< mRecentsViewModel.setTintAmount(tintAmount); } for (int i = 0; i < getTaskViewCount(); i++) { requireTaskViewAt(i).setColorTint(mColorTint, mTintingColor); for (TaskView taskView : getTaskViews()) { taskView.setColorTint(mColorTint, mTintingColor); } Drawable scrimBg = mContainer.getScrimView().getBackground(); Loading Loading
quickstep/src/com/android/quickstep/util/RecentsViewUtils.kt +12 −14 Original line number Diff line number Diff line Loading @@ -50,32 +50,30 @@ class RecentsViewUtils { } /** * Counts [numChildren] that are [DesktopTaskView] instances. * Counts [TaskView]s that are [DesktopTaskView] instances. * * @param numChildren Quantity of children to transverse * @param getTaskViewAt Function that provides a TaskView given an index * @param taskViews List of [TaskView]s */ fun getDesktopTaskViewCount(numChildren: Int, getTaskViewAt: (Int) -> TaskView?): Int = (0 until numChildren).count { getTaskViewAt(it) is DesktopTaskView } fun getDesktopTaskViewCount(taskViews: List<TaskView>): Int = taskViews.count { it is DesktopTaskView } /** * Returns the first TaskView that should be displayed as a large tile. * * @param numChildren Quantity of children to transverse * @param getTaskViewAt Function that provides a TaskView given an index * @param taskViews List of [TaskView]s */ fun getFirstLargeTaskView(numChildren: Int, getTaskViewAt: (Int) -> TaskView?): TaskView? { return (0 until numChildren).firstNotNullOfOrNull { index -> val taskView = getTaskViewAt(index) if (taskView?.isLargeTile == true) taskView else null } } fun getFirstLargeTaskView(taskViews: List<TaskView>): TaskView? = taskViews.firstOrNull { it.isLargeTile } fun screenshotTasks( taskView: TaskView, recentsAnimationController: RecentsAnimationController recentsAnimationController: RecentsAnimationController, ): Map<Int, ThumbnailData> = taskView.taskContainers.associate { it.task.key.id to recentsAnimationController.screenshotTask(it.task.key.id) } /** Returns the current list of [TaskView] children. */ fun getTaskViews(taskViewCount: Int, requireTaskViewAt: (Int) -> TaskView): List<TaskView> = (0 until taskViewCount).map(requireTaskViewAt) }
quickstep/src/com/android/quickstep/views/RecentsView.java +61 −87 Original line number Diff line number Diff line Loading @@ -841,8 +841,7 @@ public abstract class RecentsView< private final RecentsViewModel mRecentsViewModel; private final RecentsViewModelHelper mHelper; private final RecentsViewUtils mRecentsViewUtils = new RecentsViewUtils(); private final RecentsViewUtils mUtils = new RecentsViewUtils(); public RecentsView(Context context, @Nullable AttributeSet attrs, int defStyleAttr, BaseContainerInterface sizeStrategy) { Loading Loading @@ -1103,14 +1102,13 @@ public abstract class RecentsView< @Override public void onTaskIconChanged(@NonNull String pkg, @NonNull UserHandle user) { for (int i = 0; i < getTaskViewCount(); i++) { TaskView tv = requireTaskViewAt(i); Task task = tv.getFirstTask(); for (TaskView taskView : getTaskViews()) { Task task = taskView.getFirstTask(); if (pkg.equals(task.key.getPackageName()) && task.key.userId == user.getIdentifier()) { task.icon = null; if (tv.getTaskContainers().stream().anyMatch( if (taskView.getTaskContainers().stream().anyMatch( container -> container.getIconView().getDrawable() != null)) { tv.onTaskListVisibilityChanged(true /* visible */); taskView.onTaskListVisibilityChanged(true /* visible */); } } } Loading Loading @@ -1499,8 +1497,7 @@ public abstract class RecentsView< return null; } for (int i = 0; i < getTaskViewCount(); i++) { TaskView taskView = requireTaskViewAt(i); for (TaskView taskView : getTaskViews()) { if (taskView.containsTaskId(taskId)) { return taskView; } Loading @@ -1521,8 +1518,7 @@ public abstract class RecentsView< int[] taskIdsCopy = Arrays.copyOf(taskIds, taskIds.length); Arrays.sort(taskIdsCopy); for (int i = 0; i < getTaskViewCount(); i++) { TaskView taskView = requireTaskViewAt(i); for (TaskView taskView : getTaskViews()) { int[] taskViewIdsCopy = taskView.getTaskIds(); Arrays.sort(taskViewIdsCopy); if (Arrays.equals(taskIdsCopy, taskViewIdsCopy)) { Loading Loading @@ -1558,9 +1554,7 @@ public abstract class RecentsView< */ public void setTaskBorderEnabled(boolean enabled) { mBorderEnabled = enabled; int taskCount = getTaskViewCount(); for (int i = 0; i < taskCount; i++) { TaskView taskView = requireTaskViewAt(i); for (TaskView taskView : getTaskViews()) { taskView.setBorderEnabled(enabled); } mClearAllButton.setBorderEnabled(enabled); Loading Loading @@ -1627,9 +1621,7 @@ public abstract class RecentsView< super.onTouchEvent(ev); if (showAsGrid()) { int taskCount = getTaskViewCount(); for (int i = 0; i < taskCount; i++) { TaskView taskView = requireTaskViewAt(i); for (TaskView taskView : getTaskViews()) { if (isTaskViewVisible(taskView) && taskView.offerTouchToChildren(ev)) { // Keep consuming events to pass to delegate return true; Loading Loading @@ -1883,7 +1875,7 @@ public abstract class RecentsView< // Move Desktop Tasks to the end of the list if (enableLargeDesktopWindowingTile()) { taskGroups = mRecentsViewUtils.sortDesktopTasksToFront(taskGroups); taskGroups = mUtils.sortDesktopTasksToFront(taskGroups); } // Add views as children based on whether it's grouped or single task. Looping through Loading Loading @@ -1939,7 +1931,7 @@ public abstract class RecentsView< // Keep same previous focused task TaskView newFocusedTaskView = getTaskViewByTaskIds(focusedTaskIds); // If the list changed, maybe the focused task doesn't exist anymore int newFocusedTaskViewIndex = mRecentsViewUtils.getFocusedTaskIndex(taskGroups); int newFocusedTaskViewIndex = mUtils.getFocusedTaskIndex(taskGroups); if (newFocusedTaskView == null && getTaskViewCount() > newFocusedTaskViewIndex) { newFocusedTaskView = getTaskViewAt(newFocusedTaskViewIndex); } Loading Loading @@ -2030,15 +2022,13 @@ public abstract class RecentsView< } private void removeTasksViewsAndClearAllButton() { for (TaskView taskView : getTaskViews()) { if (isGestureActive() && taskView.isRunningTask()) { // This handles an edge case where applyLoadPlan happens during a gesture when the // only Task is one with excludeFromRecents, in which case we should not remove it. final int stubRunningTaskIndex = isGestureActive() ? getRunningTaskIndex() : -1; for (int i = getTaskViewCount() - 1; i >= 0; i--) { if (i == stubRunningTaskIndex) { continue; } removeView(requireTaskViewAt(i)); removeView(taskView); } if (getTaskViewCount() == 0 && indexOfChild(mClearAllButton) != -1) { removeView(mClearAllButton); Loading @@ -2059,7 +2049,7 @@ public abstract class RecentsView< * @return Number of children that are instances of DesktopTaskView */ private int getDesktopTaskViewCount() { return mRecentsViewUtils.getDesktopTaskViewCount(getChildCount(), this::getTaskViewAt); return mUtils.getDesktopTaskViewCount(getTaskViews()); } /** Loading @@ -2082,8 +2072,7 @@ public abstract class RecentsView< } public void resetTaskVisuals() { for (int i = getTaskViewCount() - 1; i >= 0; i--) { TaskView taskView = requireTaskViewAt(i); for (TaskView taskView : getTaskViews()) { if (Arrays.stream(taskView.getTaskIds()).noneMatch( taskId -> taskId == mIgnoreResetTaskId)) { taskView.resetViewTransforms(); Loading Loading @@ -2126,9 +2115,8 @@ public abstract class RecentsView< if (enableRefactorTaskThumbnail()) { mRecentsViewModel.updateFullscreenProgress(mFullscreenProgress); } int taskCount = getTaskViewCount(); for (int i = 0; i < taskCount; i++) { requireTaskViewAt(i).setFullscreenProgress(mFullscreenProgress); for (TaskView taskView : getTaskViews()) { taskView.setFullscreenProgress(mFullscreenProgress); } mClearAllButton.setFullscreenProgress(fullscreenProgress); Loading Loading @@ -2274,8 +2262,7 @@ public abstract class RecentsView< ? mLastComputedCarouselTaskSize.right - mLastComputedTaskSize.right : mLastComputedCarouselTaskSize.left - mLastComputedTaskSize.left; } for (int i = 0; i < taskCount; i++) { TaskView taskView = requireTaskViewAt(i); for (TaskView taskView : getTaskViews()) { taskView.updateTaskSize(mLastComputedTaskSize, mLastComputedGridTaskSize, mLastComputedCarouselTaskSize); taskView.setNonGridTranslationX(accumulatedTranslationX); Loading Loading @@ -2664,7 +2651,7 @@ public abstract class RecentsView< } private @Nullable TaskView getFirstLargeTaskView() { return mRecentsViewUtils.getFirstLargeTaskView(getChildCount(), this::getTaskViewAt); return mUtils.getFirstLargeTaskView(getTaskViews()); } @Nullable Loading @@ -2673,8 +2660,7 @@ public abstract class RecentsView< return null; } for (int i = 0; i < getTaskViewCount(); i++) { TaskView taskView = requireTaskViewAt(i); for (TaskView taskView : getTaskViews()) { if (taskView.getTaskViewId() == taskViewId) { return taskView; } Loading Loading @@ -2823,8 +2809,8 @@ public abstract class RecentsView< } private void updateChildTaskOrientations() { for (int i = 0; i < getTaskViewCount(); i++) { requireTaskViewAt(i).setOrientationState(mOrientationState); for (TaskView taskView : getTaskViews()) { taskView.setOrientationState(mOrientationState); } boolean shouldRotateMenuForFakeRotation = !mOrientationState.isRecentsActivityRotationAllowed(); Loading Loading @@ -3083,9 +3069,8 @@ public abstract class RecentsView< public void setTaskIconScaledDown(boolean isScaledDown) { if (mTaskIconScaledDown != isScaledDown) { mTaskIconScaledDown = isScaledDown; int taskCount = getTaskViewCount(); for (int i = 0; i < taskCount; i++) { requireTaskViewAt(i).setIconScaleAndDim(mTaskIconScaledDown ? 0 : 1); for (TaskView taskView : getTaskViews()) { taskView.setIconScaleAndDim(mTaskIconScaledDown ? 0 : 1); } } } Loading @@ -3098,9 +3083,7 @@ public abstract class RecentsView< public void animateUpTaskIconScale() { mTaskIconScaledDown = false; int taskCount = getTaskViewCount(); for (int i = 0; i < taskCount; i++) { TaskView taskView = requireTaskViewAt(i); for (TaskView taskView : getTaskViews()) { taskView.animateIconScaleAndDimIntoView(); } } Loading Loading @@ -3395,9 +3378,8 @@ public abstract class RecentsView< private void setGridProgress(float gridProgress) { mGridProgress = gridProgress; int taskCount = getTaskViewCount(); for (int i = 0; i < taskCount; i++) { requireTaskViewAt(i).setGridProgress(gridProgress); for (TaskView taskView : getTaskViews()) { taskView.setGridProgress(gridProgress); } mClearAllButton.setGridProgress(gridProgress); } Loading @@ -3407,14 +3389,10 @@ public abstract class RecentsView< mRecentsViewModel.updateThumbnailSplashProgress(taskThumbnailSplashAlpha); return; } int taskCount = getTaskViewCount(); if (taskCount == 0) { return; } mTaskThumbnailSplashAlpha = taskThumbnailSplashAlpha; for (int i = 0; i < taskCount; i++) { requireTaskViewAt(i).setTaskThumbnailSplashAlpha(taskThumbnailSplashAlpha); for (TaskView taskView : getTaskViews()) { taskView.setTaskThumbnailSplashAlpha(taskThumbnailSplashAlpha); } } Loading Loading @@ -3637,8 +3615,7 @@ public abstract class RecentsView< nextFocusedTaskFromTop = !mTopRowIdSet.isEmpty() && mTopRowIdSet.size() >= (taskCount - 1) / 2f; // Pick the next focused task from the preferred row. for (int i = 0; i < taskCount; i++) { TaskView taskView = requireTaskViewAt(i); for (TaskView taskView : getTaskViews()) { if (taskView == dismissedTaskView || taskView.isLargeTile()) { continue; } Loading Loading @@ -3766,8 +3743,7 @@ public abstract class RecentsView< END_DISMISS_TRANSLATION_INTERPOLATION_OFFSET + (taskCount - 1) * halfAdditionalDismissTranslationOffset, END_DISMISS_TRANSLATION_INTERPOLATION_OFFSET, 1); for (int i = 0; i < taskCount; i++) { TaskView taskView = requireTaskViewAt(i); for (TaskView taskView : getTaskViews()) { anim.setFloat(taskView, TaskView.GRID_END_TRANSLATION_X, longGridRowWidthDiff, clampToProgress(LINEAR, dismissTranslationInterpolationEnd, 1)); dismissTranslationInterpolationEnd = Utilities.boundToRange( Loading Loading @@ -4227,9 +4203,8 @@ public abstract class RecentsView< return new IntArray(0); } IntArray topArray = new IntArray(mTopRowIdSet.size()); int taskViewCount = getTaskViewCount(); for (int i = 0; i < taskViewCount; i++) { int taskViewId = requireTaskViewAt(i).getTaskViewId(); for (TaskView taskView : getTaskViews()) { int taskViewId = taskView.getTaskViewId(); if (mTopRowIdSet.contains(taskViewId)) { topArray.add(taskViewId); } Loading @@ -4246,9 +4221,7 @@ public abstract class RecentsView< return new IntArray(0); } IntArray bottomArray = new IntArray(bottomRowIdArraySize); int taskViewCount = getTaskViewCount(); for (int i = 0; i < taskViewCount; i++) { TaskView taskView = requireTaskViewAt(i); for (TaskView taskView : getTaskViews()) { int taskViewId = taskView.getTaskViewId(); if (!mTopRowIdSet.contains(taskViewId) && !taskView.isLargeTile()) { bottomArray.add(taskViewId); Loading Loading @@ -4308,9 +4281,8 @@ public abstract class RecentsView< } PendingAnimation anim = new PendingAnimation(duration); int count = getTaskViewCount(); for (int i = 0; i < count; i++) { addDismissedTaskAnimations(requireTaskViewAt(i), duration, anim); for (TaskView taskView : getTaskViews()) { addDismissedTaskAnimations(taskView, duration, anim); } mPendingAnimation = anim; Loading Loading @@ -4477,12 +4449,11 @@ public abstract class RecentsView< mContentAlpha = alpha; TaskView runningTaskView = getRunningTaskView(); for (int i = getTaskViewCount() - 1; i >= 0; i--) { TaskView child = requireTaskViewAt(i); if (runningTaskView != null && mRunningTaskTileHidden && child == runningTaskView) { for (TaskView taskView : getTaskViews()) { if (runningTaskView != null && mRunningTaskTileHidden && taskView == runningTaskView) { continue; } child.setStableAlpha(alpha); taskView.setStableAlpha(alpha); } mClearAllButton.setContentAlpha(mContentAlpha); int alphaInt = Math.round(alpha * 255); Loading Loading @@ -4591,6 +4562,13 @@ public abstract class RecentsView< return Objects.requireNonNull(getTaskViewAt(index)); } /** * Returns the current list of [TaskView] children. */ private List<TaskView> getTaskViews() { return mUtils.getTaskViews(getTaskViewCount(), this::requireTaskViewAt); } public void setOnEmptyMessageUpdatedListener(OnEmptyMessageUpdatedListener listener) { mOnEmptyMessageUpdatedListener = listener; } Loading Loading @@ -4895,9 +4873,9 @@ public abstract class RecentsView< protected void setTaskViewsResistanceTranslation(float translation) { mTaskViewsSecondaryTranslation = translation; for (int i = 0; i < getTaskViewCount(); i++) { TaskView task = requireTaskViewAt(i); task.getTaskResistanceTranslationProperty().set(task, translation / getScaleY()); for (TaskView taskView : getTaskViews()) { taskView.getTaskResistanceTranslationProperty().set(taskView, translation / getScaleY()); } runActionOnRemoteHandles( remoteTargetHandle -> remoteTargetHandle.getTaskViewSimulator() Loading @@ -4905,23 +4883,21 @@ public abstract class RecentsView< } private void updateTaskViewsSnapshotRadius() { for (int i = 0; i < getTaskViewCount(); i++) { requireTaskViewAt(i).updateSnapshotRadius(); for (TaskView taskView : getTaskViews()) { taskView.updateSnapshotRadius(); } } protected void setTaskViewsPrimarySplitTranslation(float translation) { mTaskViewsPrimarySplitTranslation = translation; for (int i = 0; i < getTaskViewCount(); i++) { TaskView task = requireTaskViewAt(i); task.getPrimarySplitTranslationProperty().set(task, translation); for (TaskView taskView : getTaskViews()) { taskView.getPrimarySplitTranslationProperty().set(taskView, translation); } } protected void setTaskViewsSecondarySplitTranslation(float translation) { mTaskViewsSecondarySplitTranslation = translation; for (int i = 0; i < getTaskViewCount(); i++) { TaskView taskView = requireTaskViewAt(i); for (TaskView taskView : getTaskViews()) { if (taskView == mSplitHiddenTaskView && !taskView.containsMultipleTasks()) { continue; } Loading Loading @@ -6088,9 +6064,7 @@ public abstract class RecentsView< private void updateEnabledOverlays() { TaskView focusedTaskView = getFocusedTaskView(); int taskCount = getTaskViewCount(); for (int i = 0; i < taskCount; i++) { TaskView taskView = requireTaskViewAt(i); for (TaskView taskView : getTaskViews()) { if (taskView == focusedTaskView) { continue; } Loading Loading @@ -6164,7 +6138,7 @@ public abstract class RecentsView< return; } Map<Integer, ThumbnailData> updatedThumbnails = mRecentsViewUtils.screenshotTasks(taskView, Map<Integer, ThumbnailData> updatedThumbnails = mUtils.screenshotTasks(taskView, mRecentsAnimationController); if (enableRefactorTaskThumbnail()) { mHelper.switchToScreenshot(taskView, updatedThumbnails, onFinishRunnable); Loading Loading @@ -6262,8 +6236,8 @@ public abstract class RecentsView< mRecentsViewModel.setTintAmount(tintAmount); } for (int i = 0; i < getTaskViewCount(); i++) { requireTaskViewAt(i).setColorTint(mColorTint, mTintingColor); for (TaskView taskView : getTaskViews()) { taskView.setColorTint(mColorTint, mTintingColor); } Drawable scrimBg = mContainer.getScrimView().getBackground(); Loading