Apply setAlwaysOnTop when recycling Task.
Moved the logic to startActivityUnchecked() to apply it for both a new task and a recycling task. Bug: 193837989 Test: follow the reproduce steps in b/193837989. Change-Id: I1bee13a88da1fe2cf3af2cb117071a758095fb9f
This commit is contained in:
@@ -1558,6 +1558,7 @@ class ActivityStarter {
|
||||
TaskFragment inTaskFragment, boolean restrictedBgActivity,
|
||||
NeededUriGrants intentGrants) {
|
||||
int result = START_CANCELED;
|
||||
boolean startResultSuccessful = false;
|
||||
final Task startedActivityRootTask;
|
||||
|
||||
// Create a transition now to record the original intent of actions taken within
|
||||
@@ -1583,6 +1584,15 @@ class ActivityStarter {
|
||||
result = startActivityInner(r, sourceRecord, voiceSession, voiceInteractor,
|
||||
startFlags, doResume, options, inTask, inTaskFragment, restrictedBgActivity,
|
||||
intentGrants);
|
||||
startResultSuccessful = ActivityManager.isStartResultSuccessful(result);
|
||||
final boolean taskAlwaysOnTop = options != null && options.getTaskAlwaysOnTop();
|
||||
// Apply setAlwaysOnTop when starting an Activity is successful regardless of creating
|
||||
// a new Activity or recycling the existing Activity.
|
||||
if (taskAlwaysOnTop && startResultSuccessful) {
|
||||
final Task targetRootTask =
|
||||
mTargetRootTask != null ? mTargetRootTask : mTargetTask.getRootTask();
|
||||
targetRootTask.setAlwaysOnTop(true);
|
||||
}
|
||||
} finally {
|
||||
Trace.traceEnd(Trace.TRACE_TAG_WINDOW_MANAGER);
|
||||
startedActivityRootTask = handleStartResult(r, result);
|
||||
@@ -1590,7 +1600,7 @@ class ActivityStarter {
|
||||
mSupervisor.mUserLeaving = false;
|
||||
|
||||
// Transition housekeeping
|
||||
if (!ActivityManager.isStartResultSuccessful(result)) {
|
||||
if (!startResultSuccessful) {
|
||||
if (newTransition != null) {
|
||||
newTransition.abort();
|
||||
}
|
||||
@@ -1754,11 +1764,6 @@ class ActivityStarter {
|
||||
|
||||
if (!mAvoidMoveToFront && mDoResume) {
|
||||
mTargetRootTask.getRootTask().moveToFront("reuseOrNewTask", targetTask);
|
||||
if (mOptions != null) {
|
||||
if (mOptions.getTaskAlwaysOnTop()) {
|
||||
mTargetRootTask.setAlwaysOnTop(true);
|
||||
}
|
||||
}
|
||||
if (!mTargetRootTask.isTopRootTaskInDisplayArea() && mService.mInternal.isDreaming()) {
|
||||
// Launching underneath dream activity (fullscreen, always-on-top). Run the launch-
|
||||
// -behind transition so the Activity gets created and starts in visible state.
|
||||
|
||||
Reference in New Issue
Block a user