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

Commit 48e9a6fb authored by Riddle Hsu's avatar Riddle Hsu Committed by Automerger Merge Worker
Browse files

Merge "Added limit of descendant amount when adding activity to task" into udc-dev am: 5cde2b96

parents 0b1921bd 5cde2b96
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -171,6 +171,12 @@ class ActivityStarter {

    private static final int INVALID_LAUNCH_MODE = -1;

    /**
     * Avoid problematical apps from occupying system resources (e.g. the amount of surface) by
     * launching too many activities in a task.
     */
    private static final long MAX_TASK_WEIGHT_FOR_ADDING_ACTIVITY = 300;

    /**
     * Feature flag to protect PendingIntent being abused to start background activity.
     */
@@ -1647,6 +1653,13 @@ class ActivityStarter {
        }

        if (targetTask != null) {
            if (targetTask.getTreeWeight() > MAX_TASK_WEIGHT_FOR_ADDING_ACTIVITY) {
                Slog.e(TAG, "Remove " + targetTask + " because it has contained too many"
                        + " activities or windows (abort starting " + r
                        + " from uid=" + mCallingUid);
                targetTask.removeImmediately("bulky-task");
                return START_ABORTED;
            }
            mPriorAboveTask = TaskDisplayArea.getRootTaskAbove(targetTask.getRootTask());
        }