Fix setContentAlpha skipping all TaskViews when runningTaskId is -1

- Currently when runningTaskId is -1, it can skips setting contentAlpha for all TaskViews if they haven't been loaded, this cause RecentsView to become empty in the bug
- Can be reproduced with excludeFromRecents=true apps

Bug: 324495241
Test: swipe up from an app that has excludeFromRecents=true, e.g.
Volume Dialog, Home quick settings tile, and Routines widget; ensure RecentsView is visible after gesture settles
Flag: None

Change-Id: I9f1b4ffed6d09805c83c6e2241903c73d4ead9ad
This commit is contained in:
Alex Chau committed 2024-02-23 11:59:48 +00:00
1 parent fdf6df3226
commit 58bd15c6ab
1 file changed
+5 -3
@@ -4261,10 +4261,12 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
for (int i = getTaskViewCount() - 1; i >= 0; i--) {
TaskView child = requireTaskViewAt(i);
int[] childTaskIds = child.getTaskIds();
if (!mRunningTaskTileHidden ||
(childTaskIds[0] != runningTaskId && childTaskIds[1] != runningTaskId)) {
child.setStableAlpha(alpha);
if (runningTaskId != INVALID_TASK_ID
&& mRunningTaskTileHidden
&& (childTaskIds[0] == runningTaskId || childTaskIds[1] == runningTaskId)) {
continue;
}
child.setStableAlpha(alpha);
}
mClearAllButton.setContentAlpha(mContentAlpha);
int alphaInt = Math.round(alpha * 255);