Merge "Auto remove the embedded task from Recents" into sc-v2-dev

This commit is contained in:
Louis Chang
2021-08-11 03:39:54 +00:00
committed by Android (Google) Code Review

View File

@@ -722,7 +722,7 @@ class Task extends TaskFragment {
} catch (RemoteException e) { } catch (RemoteException e) {
} }
} }
if (autoRemoveFromRecents() || isVoiceSession) { if (autoRemoveFromRecents(oldParent.asTaskFragment()) || isVoiceSession) {
// Task creator asked to remove this when done, or this task was a voice // Task creator asked to remove this when done, or this task was a voice
// interaction, so it should not remain on the recent tasks list. // interaction, so it should not remain on the recent tasks list.
mTaskSupervisor.mRecentTasks.remove(this); mTaskSupervisor.mRecentTasks.remove(this);
@@ -1577,11 +1577,12 @@ class Task extends TaskFragment {
return count > 0; return count > 0;
} }
private boolean autoRemoveFromRecents() { private boolean autoRemoveFromRecents(TaskFragment oldParentFragment) {
// We will automatically remove the task either if it has explicitly asked for // We will automatically remove the task either if it has explicitly asked for
// this, or it is empty and has never contained an activity that got shown to // this, or it is empty and has never contained an activity that got shown to
// the user. // the user, or it was being embedded in another Task.
return autoRemoveRecents || (!hasChild() && !getHasBeenVisible()); return autoRemoveRecents || (!hasChild() && !getHasBeenVisible()
|| (oldParentFragment != null && oldParentFragment.isEmbedded()));
} }
private void clearPinnedTaskIfNeed() { private void clearPinnedTaskIfNeed() {