diff --git a/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java b/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
index 240958b..8f5d4dc 100644
--- a/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
+++ b/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
@@ -221,7 +221,7 @@
         WidgetsRecyclerView currentRecyclerView =
                 mAdapters.get(currentActivePage).mWidgetsRecyclerView;
 
-        updateNoWidgetsView(currentAdapterHolder);
+        updateRecyclerViewVisibility(currentAdapterHolder);
         attachScrollbarToRecyclerView(currentRecyclerView);
         resetExpandedHeaders();
     }
@@ -232,22 +232,17 @@
         reset();
     }
 
-    private void updateNoWidgetsView(AdapterHolder adapterHolder) {
+    private void updateRecyclerViewVisibility(AdapterHolder adapterHolder) {
         boolean isWidgetAvailable = adapterHolder.mWidgetsListAdapter.getItemCount() > 0;
         adapterHolder.mWidgetsRecyclerView.setVisibility(isWidgetAvailable ? VISIBLE : GONE);
 
-        // Always resets the text in case this is updated by search.
-        mNoWidgetsView.setText(R.string.no_widgets_available);
+        mNoWidgetsView.setText(
+                adapterHolder.mAdapterType == AdapterHolder.SEARCH
+                        ? R.string.no_search_results
+                        : R.string.no_widgets_available);
         mNoWidgetsView.setVisibility(isWidgetAvailable ? GONE : VISIBLE);
     }
 
-    private void updateNoSearchResultsView(boolean isVisible) {
-        mNoWidgetsView.setVisibility(isVisible ? VISIBLE : GONE);
-        if (isVisible) {
-            mNoWidgetsView.setText(R.string.no_search_results);
-        }
-    }
-
     private void reset() {
         mAdapters.get(AdapterHolder.PRIMARY).mWidgetsRecyclerView.scrollToTop();
         if (mHasWorkProfile) {
@@ -394,16 +389,22 @@
 
     @Override
     public void onWidgetsBound() {
+        if (mIsInSearchMode) {
+            return;
+        }
         List<WidgetsListBaseEntry> allWidgets = mLauncher.getPopupDataProvider().getAllWidgets();
 
         AdapterHolder primaryUserAdapterHolder = mAdapters.get(AdapterHolder.PRIMARY);
         primaryUserAdapterHolder.mWidgetsListAdapter.setWidgets(allWidgets);
-        updateNoWidgetsView(primaryUserAdapterHolder);
 
         if (mHasWorkProfile) {
+            mViewPager.setVisibility(VISIBLE);
+            mTabsView.setVisibility(VISIBLE);
             AdapterHolder workUserAdapterHolder = mAdapters.get(AdapterHolder.WORK);
             workUserAdapterHolder.mWidgetsListAdapter.setWidgets(allWidgets);
             onActivePageChanged(mViewPager.getCurrentPage());
+        } else {
+            updateRecyclerViewVisibility(primaryUserAdapterHolder);
         }
     }
 
@@ -431,8 +432,7 @@
     @Override
     public void onSearchResults(List<WidgetsListBaseEntry> entries) {
         mAdapters.get(AdapterHolder.SEARCH).mWidgetsListAdapter.setWidgetsOnSearch(entries);
-        updateNoSearchResultsView(
-                mAdapters.get(AdapterHolder.SEARCH).mWidgetsListAdapter.getItemCount() == 0);
+        updateRecyclerViewVisibility(mAdapters.get(AdapterHolder.SEARCH));
         mAdapters.get(AdapterHolder.SEARCH).mWidgetsRecyclerView.scrollToTop();
     }
 
@@ -440,19 +440,22 @@
         mIsInSearchMode = isInSearchMode;
         if (isInSearchMode) {
             mSearchAndRecommendationViewHolder.mRecommendedWidgetsTable.setVisibility(GONE);
+            if (mHasWorkProfile) {
+                mViewPager.setVisibility(GONE);
+                mTabsView.setVisibility(GONE);
+            } else {
+                mAdapters.get(AdapterHolder.PRIMARY).mWidgetsRecyclerView.setVisibility(GONE);
+            }
+            updateRecyclerViewVisibility(mAdapters.get(AdapterHolder.SEARCH));
+            // Hide no search results view to prevent it from flashing on enter search.
+            mNoWidgetsView.setVisibility(GONE);
         } else {
+            mAdapters.get(AdapterHolder.SEARCH).mWidgetsRecyclerView.setVisibility(GONE);
+            // Visibility of recommended widgets, recycler views and headers are handled in methods
+            // below.
             onRecommendedWidgetsBound();
+            onWidgetsBound();
         }
-        if (mHasWorkProfile) {
-            mViewPager.setVisibility(isInSearchMode ? GONE : VISIBLE);
-            mTabsView.setVisibility(isInSearchMode ? GONE : VISIBLE);
-        } else {
-            mAdapters.get(AdapterHolder.PRIMARY).mWidgetsRecyclerView
-                    .setVisibility(isInSearchMode ? GONE : VISIBLE);
-        }
-        mAdapters.get(AdapterHolder.SEARCH).mWidgetsRecyclerView
-                .setVisibility(mIsInSearchMode ? VISIBLE : GONE);
-        mNoWidgetsView.setVisibility(GONE);
     }
 
     private void resetExpandedHeaders() {
@@ -462,11 +465,14 @@
 
     @Override
     public void onRecommendedWidgetsBound() {
+        if (mIsInSearchMode) {
+            return;
+        }
         List<WidgetItem> recommendedWidgets =
                 mLauncher.getPopupDataProvider().getRecommendedWidgets();
         WidgetsRecommendationTableLayout table =
                 mSearchAndRecommendationViewHolder.mRecommendedWidgetsTable;
-        if (!mIsInSearchMode && recommendedWidgets.size() > 0) {
+        if (recommendedWidgets.size() > 0) {
             // TODO(b/185508758): Revert the following log after debugging.
             if (getHeaderViewHeight() == 0) {
                 Log.d(TAG, "Header view height is 0 when inflating recommended widgets");
