Pass the window insets to the view

As per the doc "If an OnApplyWindowInsetsListener is set, its OnApplyWindowInsetsListener#onApplyWindowInsets(View, WindowInsets) method will be called instead of the View's own onApplyWindowInsets method. The listener may optionally call the parameter View's onApplyWindowInsets method to apply the View's normal behavior as part of its own."

Fix: 171351602
Bug: 170343703
Test: Manual
Change-Id: I83e99a55d44a4d433c4a388a75e16271c4ee4201
Merged-In: I83e99a55d44a4d433c4a388a75e16271c4ee4201
diff --git a/car-ui-lib/car-ui-lib/src/main/java/com/android/car/ui/AlertDialogBuilder.java b/car-ui-lib/car-ui-lib/src/main/java/com/android/car/ui/AlertDialogBuilder.java
index 48d86c7..ed508d3 100644
--- a/car-ui-lib/car-ui-lib/src/main/java/com/android/car/ui/AlertDialogBuilder.java
+++ b/car-ui-lib/car-ui-lib/src/main/java/com/android/car/ui/AlertDialogBuilder.java
@@ -83,7 +83,7 @@
     private final View.OnApplyWindowInsetsListener mOnApplyWindowInsetsListener = (v, insets) -> {
         if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
             // WindowInsets.isVisible() is only available on R or above
-            return insets;
+            return v.onApplyWindowInsets(insets);
         }
 
         if (insets.isVisible(ime())) {
@@ -96,7 +96,7 @@
             mInputMethodManager.sendAppPrivateCommand(mCarUiEditText, WIDE_SCREEN_ACTION,
                     bundle);
         }
-        return insets;
+        return v.onApplyWindowInsets(insets);
     };
 
     private final AlertDialog.OnDismissListener mOnDismissListener = dialog -> {
diff --git a/car-ui-lib/car-ui-lib/src/main/java/com/android/car/ui/toolbar/SearchView.java b/car-ui-lib/car-ui-lib/src/main/java/com/android/car/ui/toolbar/SearchView.java
index 55a044d..4bb0362 100644
--- a/car-ui-lib/car-ui-lib/src/main/java/com/android/car/ui/toolbar/SearchView.java
+++ b/car-ui-lib/car-ui-lib/src/main/java/com/android/car/ui/toolbar/SearchView.java
@@ -193,7 +193,7 @@
             if (insets.isVisible(ime())) {
                 displaySearchWideScreen();
             }
-            return insets;
+            return v.onApplyWindowInsets(insets);
         });
     }