Change running apps section to use GroupTask instead of AppInfo
- No longer bind All Apps to TaskbarRecentsController, and register RecentsModel.RecentTasksChangedListener instead - The source of truth for "running tasks" in Desktop mode is the DesktopTask#tasks list itself, instead of RecentsModel.RunningTasksListener (which is no longer used) - Added TaskInfo.TaskKey#isVisible to distinguish minimized running apps - Next CL will hook up the UI for Recent/Running tasks that are not part of the Hotseat. Flag: com.android.launcher3.enable_recents_in_taskbar Test: TaskbarRecentAppsControllerTest Fixes: 335398876 Bug: 315354060 Change-Id: I1313f97a791c5c0c1db7443a5d4f1d5bc761981f
This commit is contained in:
@@ -15,9 +15,6 @@
|
||||
*/
|
||||
package com.android.launcher3.taskbar;
|
||||
|
||||
import static com.android.window.flags.Flags.enableDesktopWindowingMode;
|
||||
import static com.android.window.flags.Flags.enableDesktopWindowingTaskbarRunningApps;
|
||||
|
||||
import android.util.SparseArray;
|
||||
import android.view.View;
|
||||
|
||||
@@ -29,7 +26,6 @@ import com.android.launcher3.model.BgDataModel.FixedContainerItems;
|
||||
import com.android.launcher3.model.data.AppInfo;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
import com.android.launcher3.statehandlers.DesktopVisibilityController;
|
||||
import com.android.launcher3.util.ComponentKey;
|
||||
import com.android.launcher3.util.IntArray;
|
||||
import com.android.launcher3.util.IntSet;
|
||||
@@ -37,8 +33,6 @@ import com.android.launcher3.util.ItemInfoMatcher;
|
||||
import com.android.launcher3.util.LauncherBindableItemsContainer;
|
||||
import com.android.launcher3.util.PackageUserKey;
|
||||
import com.android.launcher3.util.Preconditions;
|
||||
import com.android.quickstep.LauncherActivityInterface;
|
||||
import com.android.quickstep.RecentsModel;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
@@ -54,7 +48,7 @@ import java.util.function.Predicate;
|
||||
* Launcher model Callbacks for rendering taskbar.
|
||||
*/
|
||||
public class TaskbarModelCallbacks implements
|
||||
BgDataModel.Callbacks, LauncherBindableItemsContainer, RecentsModel.RunningTasksListener {
|
||||
BgDataModel.Callbacks, LauncherBindableItemsContainer {
|
||||
|
||||
private final SparseArray<ItemInfo> mHotseatItems = new SparseArray<>();
|
||||
private List<ItemInfo> mPredictedItems = Collections.emptyList();
|
||||
@@ -68,8 +62,6 @@ public class TaskbarModelCallbacks implements
|
||||
// Used to defer any UI updates during the SUW unstash animation.
|
||||
private boolean mDeferUpdatesForSUW;
|
||||
private Runnable mDeferredUpdates;
|
||||
private final DesktopVisibilityController.DesktopVisibilityListener mDesktopVisibilityListener =
|
||||
visible -> updateRunningApps();
|
||||
|
||||
public TaskbarModelCallbacks(
|
||||
TaskbarActivityContext context, TaskbarView container) {
|
||||
@@ -79,39 +71,6 @@ public class TaskbarModelCallbacks implements
|
||||
|
||||
public void init(TaskbarControllers controllers) {
|
||||
mControllers = controllers;
|
||||
if (mControllers.taskbarRecentAppsController.getCanShowRunningApps()) {
|
||||
RecentsModel.INSTANCE.get(mContext).registerRunningTasksListener(this);
|
||||
|
||||
if (shouldShowRunningAppsInDesktopMode()) {
|
||||
DesktopVisibilityController desktopVisibilityController =
|
||||
LauncherActivityInterface.INSTANCE.getDesktopVisibilityController();
|
||||
if (desktopVisibilityController != null) {
|
||||
desktopVisibilityController.registerDesktopVisibilityListener(
|
||||
mDesktopVisibilityListener);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters listeners in this class.
|
||||
*/
|
||||
public void unregisterListeners() {
|
||||
RecentsModel.INSTANCE.get(mContext).unregisterRunningTasksListener();
|
||||
|
||||
if (shouldShowRunningAppsInDesktopMode()) {
|
||||
DesktopVisibilityController desktopVisibilityController =
|
||||
LauncherActivityInterface.INSTANCE.getDesktopVisibilityController();
|
||||
if (desktopVisibilityController != null) {
|
||||
desktopVisibilityController.unregisterDesktopVisibilityListener(
|
||||
mDesktopVisibilityListener);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean shouldShowRunningAppsInDesktopMode() {
|
||||
// TODO(b/335401172): unify DesktopMode checks in Launcher
|
||||
return enableDesktopWindowingMode() && enableDesktopWindowingTaskbarRunningApps();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -232,10 +191,12 @@ public class TaskbarModelCallbacks implements
|
||||
predictionNextIndex++;
|
||||
}
|
||||
}
|
||||
hotseatItemInfos = mControllers.taskbarRecentAppsController
|
||||
.updateHotseatItemInfos(hotseatItemInfos);
|
||||
Set<String> runningPackages = mControllers.taskbarRecentAppsController.getRunningApps();
|
||||
Set<String> minimizedPackages = mControllers.taskbarRecentAppsController.getMinimizedApps();
|
||||
|
||||
final TaskbarRecentAppsController recentAppsController =
|
||||
mControllers.taskbarRecentAppsController;
|
||||
hotseatItemInfos = recentAppsController.updateHotseatItemInfos(hotseatItemInfos);
|
||||
Set<String> runningPackages = recentAppsController.getRunningAppPackages();
|
||||
Set<String> minimizedPackages = recentAppsController.getMinimizedAppPackages();
|
||||
|
||||
if (mDeferUpdatesForSUW) {
|
||||
ItemInfo[] finalHotseatItemInfos = hotseatItemInfos;
|
||||
@@ -270,21 +231,11 @@ public class TaskbarModelCallbacks implements
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRunningTasksChanged() {
|
||||
updateRunningApps();
|
||||
}
|
||||
|
||||
/** Called when there's a change in running apps to update the UI. */
|
||||
public void commitRunningAppsToUI() {
|
||||
commitItemsToUI();
|
||||
}
|
||||
|
||||
/** Call TaskbarRecentAppsController to update running apps with mHotseatItems. */
|
||||
public void updateRunningApps() {
|
||||
mControllers.taskbarRecentAppsController.updateRunningApps();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindDeepShortcutMap(HashMap<ComponentKey, Integer> deepShortcutMapCopy) {
|
||||
mControllers.taskbarPopupController.setDeepShortcutMap(deepShortcutMapCopy);
|
||||
@@ -296,7 +247,6 @@ public class TaskbarModelCallbacks implements
|
||||
Map<PackageUserKey, Integer> packageUserKeytoUidMap) {
|
||||
Preconditions.assertUIThread();
|
||||
mControllers.taskbarAllAppsController.setApps(apps, flags, packageUserKeytoUidMap);
|
||||
mControllers.taskbarRecentAppsController.setApps(apps);
|
||||
}
|
||||
|
||||
protected void dumpLogs(String prefix, PrintWriter pw) {
|
||||
|
||||
Reference in New Issue
Block a user