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

Commit eff42d31 authored by Vadim Tryshev's avatar Vadim Tryshev
Browse files

Exclude from Recents Assistant in half-screen mode

The expectation is that full-screen assistant will not have
FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS attribute, and will be shown in
Recents, whether it's a first or a non-first task. The half-screen
assistant will have this flag set, and will never be shown in Recents.

Bug: 70789568
Test: Check that Assistant with FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS isn't
shown in Recents.

Change-Id: I5bd2f5f638cc4e0100e435d94eee22e7c022aab6
parent 2cb0244a
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.server.am;
import static android.app.ActivityManager.FLAG_AND_UNLOCKED;
import static android.app.ActivityManager.RECENT_IGNORE_UNAVAILABLE;
import static android.app.ActivityManager.RECENT_WITH_EXCLUDED;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_ASSISTANT;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS;
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
@@ -1099,13 +1100,22 @@ class RecentTasks {
                + " sessionDuration=" + mActiveTasksSessionDurationMs
                + " inactiveDuration=" + task.getInactiveDuration()
                + " activityType=" + task.getActivityType()
                + " windowingMode=" + task.getWindowingMode());
                + " windowingMode=" + task.getWindowingMode()
                + " intentFlags=" + task.getBaseIntent().getFlags());

        // Ignore certain activity types completely
        switch (task.getActivityType()) {
            case ACTIVITY_TYPE_HOME:
            case ACTIVITY_TYPE_RECENTS:
                // Ignore certain activity types completely
                return false;
            case ACTIVITY_TYPE_ASSISTANT:
                // Ignore assistant that chose to be excluded from Recents, even if it's a top
                // task.
                if ((task.getBaseIntent().getFlags()
                        & Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS)
                        == Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) {
                    return false;
                }
        }

        // Ignore certain windowing modes