From 85ee65483d877e66c4446fce31520f293f0d67c9 Mon Sep 17 00:00:00 2001 From: Chong Zhang Date: Fri, 2 Oct 2015 13:36:38 -0700 Subject: Put ResovlerActivity and noDisplay activities in the source task Launch the ResolverActivity in the source task, so that the chooser stays in the bounds of the task, instead of always at the bottom of the screen. Also put the nodisplay activities in the source task, it could launch other activities (eg. ResolverActivity), we need the original task. Bug: 24136124 Change-Id: I8b22d7f6cba4dc9e57cb19d357091013a74826bb --- services/core/java/com/android/server/am/ActivityRecord.java | 6 +++--- services/core/java/com/android/server/am/ActivityStack.java | 2 +- .../java/com/android/server/am/ActivityStackSupervisor.java | 10 +++++++++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/services/core/java/com/android/server/am/ActivityRecord.java b/services/core/java/com/android/server/am/ActivityRecord.java index 24b90d81996d..d4e798fc45b8 100755 --- a/services/core/java/com/android/server/am/ActivityRecord.java +++ b/services/core/java/com/android/server/am/ActivityRecord.java @@ -477,8 +477,8 @@ final class ActivityRecord { } } - boolean isNotResolverActivity() { - return !ResolverActivity.class.getName().equals(realActivity.getClassName()); + boolean isResolverActivity() { + return ResolverActivity.class.getName().equals(realActivity.getClassName()); } ActivityRecord(ActivityManagerService _service, ProcessRecord _caller, @@ -605,7 +605,7 @@ final class ActivityRecord { _intent.getData() == null && _intent.getType() == null && (intent.getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) != 0 && - isNotResolverActivity()) { + !isResolverActivity()) { // This sure looks like a home activity! mActivityType = HOME_ACTIVITY_TYPE; } else if (realActivity.getClassName().contains(RECENTS_PACKAGE_NAME)) { diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java index a796ea7d4ab5..f549af8c0c53 100644 --- a/services/core/java/com/android/server/am/ActivityStack.java +++ b/services/core/java/com/android/server/am/ActivityStack.java @@ -1153,7 +1153,7 @@ final class ActivityStack { next.results = null; next.newIntents = null; - if (next.isHomeActivity() && next.isNotResolverActivity()) { + if (next.isHomeActivity()) { ProcessRecord app = next.task.mActivities.get(0).app; if (app != null && app != mService.mHomeProcess) { mService.mHomeProcess = app; diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java index 6b5f2056ec82..dc979543b463 100644 --- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java +++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java @@ -1262,7 +1262,7 @@ public final class ActivityStackSupervisor implements DisplayListener { r.userId, System.identityHashCode(r), task.taskId, r.shortComponentName); } - if (r.isHomeActivity() && r.isNotResolverActivity()) { + if (r.isHomeActivity()) { // Home process is the root process of the task. mService.mHomeProcess = task.mActivities.get(0).app; } @@ -2024,6 +2024,14 @@ public final class ActivityStackSupervisor implements DisplayListener { reuseTask = inTask; } else { inTask = null; + // Launch ResolverActivity in the source task, so that it stays in the task + // bounds when in freeform workspace. + // Also put noDisplay activities in the source task. These by itself can + // be placed in any task/stack, however it could launch other activities + // like ResolverActivity, and we want those to stay in the original task. + if (r.isResolverActivity() || r.noDisplay) { + addingToTask = true; + } } if (inTask == null) { -- cgit v1.2.3-59-g8ed1b