From bee6422d7cbffde474aaac7d94bfffcaa0c9c126 Mon Sep 17 00:00:00 2001 From: Robin Lee Date: Fri, 6 Jan 2017 17:12:55 +0000 Subject: [PATCH] Don't move-to-front overlays for unresumed tasks If we do move those tasks to the front, it will annoy the user of the device because clearly that's not the activity they were using at the time (otherwise it would have been resumed already) This is a more generous check than the existing "if !top.visible" which only prevented the new overlay activity from bringing the task to the front if it was unresumed AND not visible on the screen. Now it just has to be unresumed. Bug: 31001762 Change-Id: I4576aaafa141ef5297f9c18935b747693a80f0fd --- services/core/java/com/android/server/am/ActivityStarter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/am/ActivityStarter.java b/services/core/java/com/android/server/am/ActivityStarter.java index 3bb9ccc22a87c..09af9412da646 100644 --- a/services/core/java/com/android/server/am/ActivityStarter.java +++ b/services/core/java/com/android/server/am/ActivityStarter.java @@ -1238,7 +1238,7 @@ class ActivityStarter { r.mTaskOverlay = true; final TaskRecord task = mSupervisor.anyTaskForIdLocked(mOptions.getLaunchTaskId()); final ActivityRecord top = task != null ? task.getTopActivity() : null; - if (top != null && !top.visible) { + if (top != null && top.state != RESUMED) { // The caller specifies that we'd like to be avoided to be moved to the front, so be // it!