diff options
| author | 2023-04-12 04:03:58 +0000 | |
|---|---|---|
| committer | 2023-04-13 16:18:11 +0000 | |
| commit | 896a91b764150e112a5395323f2deb79f81fa67d (patch) | |
| tree | 13e4fc883897e165384bcef80db2a16cb3f8974b | |
| parent | a1e56c40984e332fd4121772c5c875c1141d5244 (diff) | |
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
| -rw-r--r-- | libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java | 11 |
1 files changed, 10 insertions, 1 deletions
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()); |