diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 41037a52b85b3..b9e56f36b5430 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -6116,6 +6116,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ protected boolean fitSystemWindows(Rect insets) { if ((mPrivateFlags3 & PFLAG3_APPLYING_INSETS) == 0) { + if (insets == null) { + // Null insets by definition have already been consumed. + // This call cannot apply insets since there are none to apply, + // so return false. + return false; + } // If we're not in the process of dispatching the newer apply insets call, // that means we're not in the compatibility path. Dispatch into the newer // apply insets path and take things from there.