Initial setup for widgets in Search
LiveSearchManager creates AppWidgetHost when user starts a new search session and destroys it when user returns to home. In addition, it also manages the creation and caching of PlaceholderSearchWidget which can be used to create AppWidgetHostViews.
Bug: 168321831
Test: Manual
Change-Id: I06a893028e55aa6e0702a4f1cd7a2edbb1f61671
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 699734c..38ebe14 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -111,6 +111,7 @@
import com.android.launcher3.allapps.AllAppsStore;
import com.android.launcher3.allapps.AllAppsTransitionController;
import com.android.launcher3.allapps.DiscoveryBounce;
+import com.android.launcher3.allapps.search.LiveSearchManager;
import com.android.launcher3.anim.PropertyListBuilder;
import com.android.launcher3.compat.AccessibilityManagerCompat;
import com.android.launcher3.config.FeatureFlags;
@@ -276,6 +277,8 @@
private LifecycleRegistry mLifecycleRegistry;
+ private LiveSearchManager mLiveSearchManager;
+
@Thunk
Workspace mWorkspace;
@Thunk
@@ -389,6 +392,8 @@
mIconCache = app.getIconCache();
mAccessibilityDelegate = new LauncherAccessibilityDelegate(this);
+ mLiveSearchManager = new LiveSearchManager(this);
+
mDragController = new DragController(this);
mAllAppsController = new AllAppsTransitionController(this);
mStateManager = new StateManager<>(this, NORMAL);
@@ -492,6 +497,10 @@
return mLifecycleRegistry;
}
+ public LiveSearchManager getLiveSearchManager() {
+ return mLiveSearchManager;
+ }
+
protected LauncherOverlayManager getDefaultOverlay() {
return new LauncherOverlayManager() { };
}
@@ -1583,6 +1592,7 @@
mAppTransitionManager.unregisterRemoteAnimations();
mUserChangedCallbackCloseable.close();
mLifecycleRegistry.setCurrentState(Lifecycle.State.DESTROYED);
+ mLiveSearchManager.stop();
}
public LauncherAccessibilityDelegate getAccessibilityDelegate() {