Validate content overlay before removal

Bug: 234158920
Test: atest --iteration 20 --no-bazel-mode \
        PinnedStackTests#testLaunchTaskByAffinityMatchSingleTask
Change-Id: I1ed848fcd742443a23ecaa17ba6b4fb8cdb061e2
This commit is contained in:
Hongwei Wang
2022-05-30 17:29:55 -07:00
committed by Jinfeng Du
parent d59d17d74a
commit 4c4b7ef959

View File

@@ -1600,6 +1600,11 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
// Avoid double removal, which is fatal.
return;
}
if (surface == null || !surface.isValid()) {
ProtoLog.w(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
"%s: trying to remove invalid content overlay (%s)", TAG, surface);
return;
}
final SurfaceControl.Transaction tx = mSurfaceControlTransactionFactory.getTransaction();
tx.remove(surface);
tx.apply();