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

Commit 0583d3d1 authored by Winson Chung's avatar Winson Chung
Browse files

Hiding pinned stack tasks from overview

Bug: 25381158
Change-Id: Iad442b7f5dc49109529cb5dab2168b19837af6e3
parent 87af9a03
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -1236,6 +1236,18 @@ public class ActivityManager {
     */
    public static final int RECENT_IGNORE_HOME_STACK_TASKS = 0x0008;

    /**
     * Ignores all tasks that are on the docked stack.
     * @hide
     */
    public static final int RECENT_INGORE_DOCKED_STACK_TASKS = 0x0010;

    /**
     * Ignores all tasks that are on the pinned stack.
     * @hide
     */
    public static final int RECENT_INGORE_PINNED_STACK_TASKS = 0x0020;

    /**
     * <p></p>Return a list of the tasks that the user has recently launched, with
     * the most recent being first and older ones after in order.
+2 −0
Original line number Diff line number Diff line
@@ -194,6 +194,8 @@ public class SystemServicesProxy {
        int numTasksToQuery = Math.max(minNumTasksToQuery, numLatestTasks);
        List<ActivityManager.RecentTaskInfo> tasks = mAm.getRecentTasksForUser(numTasksToQuery,
                ActivityManager.RECENT_IGNORE_HOME_STACK_TASKS |
                ActivityManager.RECENT_INGORE_DOCKED_STACK_TASKS |
                ActivityManager.RECENT_INGORE_PINNED_STACK_TASKS |
                ActivityManager.RECENT_IGNORE_UNAVAILABLE |
                ActivityManager.RECENT_INCLUDE_PROFILES |
                ActivityManager.RECENT_WITH_EXCLUDED, userId);
+6 −6
Original line number Diff line number Diff line
@@ -352,28 +352,28 @@ public class TaskStack {
            @Override
            public boolean acceptTask(SparseArray<Task> taskIdMap, Task t, int index) {
                if (t.isAffiliatedTask()) {
                    // If this task is affiliated with another parent in the stack, then the historical state of this
                    // task depends on the state of the parent task
                    // If this task is affiliated with another parent in the stack, then the
                    // historical state of this task depends on the state of the parent task
                    Task parentTask = taskIdMap.get(t.affiliationTaskId);
                    if (parentTask != null) {
                        t = parentTask;
                    }
                }
                return !t.isHistorical && !SystemServicesProxy.isDockedStack(t.key.stackId);
                return !t.isHistorical;
            }
        });
        mHistoryTaskList.setFilter(new TaskFilter() {
            @Override
            public boolean acceptTask(SparseArray<Task> taskIdMap, Task t, int index) {
                if (t.isAffiliatedTask()) {
                    // If this task is affiliated with another parent in the stack, then the historical state of this
                    // task depends on the state of the parent task
                    // If this task is affiliated with another parent in the stack, then the
                    // historical state of this task depends on the state of the parent task
                    Task parentTask = taskIdMap.get(t.affiliationTaskId);
                    if (parentTask != null) {
                        t = parentTask;
                    }
                }
                return t.isHistorical && !SystemServicesProxy.isDockedStack(t.key.stackId);
                return t.isHistorical;
            }
        });
    }
+14 −0
Original line number Diff line number Diff line
@@ -8768,6 +8768,20 @@ public final class ActivityManagerService extends ActivityManagerNative
                            continue;
                        }
                    }
                    if ((flags & ActivityManager.RECENT_INGORE_DOCKED_STACK_TASKS) != 0) {
                        if (tr.stack != null && tr.stack.isDockedStack()) {
                            if (DEBUG_RECENTS) Slog.d(TAG_RECENTS,
                                    "Skipping, docked stack task: " + tr);
                            continue;
                        }
                    }
                    if ((flags & ActivityManager.RECENT_INGORE_PINNED_STACK_TASKS) != 0) {
                        if (tr.stack != null && tr.stack.isPinnedStack()) {
                            if (DEBUG_RECENTS) Slog.d(TAG_RECENTS,
                                    "Skipping, pinned stack task: " + tr);
                            continue;
                        }
                    }
                    if (tr.autoRemoveRecents && tr.getTopActivity() == null) {
                        // Don't include auto remove tasks that are finished or finishing.
                        if (DEBUG_RECENTS) Slog.d(TAG_RECENTS,
+8 −0
Original line number Diff line number Diff line
@@ -520,6 +520,14 @@ final class ActivityStack {
        return mStackId == HOME_STACK_ID;
    }

    final boolean isDockedStack() {
        return mStackId == DOCKED_STACK_ID;
    }

    final boolean isPinnedStack() {
        return mStackId == PINNED_STACK_ID;
    }

    final boolean isOnHomeDisplay() {
        return isAttached() &&
                mActivityContainer.mActivityDisplay.mDisplayId == Display.DEFAULT_DISPLAY;