diff options
| author | 2019-01-24 17:04:36 -0800 | |
|---|---|---|
| committer | 2019-01-24 18:37:58 -0800 | |
| commit | 996df0dbca73e09f9fbb793c0f90dc3d0b4892da (patch) | |
| tree | 3095faa71bf4241d60894eb7a3379ddf96d1576b | |
| parent | 6b321517480924e5e977e0ef2437457f384280ab (diff) | |
Don't make active activities that are launched behind
Activities that are being launched behind are not intended to be
presented to the user, so they should not be made active (resumed
or paused) based just on their visibility and position.
One example is home/recents activity during transition from an
app to home after home button press with QuickStep enabled - the
home stack is made visible for the duration of the transition,
but it's still behind a fullscreen app stack and should not be
resumed immediately.
Bug: 123166999
Bug: 117135575
Test: ActivityManagerActivityVisibilityTests#testGoingHomeMultipleTimes
Test: ActivityManagerActivityVisibilityTests#testPressingHomeButtonMultipleTimes
Test: ActivityManagerActivityVisibilityTests#testPressingHomeButtonMultipleTimesQuick
Test: Manually switch between home and app with QuickStep enabled
Change-Id: I1106cf3da923e60d02b84d5fe4a552865113afc8
| -rw-r--r-- | services/core/java/com/android/server/wm/ActivityRecord.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index 6213fa02cb9f..b7c35c083174 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -2008,7 +2008,7 @@ final class ActivityRecord extends ConfigurationContainer { /** * Check if activity is eligible to be made active (resumed of paused). The activity: * - should be paused, stopped or stopping - * - should not be the currently active one + * - should not be the currently active one or launching behind other tasks * - should be either the topmost in task, or right below the top activity that is finishing * If all of these conditions are not met at the same time, the activity cannot be made active. */ @@ -2027,6 +2027,12 @@ final class ActivityRecord extends ConfigurationContainer { return false; } + if (this.mLaunchTaskBehind) { + // This activity is being launched from behind, which means that it's not intended to be + // presented to user right now, even if it's set to be visible. + return false; + } + // Check if position in task allows to become paused final int positionInTask = task.mActivities.indexOf(this); if (positionInTask == -1) { |