From 52fe8ddf2efa1eec667b2a6726b01d7a03339f12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Ciche=C5=84ski?= Date: Tue, 24 May 2022 18:35:38 +0000 Subject: [PATCH] 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 --- .../Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java index 85052148a5107..1f07873e5779d 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java @@ -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);