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
This commit is contained in:
Robin Lee
2017-01-06 17:12:55 +00:00
parent 97a8d70386
commit bee6422d7c

View File

@@ -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!