From dc02781bef8955585303f5c21a008610fbc9940f Mon Sep 17 00:00:00 2001 From: Hongwei Wang Date: Fri, 10 Mar 2023 15:16:33 -0800 Subject: Work around for NPE with shell transition From the stack trace in the bug, the ActivityInfo for some reason is null when it's passed to PipAppIconOverlay, work around the issue by checking the variable to unblock the tests while we investigating the underlying issue. Bug: 272509531 Test: atest CtsAccessibilityServiceTestCases Change-Id: I1536a2159aee47afe760908de3fb90c5882feff7 --- .../Shell/src/com/android/wm/shell/pip/PipTransition.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransition.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransition.java index 7234b15bf6d2..e01b406eb4c1 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransition.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransition.java @@ -803,8 +803,15 @@ public class PipTransition extends PipTransitionController { if (sourceHintRect == null) { // We use content overlay when there is no source rect hint to enter PiP use bounds // animation. + // TODO(b/272819817): cleanup the null-check and extra logging. + final boolean hasTopActivityInfo = taskInfo.topActivityInfo != null; + if (!hasTopActivityInfo) { + ProtoLog.w(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, + "%s: TaskInfo.topActivityInfo is null", TAG); + } if (SystemProperties.getBoolean( - "persist.wm.debug.enable_pip_app_icon_overlay", true)) { + "persist.wm.debug.enable_pip_app_icon_overlay", true) + && hasTopActivityInfo) { animator.setAppIconContentOverlay( mContext, currentBounds, taskInfo.topActivityInfo); } else { -- cgit v1.2.3-59-g8ed1b