summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Louis Chang <louischang@google.com> 2019-01-17 10:36:56 +0800
committer Louis Chang <louischang@google.com> 2019-02-21 17:32:59 +0800
commitb45ee7e3455c9c9120ba714cf257d68d2c050dca (patch)
treea3062426f4332c3cc4940793cbd96b3baef41d95
parent1485a60b454c9a3e335084e10734cba21525ee8c (diff)
Update task-on-home flag to task for every activity launch
Task intent was the original intent that started the task, which was not being updated for later activity launches. Therefore, home was not bring to top along with the reused task while starting the activity again with the task-on-home flag. Bug: 122564343 Test: atest ActivityManagerActivityVisibilityTests#testLaunchTaskOnHome Change-Id: I22a7a9c57c18b8687e41852af27268c37a87fc43
-rw-r--r--services/core/java/com/android/server/wm/ActivityStarter.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/wm/ActivityStarter.java b/services/core/java/com/android/server/wm/ActivityStarter.java
index 538813e9b21c..b0146dbacc28 100644
--- a/services/core/java/com/android/server/wm/ActivityStarter.java
+++ b/services/core/java/com/android/server/wm/ActivityStarter.java
@@ -46,6 +46,7 @@ import static android.content.Intent.FLAG_ACTIVITY_REORDER_TO_FRONT;
import static android.content.Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED;
import static android.content.Intent.FLAG_ACTIVITY_RETAIN_IN_RECENTS;
import static android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP;
+import static android.content.Intent.FLAG_ACTIVITY_TASK_ON_HOME;
import static android.content.pm.ActivityInfo.DOCUMENT_LAUNCH_ALWAYS;
import static android.content.pm.ActivityInfo.LAUNCH_MULTIPLE;
import static android.content.pm.ActivityInfo.LAUNCH_SINGLE_INSTANCE;
@@ -1457,6 +1458,14 @@ class ActivityStarter {
// This task was started because of movement of the activity based on affinity...
// Now that we are actually launching it, we can assign the base intent.
reusedActivity.getTaskRecord().setIntent(mStartActivity);
+ } else {
+ final boolean taskOnHome =
+ (mStartActivity.intent.getFlags() & FLAG_ACTIVITY_TASK_ON_HOME) != 0;
+ if (taskOnHome) {
+ reusedActivity.getTaskRecord().intent.addFlags(FLAG_ACTIVITY_TASK_ON_HOME);
+ } else {
+ reusedActivity.getTaskRecord().intent.removeFlags(FLAG_ACTIVITY_TASK_ON_HOME);
+ }
}
// This code path leads to delivering a new intent, we want to make sure we schedule it