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

Commit 8169a9f3 authored by Jesper Hansson's avatar Jesper Hansson Committed by Sahil Sonar
Browse files

Allow ACTIVITY_TYPE_RECENTS to have multiple root tasks

A guest user having a third party launcher cannot open Recents.

When the preinstalled launcher is used, the built-in recents
implementation will be used (QuickstepLauncher.java) and
which means there won't be any task with activityType "recents"
in the display stack, because Home and Recents are the same.

When a third party launcher is used, the fallback recents activity
will be launched (com.android.quickstep.RecentsActivity).

When this RecentsActivity is created, a new task with activity type
"recents" is created and this task remains in the display stack
after the current user is switched to a guest user.
When we try to launch a new RecentsActivity it will not be allowed
since one activity of type "recents" is allowed to exist at the same time.

Solve this by allowing multiple root task for recents activity type.

Test: Install a 3p launcher, use that as default with a guest user and open recents
Bug: 304930756
Co-Author: Isak Lilja <Isak.Lilja@sony.com>
Change-Id: Ibacc05f7dd3ca6e835d7fea1ada87a21faea739a
parent 6786f0ff
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -6583,11 +6583,11 @@ class Task extends TaskFragment {
                mActivityType = ACTIVITY_TYPE_STANDARD;
            }

            if (mActivityType != ACTIVITY_TYPE_STANDARD
            if (!DisplayContent.alwaysCreateRootTask(tda.getWindowingMode(), mActivityType)
                    && mActivityType != ACTIVITY_TYPE_UNDEFINED) {
                // For now there can be only one root task of a particular non-standard activity
                // type on a display. So, get that ignoring whatever windowing mode it is
                // currently in.
                // Only Recents or Standard activity types are allowed to have more than one
                // root task on a display, this is independent of whatever windowing mode it
                // is currently in.
                Task rootTask = tda.getRootTask(WINDOWING_MODE_UNDEFINED, mActivityType);
                if (rootTask != null) {
                    throw new IllegalArgumentException("Root task=" + rootTask + " of activityType="