From 896a91b764150e112a5395323f2deb79f81fa67d Mon Sep 17 00:00:00 2001 From: Mateusz Cicheński Date: Wed, 12 Apr 2023 04:03:58 +0000 Subject: Fix NPE when setting icon overlay in PipTaskOrganizer Similarly to check in PipTransition, we need to add similar condition in PipTaskOrganizer which is used when shell transitions are disabled. If the top activity info is missing, we fallback to color overlay. Bug: 277637354 Bug: 272819817 Test: n/a, this is addressing a bug in field, the investigation why this happens will be continued in 272819817, and it simply copies the same condition that was used in PipTransition (as the two codepaths are similar in that sense) in http://ag/21965862 Change-Id: Iab20d3b53026757d1bf3f8714aa750b8cd8c2c40 --- .../Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 d04ce1540980..7f5352e235f2 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 @@ -1678,8 +1678,17 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, // Similar to auto-enter-pip transition, we use content overlay when there is no // source rect hint to enter PiP use bounds animation. 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 = mTaskInfo.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, mTaskInfo.topActivityInfo, mPipBoundsState.getLauncherState().getAppIconSizePx()); -- cgit v1.2.3-59-g8ed1b