Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7721382d authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Add missing check of avoidMoveToFront when starting activity

Otherwise if the task is still moved to top unexpectedly, the
surface visibility may not be consistent with its hierarchy order.

Note that when using 3rd party launcher as default home, it is
possible that home is the transient hide task. Then it should
still allow home to move to front. E.g. pressing home button
when recents animation is running.

Bug: 337995601
Test: A singleTask activity invokes
      startActivity or startActivityIfNeeded to start itself
      during swiping up to home. The end result should show
      home instead of black screen.
Test: atest Launcher3Tests: \
            TaplOpenCloseAllAppsTest#testAllAppsSwipeUpToWorkspace

Change-Id: I2a665ab3de7c8591a0cc0b528a9b892bd71e32a0
parent b972663f
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -1768,6 +1768,7 @@ class ActivityStarter {
            if (!avoidMoveToFront() && (mService.mHomeProcess == null
                    || mService.mHomeProcess.mUid != realCallingUid)
                    && (prevTopTask != null && prevTopTask.isActivityTypeHomeOrRecents())
                    && !targetTask.isActivityTypeHomeOrRecents()
                    && r.mTransitionController.isTransientHide(targetTask)) {
                mCanMoveToFrontCode = MOVE_TO_FRONT_AVOID_LEGACY;
            }
@@ -2167,7 +2168,7 @@ class ActivityStarter {
            // We don't need to start a new activity, and the client said not to do anything
            // if that is the case, so this is it!  And for paranoia, make sure we have
            // correctly resumed the top activity.
            if (!mMovedToFront && mDoResume) {
            if (!mMovedToFront && mDoResume && !avoidMoveToFront()) {
                ProtoLog.d(WM_DEBUG_TASKS, "Bring to front target: %s from %s", mTargetRootTask,
                        targetTaskTop);
                mTargetRootTask.moveToFront("intentActivityFound");
@@ -2196,7 +2197,7 @@ class ActivityStarter {
        if (mMovedToFront) {
            // We moved the task to front, use starting window to hide initial drawn delay.
            targetTaskTop.showStartingWindow(true /* taskSwitch */);
        } else if (mDoResume) {
        } else if (mDoResume && !avoidMoveToFront()) {
            // Make sure the root task and its belonging display are moved to topmost.
            mTargetRootTask.moveToFront("intentActivityFound");
        }