Don't skip adding stub home task if applyLoadPlan hasn't run

- In FallbackRecentsTest.goToOverviewFromHome, home task gesture starts before applyLoadPlan, causing shouldAddStubTaskView to return false because getTaskViewCount is 0. This falsely avoid home task to be added to RecentsView, causing the animation to be drastically different from what user sees outside the test
- Added a check on whether applyLoadPlan is ever called to solve the problem

Fix: 205580523
Test: FallbackRecentsTest.goToOverviewFromHome
Change-Id: I2e435e56008e916e8f7e1037d3fa3c8177437d13
This commit is contained in:
Alex Chau 2021-11-09 19:01:23 +00:00
parent 048a8246fa
commit 7c4bc7dd74
2 changed files with 4 additions and 1 deletions

View File

@ -145,9 +145,10 @@ public class FallbackRecentsView extends RecentsView<RecentsActivity, RecentsSta
RunningTaskInfo runningTaskInfo = runningTaskInfos[0];
if (mHomeTaskInfo != null && runningTaskInfo != null &&
mHomeTaskInfo.taskId == runningTaskInfo.taskId
&& getTaskViewCount() == 0) {
&& getTaskViewCount() == 0 && mLoadPlanEverApplied) {
// Do not add a stub task if we are running over home with empty recents, so that we
// show the empty recents message instead of showing a stub task and later removing it.
// Ignore empty task signal if applyLoadPlan has never run.
return false;
}
return super.shouldAddStubTaskView(runningTaskInfos);

View File

@ -573,6 +573,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
// Keeps track of task id whose visual state should not be reset
private int mIgnoreResetTaskId = -1;
protected boolean mLoadPlanEverApplied;
// Variables for empty state
private final Drawable mEmptyIcon;
@ -1451,6 +1452,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
resetTaskVisuals();
onTaskStackUpdated();
updateEnabledOverlays();
mLoadPlanEverApplied = true;
}
private boolean isModal() {