From 6749d0ba90525cd91f96cd83f092c26dfeb322bd Mon Sep 17 00:00:00 2001 From: Evan Rosky Date: Mon, 8 May 2023 14:21:08 -0700 Subject: [PATCH] Start tracking unknownvisibility immediately for launchBehind Previously, we only started tracking unknownVisibility in `realStartActivity` which happens after completePause. This is too late since there can be an arbitrary amount of time before we get pause and launchBehind apps lifetime shouldn't be tied to a different task anyways. This CL starts tracking it on start so that the transition system doesn't interpret it as syncFinished before we know if it will be visible or not. Bug: 277759491 Test: Launch home from dream multiple times. Change-Id: Ifabc089e396717565d351139d761bb967c8946ae --- services/core/java/com/android/server/wm/Task.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java index 931c2580fa3f8..b7c29bf071d82 100644 --- a/services/core/java/com/android/server/wm/Task.java +++ b/services/core/java/com/android/server/wm/Task.java @@ -5170,6 +5170,12 @@ class Task extends TaskFragment { // task. r.setVisibility(true); ensureActivitiesVisible(null, 0, !PRESERVE_WINDOWS); + // If launching behind, the app will start regardless of what's above it, so mark it + // as unknown even before prior `pause`. This also prevents a race between set-ready + // and activityPause. Launch-behind is basically only used for dream now. + if (!r.isVisibleRequested()) { + r.notifyUnknownVisibilityLaunchedForKeyguardTransition(); + } // Go ahead to execute app transition for this activity since the app transition // will not be triggered through the resume channel. mDisplayContent.executeAppTransition();