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

Commit 98d5a3bb authored by Louis Chang's avatar Louis Chang Committed by Android (Google) Code Review
Browse files

Merge "Do not override MULTIPLE_TASK flag for singleInstancePerTask" into sc-dev

parents 5ec2a767 5ff15310
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -826,7 +826,7 @@
            that created the task, and therefore there will only be one instance of this activity
            in a task. In constrast to the {@code singleTask} launch mode, this activity can be
            started in multiple instances in different tasks if the
            {@code FLAG_ACTIVITY_MULTIPLE_TASK} is set.-->
            {@code FLAG_ACTIVITY_MULTIPLE_TASK} or {@code FLAG_ACTIVITY_NEW_DOCUMENT} is set.-->
        <enum name="singleInstancePerTask" value="4" />
    </attr>
    <!-- Specify the orientation an activity should be run in.  If not
+16 −2
Original line number Diff line number Diff line
@@ -2721,8 +2721,22 @@ class ActivityStarter {
                    launchFlags |= Intent.FLAG_ACTIVITY_NEW_DOCUMENT;
                    break;
                case ActivityInfo.DOCUMENT_LAUNCH_NEVER:
                    if (mLaunchMode == LAUNCH_SINGLE_INSTANCE_PER_TASK) {
                        // Remove MULTIPLE_TASK flag along with NEW_DOCUMENT only if NEW_DOCUMENT
                        // is set, otherwise we still want to keep the MULTIPLE_TASK flag (if
                        // any) for singleInstancePerTask that the multiple tasks can be created,
                        // or a singleInstancePerTask activity is basically the same as a
                        // singleTask activity when documentLaunchMode set to never.
                        if ((launchFlags & Intent.FLAG_ACTIVITY_NEW_DOCUMENT) != 0) {
                            launchFlags &= ~(Intent.FLAG_ACTIVITY_NEW_DOCUMENT
                                    | FLAG_ACTIVITY_MULTIPLE_TASK);
                        }
                    } else {
                        // TODO(b/184903976): Should FLAG_ACTIVITY_MULTIPLE_TASK always be
                        // removed for document-never activity?
                        launchFlags &=
                                ~(Intent.FLAG_ACTIVITY_NEW_DOCUMENT | FLAG_ACTIVITY_MULTIPLE_TASK);
                    }
                    break;
            }
        }