Loading quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +5 −3 Original line number Diff line number Diff line Loading @@ -119,6 +119,7 @@ import com.android.systemui.unfold.updates.RotationChangeProvider; import com.android.systemui.unfold.util.ScopedUnfoldTransitionProgressProvider; import java.io.PrintWriter; import java.util.Collections; import java.util.Optional; /** Loading Loading @@ -997,9 +998,10 @@ public class TaskbarActivityContext extends BaseTaskbarContext { if (recents == null) { return; } recents.getSplitSelectController().findLastActiveTaskAndRunCallback( info.getComponentKey(), foundTask -> { recents.getSplitSelectController().findLastActiveTasksAndRunCallback( Collections.singletonList(info.getComponentKey()), foundTasks -> { @Nullable Task foundTask = foundTasks.get(0); if (foundTask != null) { TaskView foundTaskView = recents.getTaskViewByTaskId(foundTask.key.id); Loading quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java +11 −6 Original line number Diff line number Diff line Loading @@ -40,8 +40,11 @@ import com.android.quickstep.util.GroupTask; import com.android.quickstep.views.RecentsView; import com.android.quickstep.views.TaskView; import com.android.quickstep.views.TaskView.TaskIdAttributeContainer; import com.android.systemui.shared.recents.model.Task; import java.io.PrintWriter; import java.util.Arrays; import java.util.Collections; import java.util.stream.Stream; /** Loading Loading @@ -204,9 +207,10 @@ public class TaskbarUIController { return; } recentsView.getSplitSelectController().findLastActiveTaskAndRunCallback( splitSelectSource.itemInfo.getComponentKey(), foundTask -> { recentsView.getSplitSelectController().findLastActiveTasksAndRunCallback( Collections.singletonList(splitSelectSource.itemInfo.getComponentKey()), foundTasks -> { @Nullable Task foundTask = foundTasks.get(0); splitSelectSource.alreadyRunningTaskId = foundTask == null ? INVALID_TASK_ID : foundTask.key.id; Loading @@ -221,9 +225,10 @@ public class TaskbarUIController { */ public void triggerSecondAppForSplit(ItemInfoWithIcon info, Intent intent, View startingView) { RecentsView recents = getRecentsView(); recents.getSplitSelectController().findLastActiveTaskAndRunCallback( info.getComponentKey(), foundTask -> { recents.getSplitSelectController().findLastActiveTasksAndRunCallback( Collections.singletonList(info.getComponentKey()), foundTasks -> { @Nullable Task foundTask = foundTasks.get(0); if (foundTask != null) { TaskView foundTaskView = recents.getTaskViewByTaskId(foundTask.key.id); // TODO (b/266482558): This additional null check is needed because there Loading quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +13 −3 Original line number Diff line number Diff line Loading @@ -117,6 +117,7 @@ import com.android.launcher3.logging.StatsLogManager.StatsLogger; import com.android.launcher3.model.BgDataModel.FixedContainerItems; import com.android.launcher3.model.WellbeingModel; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.popup.SystemShortcut; import com.android.launcher3.proxy.ProxyActivityStarter; import com.android.launcher3.statehandlers.DepthController; Loading Loading @@ -173,6 +174,7 @@ import com.android.quickstep.views.FloatingTaskView; import com.android.quickstep.views.OverviewActionsView; import com.android.quickstep.views.RecentsView; import com.android.quickstep.views.TaskView; import com.android.systemui.shared.recents.model.Task; import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.unfold.RemoteUnfoldSharedComponent; import com.android.systemui.unfold.UnfoldSharedComponent; Loading Loading @@ -618,9 +620,10 @@ public class QuickstepLauncher extends Launcher { RecentsView recentsView = getOverviewPanel(); // Check if there is already an instance of this app running, if so, initiate the split // using that. mSplitSelectStateController.findLastActiveTaskAndRunCallback( splitSelectSource.itemInfo.getComponentKey(), foundTask -> { mSplitSelectStateController.findLastActiveTasksAndRunCallback( Collections.singletonList(splitSelectSource.itemInfo.getComponentKey()), foundTasks -> { @Nullable Task foundTask = foundTasks.get(0); boolean taskWasFound = foundTask != null; splitSelectSource.alreadyRunningTaskId = taskWasFound ? foundTask.key.id Loading Loading @@ -1326,6 +1329,13 @@ public class QuickstepLauncher extends Launcher { : groupTask.mSplitBounds.leftTaskPercent); } /** * Launches two apps as an app pair. */ public void launchAppPair(WorkspaceItemInfo app1, WorkspaceItemInfo app2) { mSplitSelectStateController.getAppPairsController().launchAppPair(app1, app2); } public boolean canStartHomeSafely() { OverviewCommandHelper overviewCommandHelper = mTISBindHelper.getOverviewCommandHelper(); return overviewCommandHelper == null || overviewCommandHelper.canStartHomeSafely(); Loading quickstep/src/com/android/quickstep/TaskShortcutFactory.java +1 −0 Original line number Diff line number Diff line Loading @@ -140,6 +140,7 @@ public interface TaskShortcutFactory { @Override public void onClick(View view) { dismissTaskMenuView(mTarget); ((RecentsView) mTarget.getOverviewPanel()) .getSplitSelectController().getAppPairsController().saveAppPair(mTaskView); } Loading quickstep/src/com/android/quickstep/util/AppPairsController.java +56 −2 Original line number Diff line number Diff line Loading @@ -17,19 +17,30 @@ package com.android.quickstep.util; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_APP_PAIR_LAUNCH; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import static com.android.launcher3.util.Executors.MODEL_EXECUTOR; import android.app.ActivityTaskManager; import android.content.Context; import android.content.Intent; import androidx.annotation.Nullable; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherSettings; import com.android.launcher3.accessibility.LauncherAccessibilityDelegate; import com.android.launcher3.icons.IconCache; import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.model.data.FolderInfo; import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.util.ComponentKey; import com.android.launcher3.util.SplitConfigurationOptions; import com.android.quickstep.views.TaskView; import com.android.systemui.shared.recents.model.Task; import java.util.Arrays; /** * Mini controller class that handles app pair interactions: saving, modifying, deleting, etc. Loading @@ -52,10 +63,13 @@ public class AppPairsController { private final Context mContext; private final SplitSelectStateController mSplitSelectStateController; private final StatsLogManager mStatsLogManager; public AppPairsController(Context context, SplitSelectStateController splitSelectStateController) { SplitSelectStateController splitSelectStateController, StatsLogManager statsLogManager) { mContext = context; mSplitSelectStateController = splitSelectStateController; mStatsLogManager = statsLogManager; } /** Loading Loading @@ -84,11 +98,51 @@ public class AppPairsController { LauncherAccessibilityDelegate delegate = Launcher.getLauncher(mContext).getAccessibilityDelegate(); if (delegate != null) { MAIN_EXECUTOR.execute(() -> delegate.addToWorkspace(newAppPair, true)); delegate.addToWorkspace(newAppPair, true); mStatsLogManager.logger().withItemInfo(newAppPair) .log(StatsLogManager.LauncherEvent.LAUNCHER_APP_PAIR_SAVE); } }); }); } /** * Launches an app pair by searching the RecentsModel for running instances of each app, and * staging either those running instances or launching the apps as new Intents. */ public void launchAppPair(WorkspaceItemInfo app1, WorkspaceItemInfo app2) { ComponentKey app1Key = new ComponentKey(app1.getTargetComponent(), app1.user); ComponentKey app2Key = new ComponentKey(app2.getTargetComponent(), app2.user); mSplitSelectStateController.findLastActiveTasksAndRunCallback( Arrays.asList(app1Key, app2Key), foundTasks -> { @Nullable Task foundTask1 = foundTasks.get(0); Intent task1Intent; int task1Id; if (foundTask1 != null) { task1Id = foundTask1.key.id; task1Intent = null; } else { task1Id = ActivityTaskManager.INVALID_TASK_ID; task1Intent = app1.intent; } mSplitSelectStateController.setInitialTaskSelect(task1Intent, SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT, app1, LAUNCHER_APP_PAIR_LAUNCH, task1Id); @Nullable Task foundTask2 = foundTasks.get(1); if (foundTask2 != null) { mSplitSelectStateController.setSecondTask(foundTask2); } else { mSplitSelectStateController.setSecondTask( app2.intent, app2.user); } mSplitSelectStateController.launchSplitTasks(); }); } /** Loading Loading
quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +5 −3 Original line number Diff line number Diff line Loading @@ -119,6 +119,7 @@ import com.android.systemui.unfold.updates.RotationChangeProvider; import com.android.systemui.unfold.util.ScopedUnfoldTransitionProgressProvider; import java.io.PrintWriter; import java.util.Collections; import java.util.Optional; /** Loading Loading @@ -997,9 +998,10 @@ public class TaskbarActivityContext extends BaseTaskbarContext { if (recents == null) { return; } recents.getSplitSelectController().findLastActiveTaskAndRunCallback( info.getComponentKey(), foundTask -> { recents.getSplitSelectController().findLastActiveTasksAndRunCallback( Collections.singletonList(info.getComponentKey()), foundTasks -> { @Nullable Task foundTask = foundTasks.get(0); if (foundTask != null) { TaskView foundTaskView = recents.getTaskViewByTaskId(foundTask.key.id); Loading
quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java +11 −6 Original line number Diff line number Diff line Loading @@ -40,8 +40,11 @@ import com.android.quickstep.util.GroupTask; import com.android.quickstep.views.RecentsView; import com.android.quickstep.views.TaskView; import com.android.quickstep.views.TaskView.TaskIdAttributeContainer; import com.android.systemui.shared.recents.model.Task; import java.io.PrintWriter; import java.util.Arrays; import java.util.Collections; import java.util.stream.Stream; /** Loading Loading @@ -204,9 +207,10 @@ public class TaskbarUIController { return; } recentsView.getSplitSelectController().findLastActiveTaskAndRunCallback( splitSelectSource.itemInfo.getComponentKey(), foundTask -> { recentsView.getSplitSelectController().findLastActiveTasksAndRunCallback( Collections.singletonList(splitSelectSource.itemInfo.getComponentKey()), foundTasks -> { @Nullable Task foundTask = foundTasks.get(0); splitSelectSource.alreadyRunningTaskId = foundTask == null ? INVALID_TASK_ID : foundTask.key.id; Loading @@ -221,9 +225,10 @@ public class TaskbarUIController { */ public void triggerSecondAppForSplit(ItemInfoWithIcon info, Intent intent, View startingView) { RecentsView recents = getRecentsView(); recents.getSplitSelectController().findLastActiveTaskAndRunCallback( info.getComponentKey(), foundTask -> { recents.getSplitSelectController().findLastActiveTasksAndRunCallback( Collections.singletonList(info.getComponentKey()), foundTasks -> { @Nullable Task foundTask = foundTasks.get(0); if (foundTask != null) { TaskView foundTaskView = recents.getTaskViewByTaskId(foundTask.key.id); // TODO (b/266482558): This additional null check is needed because there Loading
quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +13 −3 Original line number Diff line number Diff line Loading @@ -117,6 +117,7 @@ import com.android.launcher3.logging.StatsLogManager.StatsLogger; import com.android.launcher3.model.BgDataModel.FixedContainerItems; import com.android.launcher3.model.WellbeingModel; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.popup.SystemShortcut; import com.android.launcher3.proxy.ProxyActivityStarter; import com.android.launcher3.statehandlers.DepthController; Loading Loading @@ -173,6 +174,7 @@ import com.android.quickstep.views.FloatingTaskView; import com.android.quickstep.views.OverviewActionsView; import com.android.quickstep.views.RecentsView; import com.android.quickstep.views.TaskView; import com.android.systemui.shared.recents.model.Task; import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.unfold.RemoteUnfoldSharedComponent; import com.android.systemui.unfold.UnfoldSharedComponent; Loading Loading @@ -618,9 +620,10 @@ public class QuickstepLauncher extends Launcher { RecentsView recentsView = getOverviewPanel(); // Check if there is already an instance of this app running, if so, initiate the split // using that. mSplitSelectStateController.findLastActiveTaskAndRunCallback( splitSelectSource.itemInfo.getComponentKey(), foundTask -> { mSplitSelectStateController.findLastActiveTasksAndRunCallback( Collections.singletonList(splitSelectSource.itemInfo.getComponentKey()), foundTasks -> { @Nullable Task foundTask = foundTasks.get(0); boolean taskWasFound = foundTask != null; splitSelectSource.alreadyRunningTaskId = taskWasFound ? foundTask.key.id Loading Loading @@ -1326,6 +1329,13 @@ public class QuickstepLauncher extends Launcher { : groupTask.mSplitBounds.leftTaskPercent); } /** * Launches two apps as an app pair. */ public void launchAppPair(WorkspaceItemInfo app1, WorkspaceItemInfo app2) { mSplitSelectStateController.getAppPairsController().launchAppPair(app1, app2); } public boolean canStartHomeSafely() { OverviewCommandHelper overviewCommandHelper = mTISBindHelper.getOverviewCommandHelper(); return overviewCommandHelper == null || overviewCommandHelper.canStartHomeSafely(); Loading
quickstep/src/com/android/quickstep/TaskShortcutFactory.java +1 −0 Original line number Diff line number Diff line Loading @@ -140,6 +140,7 @@ public interface TaskShortcutFactory { @Override public void onClick(View view) { dismissTaskMenuView(mTarget); ((RecentsView) mTarget.getOverviewPanel()) .getSplitSelectController().getAppPairsController().saveAppPair(mTaskView); } Loading
quickstep/src/com/android/quickstep/util/AppPairsController.java +56 −2 Original line number Diff line number Diff line Loading @@ -17,19 +17,30 @@ package com.android.quickstep.util; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_APP_PAIR_LAUNCH; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import static com.android.launcher3.util.Executors.MODEL_EXECUTOR; import android.app.ActivityTaskManager; import android.content.Context; import android.content.Intent; import androidx.annotation.Nullable; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherSettings; import com.android.launcher3.accessibility.LauncherAccessibilityDelegate; import com.android.launcher3.icons.IconCache; import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.model.data.FolderInfo; import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.util.ComponentKey; import com.android.launcher3.util.SplitConfigurationOptions; import com.android.quickstep.views.TaskView; import com.android.systemui.shared.recents.model.Task; import java.util.Arrays; /** * Mini controller class that handles app pair interactions: saving, modifying, deleting, etc. Loading @@ -52,10 +63,13 @@ public class AppPairsController { private final Context mContext; private final SplitSelectStateController mSplitSelectStateController; private final StatsLogManager mStatsLogManager; public AppPairsController(Context context, SplitSelectStateController splitSelectStateController) { SplitSelectStateController splitSelectStateController, StatsLogManager statsLogManager) { mContext = context; mSplitSelectStateController = splitSelectStateController; mStatsLogManager = statsLogManager; } /** Loading Loading @@ -84,11 +98,51 @@ public class AppPairsController { LauncherAccessibilityDelegate delegate = Launcher.getLauncher(mContext).getAccessibilityDelegate(); if (delegate != null) { MAIN_EXECUTOR.execute(() -> delegate.addToWorkspace(newAppPair, true)); delegate.addToWorkspace(newAppPair, true); mStatsLogManager.logger().withItemInfo(newAppPair) .log(StatsLogManager.LauncherEvent.LAUNCHER_APP_PAIR_SAVE); } }); }); } /** * Launches an app pair by searching the RecentsModel for running instances of each app, and * staging either those running instances or launching the apps as new Intents. */ public void launchAppPair(WorkspaceItemInfo app1, WorkspaceItemInfo app2) { ComponentKey app1Key = new ComponentKey(app1.getTargetComponent(), app1.user); ComponentKey app2Key = new ComponentKey(app2.getTargetComponent(), app2.user); mSplitSelectStateController.findLastActiveTasksAndRunCallback( Arrays.asList(app1Key, app2Key), foundTasks -> { @Nullable Task foundTask1 = foundTasks.get(0); Intent task1Intent; int task1Id; if (foundTask1 != null) { task1Id = foundTask1.key.id; task1Intent = null; } else { task1Id = ActivityTaskManager.INVALID_TASK_ID; task1Intent = app1.intent; } mSplitSelectStateController.setInitialTaskSelect(task1Intent, SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT, app1, LAUNCHER_APP_PAIR_LAUNCH, task1Id); @Nullable Task foundTask2 = foundTasks.get(1); if (foundTask2 != null) { mSplitSelectStateController.setSecondTask(foundTask2); } else { mSplitSelectStateController.setSecondTask( app2.intent, app2.user); } mSplitSelectStateController.launchSplitTasks(); }); } /** Loading