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

Commit d498c4d5 authored by Wei Sheng Shih's avatar Wei Sheng Shih Committed by Android (Google) Code Review
Browse files

Merge "Fixes start new showWhenLocked activity will stuck on DreamActivity."

parents cd5d5033 21d73a78
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4664,7 +4664,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        // case where this is the top activity in a pinned stack.
        final boolean isTop = this == stack.getTopNonFinishingActivity();
        final boolean isTopNotPinnedStack = stack.isAttached()
                && stack.getDisplayArea().isTopNotPinnedStack(stack);
                && stack.getDisplayArea().isTopNotFinishNotPinnedStack(stack);
        final boolean visibleIgnoringDisplayStatus = stack.checkKeyguardVisibility(this,
                visibleIgnoringKeyguard, isTop && isTopNotPinnedStack);

+5 −1
Original line number Diff line number Diff line
@@ -1489,9 +1489,13 @@ final class TaskDisplayArea extends DisplayArea<Task> {
        return stack == getTopStack();
    }

    boolean isTopNotPinnedStack(Task stack) {
    boolean isTopNotFinishNotPinnedStack(Task stack) {
        for (int i = getStackCount() - 1; i >= 0; --i) {
            final Task current = getStackAt(i);
            final ActivityRecord topAct = current.getTopNonFinishingActivity();
            if (topAct == null) {
                continue;
            }
            if (!current.inPinnedWindowingMode()) {
                return current == stack;
            }
+7 −3
Original line number Diff line number Diff line
@@ -24,8 +24,6 @@ import android.annotation.NonNull;
import android.util.ArrayMap;
import android.util.Slog;

import com.android.server.wm.WindowManagerService.H;

import java.io.PrintWriter;

/**
@@ -102,7 +100,13 @@ class UnknownAppVisibilityController {
        if (DEBUG_UNKNOWN_APP_VISIBILITY) {
            Slog.d(TAG, "App launched activity=" + activity);
        }
        // If the activity was started with launchTaskBehind, the lifecycle will goes to paused
        // directly, and the process will pass onResume, so we don't need to waiting resume for it.
        if (!activity.mLaunchTaskBehind) {
            mUnknownApps.put(activity, UNKNOWN_STATE_WAITING_RESUME);
        } else {
            mUnknownApps.put(activity, UNKNOWN_STATE_WAITING_RELAYOUT);
        }
    }

    /**
+12 −0
Original line number Diff line number Diff line
@@ -54,6 +54,18 @@ public class UnknownAppVisibilityControllerTest extends WindowTestsBase {
        assertTrue(mDisplayContent.mUnknownAppVisibilityController.allResolved());
    }

    @Test
    public void testSkipResume() {
        final ActivityRecord activity = createTestActivityRecord(mDisplayContent);
        activity.mLaunchTaskBehind = true;
        mDisplayContent.mUnknownAppVisibilityController.notifyLaunched(activity);
        mDisplayContent.mUnknownAppVisibilityController.notifyRelayouted(activity);

        // Make sure our handler processed the message.
        waitHandlerIdle(mWm.mH);
        assertTrue(mDisplayContent.mUnknownAppVisibilityController.allResolved());
    }

    @Test
    public void testMultiple() {
        final ActivityRecord activity1 = createTestActivityRecord(mDisplayContent);