From de164ba73b704cff4716d8b185508143fe89a8f4 Mon Sep 17 00:00:00 2001 From: Perry Wu Date: Wed, 4 Dec 2024 16:24:47 +0000 Subject: [PIP2] Fix NPE for onSwipePipToHomeAnimation Fixes an NPE with the recentsAnimationListener when swiping to home. Bug: 380544965 Flag: EXEMPT bugfix Test: N/A Change-Id: I378603e6aeae58559d1344e83c9f8e573e144dad --- .../Shell/src/com/android/wm/shell/pip2/phone/PipController.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipController.java index 19428ee39919..e309da10864d 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipController.java @@ -99,7 +99,7 @@ public class PipController implements ConfigurationChangeListener, private final List> mOnIsInPipStateChangedListeners = new ArrayList<>(); // Wrapper for making Binder calls into PiP animation listener hosted in launcher's Recents. - private PipAnimationListener mPipRecentsAnimationListener; + @Nullable private PipAnimationListener mPipRecentsAnimationListener; @VisibleForTesting interface PipAnimationListener { @@ -378,7 +378,9 @@ public class PipController implements ConfigurationChangeListener, tx.setLayer(overlay, Integer.MAX_VALUE); tx.apply(); } - mPipRecentsAnimationListener.onPipAnimationStarted(); + if (mPipRecentsAnimationListener != null) { + mPipRecentsAnimationListener.onPipAnimationStarted(); + } } private void setLauncherKeepClearAreaHeight(boolean visible, int height) { -- cgit v1.2.3-59-g8ed1b