Do not consider overlays when finding task to reuse.

An overlay should not be considered the top activity in a task when
considering a task when launching an activity. Doing so will alter
the behavior of launch modes, such as singleTop and singleTask. In
these cases, the developer has chosen such mode with the expectation
that their task will not have activities from other tasks placed on
top, which is the case for features such as locking a work profile.

This changelist addresses the issue by not considering an overlay to
be the top activity when finding a task based on ActivityRecord.

Fixes: 64839155
Test: bit FrameworksServicesTests:com.android.server.am.ActivityStackTests#testFindTaskWithOverlay
Change-Id: I2684baf6929e5af321404e2eef597f456ff87ee8
4 files changed