From 2023b359b7586edd871a4969ea49f6b097ebd62a Mon Sep 17 00:00:00 2001 From: Sebastian Franco Date: Wed, 4 Oct 2023 13:18:18 -0700 Subject: [PATCH] Making sure window inset controller is not null In some cases the controller can be null if the view is no longer connected to the window. Also, this issue seems to only happen in cuttlefish instances so there might be a weird behaviour going on there but in any case is good to check for nulls. Test: No testing require is only null checkin, just making sure it compiles. Bug: 302869930 Change-Id: I88d6091b57293e9493385185bfeb3e470c9bad84 --- .../android/launcher3/widget/picker/WidgetsFullSheet.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java b/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java index 2c094f26fb..37ec65cf2d 100644 --- a/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java +++ b/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java @@ -39,6 +39,7 @@ import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.WindowInsets; +import android.view.WindowInsetsController; import android.view.animation.AnimationUtils; import android.view.animation.Interpolator; import android.widget.Button; @@ -818,7 +819,10 @@ public class WidgetsFullSheet extends BaseWidgetSheet @Override public void onDragStart(boolean start, float startDisplacement) { super.onDragStart(start, startDisplacement); - getWindowInsetsController().hide(WindowInsets.Type.ime()); + WindowInsetsController insetsController = getWindowInsetsController(); + if (insetsController != null) { + insetsController.hide(WindowInsets.Type.ime()); + } } @Nullable private View getViewToShowEducationTip() {