Have taskbar all apps extend ActivityAllAppsContainerView.

This step is necessary to have taskbar support search in all apps.
Search is not ready yet, so a fallback search manager is included.

Test: Manual
Bug: 216683257
Change-Id: Id118388bc4baae4b63ef205295caf46cbd541bc8
diff --git a/quickstep/res/layout/taskbar_all_apps.xml b/quickstep/res/layout/taskbar_all_apps.xml
index 7dc0cbe..d402469 100644
--- a/quickstep/res/layout/taskbar_all_apps.xml
+++ b/quickstep/res/layout/taskbar_all_apps.xml
@@ -51,6 +51,12 @@
             <include layout="@layout/all_apps_personal_work_tabs" />
         </com.android.launcher3.allapps.FloatingHeaderView>
 
+        <com.android.launcher3.taskbar.allapps.TaskbarAllAppsFallbackSearchContainer
+            android:id="@+id/search_container_all_apps"
+            android:layout_width="0dp"
+            android:layout_height="0dp"
+            android:visibility="gone" />
+
         <include layout="@layout/all_apps_fast_scroller" />
     </com.android.launcher3.taskbar.allapps.TaskbarAllAppsContainerView>
 </com.android.launcher3.taskbar.allapps.TaskbarAllAppsSlideInView>
diff --git a/quickstep/src/com/android/launcher3/taskbar/BaseTaskbarContext.java b/quickstep/src/com/android/launcher3/taskbar/BaseTaskbarContext.java
index 27e89ba..4e1f54c 100644
--- a/quickstep/src/com/android/launcher3/taskbar/BaseTaskbarContext.java
+++ b/quickstep/src/com/android/launcher3/taskbar/BaseTaskbarContext.java
@@ -23,14 +23,14 @@
 import com.android.launcher3.DeviceProfile.DeviceProfileListenable;
 import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener;
 import com.android.launcher3.util.Themes;
-import com.android.launcher3.views.ActivityContext;
+import com.android.launcher3.views.AppLauncher;
 
 import java.util.ArrayList;
 import java.util.List;
 
 // TODO(b/218912746): Share more behavior to avoid all apps context depending directly on taskbar.
 /** Base for common behavior between taskbar window contexts. */
-public abstract class BaseTaskbarContext extends ContextThemeWrapper implements ActivityContext,
+public abstract class BaseTaskbarContext extends ContextThemeWrapper implements AppLauncher,
         DeviceProfileListenable {
 
     protected final LayoutInflater mLayoutInflater;
diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContainerView.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContainerView.java
index 37cd753..0ea2aa0 100644
--- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContainerView.java
+++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContainerView.java
@@ -17,22 +17,17 @@
 
 import android.content.Context;
 import android.util.AttributeSet;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
 import android.view.WindowInsets;
 
-import androidx.recyclerview.widget.RecyclerView;
-
+import com.android.launcher3.allapps.ActivityAllAppsContainerView;
 import com.android.launcher3.allapps.AllAppsGridAdapter;
 import com.android.launcher3.allapps.AlphabeticalAppsList;
 import com.android.launcher3.allapps.BaseAdapterProvider;
 import com.android.launcher3.allapps.BaseAllAppsAdapter;
-import com.android.launcher3.allapps.BaseAllAppsContainerView;
-import com.android.launcher3.allapps.search.SearchAdapterProvider;
 
 /** All apps container accessible from taskbar. */
-public class TaskbarAllAppsContainerView extends BaseAllAppsContainerView<TaskbarAllAppsContext> {
+public class TaskbarAllAppsContainerView extends
+        ActivityAllAppsContainerView<TaskbarAllAppsContext> {
 
     public TaskbarAllAppsContainerView(Context context, AttributeSet attrs) {
         this(context, attrs, 0);
@@ -43,41 +38,6 @@
     }
 
     @Override
-    protected SearchAdapterProvider<?> createMainAdapterProvider() {
-        // Taskbar all apps does not yet support search, so this implementation is minimal.
-        return new SearchAdapterProvider<TaskbarAllAppsContext>(mActivityContext) {
-            @Override
-            public boolean launchHighlightedItem() {
-                return false;
-            }
-
-            @Override
-            public View getHighlightedItem() {
-                return null;
-            }
-
-            @Override
-            public RecyclerView.ItemDecoration getDecorator() {
-                return null;
-            }
-
-            @Override
-            public boolean isViewSupported(int viewType) {
-                return false;
-            }
-
-            @Override
-            public void onBindView(AllAppsGridAdapter.ViewHolder holder, int position) { }
-
-            @Override
-            public AllAppsGridAdapter.ViewHolder onCreateViewHolder(LayoutInflater layoutInflater,
-                    ViewGroup parent, int viewType) {
-                return null;
-            }
-        };
-    }
-
-    @Override
     public WindowInsets onApplyWindowInsets(WindowInsets insets) {
         setInsets(insets.getInsets(WindowInsets.Type.systemBars()).toRect());
         return super.onApplyWindowInsets(insets);
diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContext.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContext.java
index 22fffdf..50dfff0 100644
--- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContext.java
+++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContext.java
@@ -32,6 +32,9 @@
 import com.android.launcher3.DeviceProfile;
 import com.android.launcher3.R;
 import com.android.launcher3.Utilities;
+import com.android.launcher3.allapps.ActivityAllAppsContainerView;
+import com.android.launcher3.allapps.search.DefaultSearchAdapterProvider;
+import com.android.launcher3.allapps.search.SearchAdapterProvider;
 import com.android.launcher3.dot.DotInfo;
 import com.android.launcher3.model.data.ItemInfo;
 import com.android.launcher3.popup.PopupDataProvider;
@@ -154,6 +157,12 @@
     @Override
     public void onPopupVisibilityChanged(boolean isVisible) {}
 
+    @Override
+    public SearchAdapterProvider<?> createSearchAdapterProvider(
+            ActivityAllAppsContainerView<?> appsView) {
+        return new DefaultSearchAdapterProvider(this);
+    }
+
     /** Root drag layer for this context. */
     private static class TaskbarAllAppsDragLayer extends
             BaseDragLayer<TaskbarAllAppsContext> implements OnComputeInsetsListener {
diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsFallbackSearchContainer.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsFallbackSearchContainer.java
new file mode 100644
index 0000000..53fe06d
--- /dev/null
+++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsFallbackSearchContainer.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.launcher3.taskbar.allapps;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.View;
+
+import androidx.annotation.Nullable;
+
+import com.android.launcher3.ExtendedEditText;
+import com.android.launcher3.allapps.ActivityAllAppsContainerView;
+import com.android.launcher3.allapps.SearchUiManager;
+
+/** Empty search container for Taskbar All Apps used as a fallback if search is not supported. */
+public class TaskbarAllAppsFallbackSearchContainer extends View implements SearchUiManager {
+    public TaskbarAllAppsFallbackSearchContainer(Context context, AttributeSet attrs) {
+        this(context, attrs, 0);
+    }
+
+    public TaskbarAllAppsFallbackSearchContainer(
+            Context context, AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+    }
+
+    @Override
+    public void initializeSearch(ActivityAllAppsContainerView<?> containerView) {
+        // Do nothing.
+    }
+
+    @Override
+    public void resetSearch() {
+        // Do nothing.
+    }
+
+    @Nullable
+    @Override
+    public ExtendedEditText getEditText() {
+        return null;
+    }
+}
diff --git a/src/com/android/launcher3/views/ActivityContext.java b/src/com/android/launcher3/views/ActivityContext.java
index 50c09dd..93078e4 100644
--- a/src/com/android/launcher3/views/ActivityContext.java
+++ b/src/com/android/launcher3/views/ActivityContext.java
@@ -26,7 +26,6 @@
 
 import com.android.launcher3.DeviceProfile;
 import com.android.launcher3.allapps.ActivityAllAppsContainerView;
-import com.android.launcher3.allapps.BaseAllAppsContainerView;
 import com.android.launcher3.allapps.search.SearchAdapterProvider;
 import com.android.launcher3.dot.DotInfo;
 import com.android.launcher3.dragndrop.DragController;
@@ -101,7 +100,7 @@
     /**
      * The all apps container, if it exists in this context.
      */
-    default BaseAllAppsContainerView<?> getAppsView() {
+    default ActivityAllAppsContainerView<?> getAppsView() {
         return null;
     }