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

Commit 15a0299e authored by Daichi Hirono's avatar Daichi Hirono
Browse files

Deliver intent to activity when FLAG_ACTIIVTY_NEW_DOCUMENT is specified.

Previously the condition check to deliver intent to existing activity
misses the case that it goes back to existing activity by
FLAG_ACTIVITY_NEW_DOCUMENT. As a result it does not call
Activity#onNewIntent though API document says it does.

Fixes: 24523281
Change-Id: I7e7138a5939f30569e2b217d037bfadf5aad9b61
parent ed3c2bd8
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1023,6 +1023,7 @@ class ActivityStarter {
            // as the first operation, in case the activity will be resumed as a result of later
            // operations.
            if ((mLaunchFlags & FLAG_ACTIVITY_CLEAR_TOP) != 0
                    || isDocumentLaunchesIntoExisting(mLaunchFlags)
                    || mLaunchSingleInstance || mLaunchSingleTask) {
                // In this situation we want to remove all activities from the task up to the one
                // being started. In most cases this means we are resetting the task to its initial
@@ -2039,4 +2040,9 @@ class ActivityStarter {
            }
        }
    }

    static boolean isDocumentLaunchesIntoExisting(int flags) {
        return (flags & Intent.FLAG_ACTIVITY_NEW_DOCUMENT) != 0 &&
                (flags & Intent.FLAG_ACTIVITY_MULTIPLE_TASK) == 0;
    }
}
+2 −1
Original line number Diff line number Diff line
@@ -909,7 +909,8 @@ final class TaskRecord {
                // expecting onNewIntent()), then we will finish the current
                // instance of the activity so a new fresh one can be started.
                if (ret.launchMode == ActivityInfo.LAUNCH_MULTIPLE
                        && (launchFlags & Intent.FLAG_ACTIVITY_SINGLE_TOP) == 0) {
                        && (launchFlags & Intent.FLAG_ACTIVITY_SINGLE_TOP) == 0
                        && !ActivityStarter.isDocumentLaunchesIntoExisting(launchFlags)) {
                    if (!ret.finishing) {
                        if (stack != null) {
                            stack.finishActivityLocked(