Merge "Fix search box sometimes not losing focus" into pi-car-dev
diff --git a/car-ui-lib/res/layout-port/car_ui_toolbar.xml b/car-ui-lib/res/layout-port/car_ui_toolbar.xml
index aedecc8..1eb6758 100644
--- a/car-ui-lib/res/layout-port/car_ui_toolbar.xml
+++ b/car-ui-lib/res/layout-port/car_ui_toolbar.xml
@@ -20,6 +20,16 @@
     android:layout_width="match_parent"
     android:layout_height="wrap_content">
 
+    <!-- When the user finishes searching, we call clearFocus() on the editText in the search bar.
+         clearFocus() will actually send the focus to the first focusable thing in the layout.
+         If that focusable thing is still the search bar it will just reselect it, and the user won't
+         be able to deselect. So make a focusable view here to guarantee that we can clear the focus -->
+    <View
+        android:layout_width="1dp"
+        android:layout_height="1dp"
+        android:focusable="true"
+        android:focusableInTouchMode="true"/>
+
     <androidx.constraintlayout.widget.Guideline
         android:id="@+id/row_separator_guideline"
         android:layout_width="0dp"
diff --git a/car-ui-lib/res/layout/car_ui_toolbar.xml b/car-ui-lib/res/layout/car_ui_toolbar.xml
index e3bcb73..8512b6d 100644
--- a/car-ui-lib/res/layout/car_ui_toolbar.xml
+++ b/car-ui-lib/res/layout/car_ui_toolbar.xml
@@ -20,6 +20,16 @@
     android:layout_width="match_parent"
     android:layout_height="@dimen/car_ui_toolbar_first_row_height">
 
+    <!-- When the user finishes searching, we call clearFocus() on the editText in the search bar.
+         clearFocus() will actually send the focus to the first focusable thing in the layout.
+         If that focusable thing is still the search bar it will just reselect it, and the user won't
+         be able to deselect. So make a focusable view here to guarantee that we can clear the focus -->
+    <View
+        android:layout_width="1dp"
+        android:layout_height="1dp"
+        android:focusable="true"
+        android:focusableInTouchMode="true"/>
+
     <FrameLayout
         android:id="@+id/nav_icon_container"
         android:layout_width="@dimen/car_ui_toolbar_nav_button_width"