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
diff --git a/services/core/java/com/android/server/am/TaskRecord.java b/services/core/java/com/android/server/am/TaskRecord.java
index 4691e1a..7393e6a 100644
--- a/services/core/java/com/android/server/am/TaskRecord.java
+++ b/services/core/java/com/android/server/am/TaskRecord.java
@@ -909,7 +909,8 @@
                 // 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(