Check for null mLeash before setting alpha.

There were few reports in the bug for this to not always be set.
Based on the stack trace it is related to Keyguard showing/hiding,
but I was unable to repro locally the issue.

Adding a safety check to prevent this from occuring with proto log if it happens.

Bug: 233129957
Test: n/a, unable to repro, fix based on the stack trace
Change-Id: Ie45e557601fe52da6003790446b18aad2db681e5
This commit is contained in:
Mateusz Cicheński
2022-05-24 18:35:38 +00:00
parent d62d63b26a
commit 52fe8ddf2e

View File

@@ -970,6 +970,11 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
if (!isInPip()) {
return;
}
if (mLeash == null || !mLeash.isValid()) {
ProtoLog.w(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
"%s: Invalid leash on setPipVisibility: %s", TAG, mLeash);
return;
}
final SurfaceControl.Transaction tx =
mSurfaceControlTransactionFactory.getTransaction();
mSurfaceTransactionHelper.alpha(tx, mLeash, visible ? 1f : 0f);