diff --git a/services/core/java/com/android/server/wm/ActivityStack.java b/services/core/java/com/android/server/wm/ActivityStack.java index 580425b4e864c..0e391f0291fe4 100644 --- a/services/core/java/com/android/server/wm/ActivityStack.java +++ b/services/core/java/com/android/server/wm/ActivityStack.java @@ -2393,8 +2393,10 @@ class ActivityStack extends Task { } Task task = null; if (!newTask && isOrhasTask) { + // Starting activity cannot be occluding activity, otherwise starting window could be + // remove immediately without transferring to starting activity. final ActivityRecord occludingActivity = getActivity( - (ar) -> !ar.finishing && ar.occludesParent(), true, rTask); + (ar) -> !ar.finishing && ar.occludesParent(), true, r); if (occludingActivity != null) { // Here it is! Now, if this is not yet visible (occluded by another task) to the // user, then just add it without starting; it will get started when the user