If hometask is last task to be dismissed, show empty recents instead of home screen

- http://ag/16221737 ensure homescren stub is always added if tasks hasn't been loaded in RecentsView. This introduced an edge case that after dismissing home task view, no task remains in overview and it get dismissed
- The fix is to show empty recents instead of home screen if last task dismissed is a home task (showing empty recents isn't always correct, as there might be unloaded tasks, but it's better than dismissing overview)
- Also tuned the timing of when mLoadPlanEverApplied is set

Fix: 206462357
Test: FallbackRecentsTest.goToOverviewFromHome
Change-Id: I0f395639f57a1a57fddf750623a8a74b8ede8555
This commit is contained in:
Alex Chau 2021-11-16 18:45:39 +00:00
parent d8a1b5c366
commit 04309940c0
1 changed files with 7 additions and 2 deletions

View File

@ -1335,6 +1335,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
return;
}
mLoadPlanEverApplied = true;
if (taskGroups == null || taskGroups.isEmpty()) {
removeTasksViewsAndClearAllButton();
onTaskStackUpdated();
@ -1437,7 +1438,6 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
resetTaskVisuals();
onTaskStackUpdated();
updateEnabledOverlays();
mLoadPlanEverApplied = true;
}
private boolean isModal() {
@ -3115,12 +3115,17 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
} else if (dismissedIndex < pageToSnapTo || pageToSnapTo == taskCount - 1) {
pageToSnapTo--;
}
boolean isHomeTaskDismissed = dismissedTaskView == getHomeTaskView();
removeViewInLayout(dismissedTaskView);
mTopRowIdSet.remove(dismissedTaskViewId);
if (taskCount == 1) {
removeViewInLayout(mClearAllButton);
startHome();
if (isHomeTaskDismissed) {
updateEmptyMessage();
} else {
startHome();
}
} else {
// Update focus task and its size.
if (finalIsFocusedTaskDismissed) {