From be59dd4f402a703607424693c0de82c9ded736c7 Mon Sep 17 00:00:00 2001 From: Massimo Carli Date: Mon, 21 Aug 2023 14:15:01 +0000 Subject: [PATCH] Fix NPE for user aspect ratio button in multi-window Fix: 296852036 Test: atest WMShellUnitTests:CompatUIControllerTest Change-Id: Ie73d4fc8e6127b53d5f934f277a79c6c5bff46cc --- .../com/android/wm/shell/compatui/CompatUIController.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/CompatUIController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/CompatUIController.java index 54f89846ac853..7bf0893c60c79 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/CompatUIController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/CompatUIController.java @@ -230,8 +230,10 @@ public class CompatUIController implements OnDisplaysChangedListener, // The user aspect ratio button should not be handled when a new TaskInfo is // sent because of a double tap or when in multi-window mode. if (taskInfo.getWindowingMode() != WINDOWING_MODE_FULLSCREEN) { - mUserAspectRatioSettingsLayout.release(); - mUserAspectRatioSettingsLayout = null; + if (mUserAspectRatioSettingsLayout != null) { + mUserAspectRatioSettingsLayout.release(); + mUserAspectRatioSettingsLayout = null; + } return; } if (!taskInfo.isFromLetterboxDoubleTap) {