Skip finishing activities while performing behind fullscreen check
Activities that behind a fullscreen finishing activity were evaluated as invisible. Bug: 144184591 Test: atest ActivityStackTests Change-Id: Id09a30107d189acc986843ea8b3993a66c242a30
This commit is contained in:
@@ -2085,7 +2085,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
|||||||
|
|
||||||
/** Returns true if this activity is opaque and fills the entire space of this task. */
|
/** Returns true if this activity is opaque and fills the entire space of this task. */
|
||||||
boolean occludesParent() {
|
boolean occludesParent() {
|
||||||
return mOccludesParent;
|
return !finishing && mOccludesParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean setOccludesParent(boolean occludesParent) {
|
boolean setOccludesParent(boolean occludesParent) {
|
||||||
|
|||||||
@@ -2343,7 +2343,7 @@ class ActivityStack extends Task {
|
|||||||
// Starting activity cannot be occluding activity, otherwise starting window could be
|
// Starting activity cannot be occluding activity, otherwise starting window could be
|
||||||
// remove immediately without transferring to starting activity.
|
// remove immediately without transferring to starting activity.
|
||||||
final ActivityRecord occludingActivity = getActivity(
|
final ActivityRecord occludingActivity = getActivity(
|
||||||
(ar) -> !ar.finishing && ar.occludesParent(), true, r);
|
(ar) -> ar.occludesParent(), true, r);
|
||||||
if (occludingActivity != null) {
|
if (occludingActivity != null) {
|
||||||
// Here it is! Now, if this is not yet visible (occluded by another task) to the
|
// 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
|
// user, then just add it without starting; it will get started when the user
|
||||||
@@ -3069,9 +3069,8 @@ class ActivityStack extends Task {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// See if there is an occluding activity on-top of this one.
|
// See if there is an occluding activity on-top of this one.
|
||||||
final ActivityRecord occludingActivity = getActivity((ar) ->
|
final ActivityRecord occludingActivity = getActivity((ar) -> ar.occludesParent(), r,
|
||||||
ar.occludesParent() && !ar.finishing,
|
false /*includeBoundary*/, true /*traverseTopToBottom*/);
|
||||||
r, false /*includeBoundary*/, true /*traverseTopToBottom*/);
|
|
||||||
if (occludingActivity != null) return false;
|
if (occludingActivity != null) return false;
|
||||||
|
|
||||||
if (r.finishing) Slog.e(TAG, "willActivityBeVisible: Returning false,"
|
if (r.finishing) Slog.e(TAG, "willActivityBeVisible: Returning false,"
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECOND
|
|||||||
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
|
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
|
||||||
import static android.content.pm.ActivityInfo.FLAG_RESUME_WHILE_PAUSING;
|
import static android.content.pm.ActivityInfo.FLAG_RESUME_WHILE_PAUSING;
|
||||||
|
|
||||||
|
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doCallRealMethod;
|
||||||
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doNothing;
|
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doNothing;
|
||||||
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn;
|
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn;
|
||||||
import static com.android.dx.mockito.inline.extended.ExtendedMockito.mock;
|
import static com.android.dx.mockito.inline.extended.ExtendedMockito.mock;
|
||||||
@@ -56,7 +57,6 @@ import static org.mockito.ArgumentMatchers.any;
|
|||||||
import static org.mockito.ArgumentMatchers.anyBoolean;
|
import static org.mockito.ArgumentMatchers.anyBoolean;
|
||||||
import static org.mockito.ArgumentMatchers.anyString;
|
import static org.mockito.ArgumentMatchers.anyString;
|
||||||
import static org.mockito.ArgumentMatchers.eq;
|
import static org.mockito.ArgumentMatchers.eq;
|
||||||
import static org.mockito.Mockito.mock;
|
|
||||||
|
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
import android.app.IApplicationThread;
|
import android.app.IApplicationThread;
|
||||||
@@ -1156,6 +1156,34 @@ public class ActivityStackTests extends ActivityTestsBase {
|
|||||||
assertThat(result).isEqualTo(taskTop);
|
assertThat(result).isEqualTo(taskTop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCheckBehindFullscreenActivity() {
|
||||||
|
final ActivityRecord bottomActivity =
|
||||||
|
new ActivityBuilder(mService).setStack(mStack).setTask(mTask).build();
|
||||||
|
final ActivityRecord topActivity =
|
||||||
|
new ActivityBuilder(mService).setStack(mStack).setTask(mTask).build();
|
||||||
|
doReturn(true).when(mStack).shouldBeVisible(any());
|
||||||
|
assertTrue(mStack.checkBehindFullscreenActivity(bottomActivity,
|
||||||
|
null /* handleBehindFullscreenActivity */));
|
||||||
|
assertFalse(mStack.checkBehindFullscreenActivity(topActivity,
|
||||||
|
null /* handleBehindFullscreenActivity */));
|
||||||
|
|
||||||
|
doReturn(false).when(topActivity).occludesParent();
|
||||||
|
assertFalse(mStack.checkBehindFullscreenActivity(bottomActivity,
|
||||||
|
null /* handleBehindFullscreenActivity */));
|
||||||
|
assertFalse(mStack.checkBehindFullscreenActivity(topActivity,
|
||||||
|
null /* handleBehindFullscreenActivity */));
|
||||||
|
|
||||||
|
final ActivityRecord finishingActivity =
|
||||||
|
new ActivityBuilder(mService).setStack(mStack).setTask(mTask).build();
|
||||||
|
finishingActivity.finishing = true;
|
||||||
|
doCallRealMethod().when(finishingActivity).occludesParent();
|
||||||
|
assertFalse(mStack.checkBehindFullscreenActivity(bottomActivity,
|
||||||
|
null /* handleBehindFullscreenActivity */));
|
||||||
|
assertFalse(mStack.checkBehindFullscreenActivity(topActivity,
|
||||||
|
null /* handleBehindFullscreenActivity */));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testClearUnknownAppVisibilityBehindFullscreenActivity() {
|
public void testClearUnknownAppVisibilityBehindFullscreenActivity() {
|
||||||
final UnknownAppVisibilityController unknownAppVisibilityController =
|
final UnknownAppVisibilityController unknownAppVisibilityController =
|
||||||
|
|||||||
Reference in New Issue
Block a user