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

Commit 4a61fcf7 authored by Louis Chang's avatar Louis Chang
Browse files

Checks the visible-requested state vs. #isVisible

The transient-launch activity could be hidden in the end
of the transition. Therefore, the activity should still be
paused. A wtf log was dumped when trying to pause the Activity
while it is the resuming Activity.

Bug: 310015968
Test: starting recent tasks from Recents
Change-Id: I5178f9769b653dc685a545caeb0c756a30cba5f3
parent 79d91aa9
Loading
Loading
Loading
Loading
+4 −6
Original line number Original line Diff line number Diff line
@@ -1051,12 +1051,12 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
     * @return true if we are *guaranteed* to enter-pip. This means we return false if there's
     * @return true if we are *guaranteed* to enter-pip. This means we return false if there's
     *         a chance we won't thus legacy-entry (via pause+userLeaving) will return false.
     *         a chance we won't thus legacy-entry (via pause+userLeaving) will return false.
     */
     */
    private boolean checkEnterPipOnFinish(@NonNull ActivityRecord ar,
    private boolean checkEnterPipOnFinish(@NonNull ActivityRecord ar) {
            @Nullable ActivityRecord resuming) {
        if (!mCanPipOnFinish || !ar.isVisible() || ar.getTask() == null || !ar.isState(RESUMED)) {
        if (!mCanPipOnFinish || !ar.isVisible() || ar.getTask() == null || !ar.isState(RESUMED)) {
            return false;
            return false;
        }
        }


        final ActivityRecord resuming = getVisibleTransientLaunch(ar.getTaskDisplayArea());
        if (ar.pictureInPictureArgs != null && ar.pictureInPictureArgs.isAutoEnterEnabled()) {
        if (ar.pictureInPictureArgs != null && ar.pictureInPictureArgs.isAutoEnterEnabled()) {
            if (!ar.getTask().isVisibleRequested() || didCommitTransientLaunch()) {
            if (!ar.getTask().isVisibleRequested() || didCommitTransientLaunch()) {
                // force enable pip-on-task-switch now that we've committed to actually launching
                // force enable pip-on-task-switch now that we've committed to actually launching
@@ -1195,9 +1195,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
                final boolean isScreenOff = ar.mDisplayContent == null
                final boolean isScreenOff = ar.mDisplayContent == null
                        || ar.mDisplayContent.getDisplayInfo().state == Display.STATE_OFF;
                        || ar.mDisplayContent.getDisplayInfo().state == Display.STATE_OFF;
                if ((!visibleAtTransitionEnd || isScreenOff) && !ar.isVisibleRequested()) {
                if ((!visibleAtTransitionEnd || isScreenOff) && !ar.isVisibleRequested()) {
                    final ActivityRecord resuming = getVisibleTransientLaunch(
                    final boolean commitVisibility = !checkEnterPipOnFinish(ar);
                            ar.getTaskDisplayArea());
                    final boolean commitVisibility = !checkEnterPipOnFinish(ar, resuming);
                    // Avoid commit visibility if entering pip or else we will get a sudden
                    // Avoid commit visibility if entering pip or else we will get a sudden
                    // "flash" / surface going invisible for a split second.
                    // "flash" / surface going invisible for a split second.
                    if (commitVisibility) {
                    if (commitVisibility) {
@@ -1424,7 +1422,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
            if (candidateActivity.getTaskDisplayArea() != taskDisplayArea) {
            if (candidateActivity.getTaskDisplayArea() != taskDisplayArea) {
                continue;
                continue;
            }
            }
            if (!candidateActivity.isVisible()) {
            if (!candidateActivity.isVisibleRequested()) {
                continue;
                continue;
            }
            }
            return candidateActivity;
            return candidateActivity;