Don't preemptively release task leashes w/ transitions
- Transitions may still be using the leash Bug: 235858985 Test: atest ShellTaskOrganizerTests Change-Id: Ie0c6d4ffe97ef37fe0a8d6e41ffb02248c0805e1
This commit is contained in:
@@ -23,6 +23,7 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
|
||||
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
|
||||
|
||||
import static com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_TASK_ORG;
|
||||
import static com.android.wm.shell.transition.Transitions.ENABLE_SHELL_TRANSITIONS;
|
||||
|
||||
import android.annotation.IntDef;
|
||||
import android.annotation.NonNull;
|
||||
@@ -541,7 +542,8 @@ public class ShellTaskOrganizer extends TaskOrganizer implements
|
||||
// Notify the recent tasks that a task has been removed
|
||||
mRecentTasks.ifPresent(recentTasks -> recentTasks.onTaskRemoved(taskInfo));
|
||||
|
||||
if (appearedInfo.getLeash() != null) {
|
||||
if (!ENABLE_SHELL_TRANSITIONS && (appearedInfo.getLeash() != null)) {
|
||||
// Preemptively clean up the leash only if shell transitions are not enabled
|
||||
appearedInfo.getLeash().release();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,11 +26,13 @@ import static com.android.dx.mockito.inline.extended.ExtendedMockito.spy;
|
||||
import static com.android.wm.shell.ShellTaskOrganizer.TASK_LISTENER_TYPE_FULLSCREEN;
|
||||
import static com.android.wm.shell.ShellTaskOrganizer.TASK_LISTENER_TYPE_MULTI_WINDOW;
|
||||
import static com.android.wm.shell.ShellTaskOrganizer.TASK_LISTENER_TYPE_PIP;
|
||||
import static com.android.wm.shell.transition.Transitions.ENABLE_SHELL_TRANSITIONS;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.junit.Assume.assumeFalse;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.clearInvocations;
|
||||
import static org.mockito.Mockito.mock;
|
||||
@@ -146,6 +148,7 @@ public class ShellTaskOrganizerTests extends ShellTestCase {
|
||||
|
||||
@Test
|
||||
public void testTaskLeashReleasedAfterVanished() throws RemoteException {
|
||||
assumeFalse(ENABLE_SHELL_TRANSITIONS);
|
||||
RunningTaskInfo taskInfo = createTaskInfo(1, WINDOWING_MODE_MULTI_WINDOW);
|
||||
SurfaceControl taskLeash = new SurfaceControl.Builder(new SurfaceSession())
|
||||
.setName("task").build();
|
||||
|
||||
Reference in New Issue
Block a user