Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c77ccb4b authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Respect the virtual device recents policy." into main

parents cf6b69c4 7dd38c48
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -725,7 +725,7 @@ class Task extends TaskFragment {
            } catch (RemoteException e) {
            }
        }
        if (autoRemoveFromRecents(oldParent.asTaskFragment()) || isVoiceSession) {
        if (shouldAutoRemoveFromRecents(oldParent.asTaskFragment()) || isVoiceSession) {
            // 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.
            mTaskSupervisor.mRecentTasks.remove(this);
@@ -1558,12 +1558,14 @@ class Task extends TaskFragment {
        return count > 0;
    }

    private boolean autoRemoveFromRecents(TaskFragment oldParentFragment) {
    private boolean shouldAutoRemoveFromRecents(TaskFragment oldParentFragment) {
        // 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
        // the user, or it was being embedded in another Task.
        return autoRemoveRecents || (!hasChild() && !getHasBeenVisible()
                || (oldParentFragment != null && oldParentFragment.isEmbedded()));
        // the user, or it was being embedded in another Task, or the display policy
        // doesn't allow recents,
        return autoRemoveRecents || (!hasChild() && !getHasBeenVisible())
                || (oldParentFragment != null && oldParentFragment.isEmbedded())
                || (mDisplayContent != null && !mDisplayContent.canShowTasksInHostDeviceRecents());
    }

    private void clearPinnedTaskIfNeed() {