Loading quickstep/src/com/android/launcher3/taskbar/FallbackTaskbarUIController.java +26 −10 Original line number Original line Diff line number Diff line Loading @@ -21,12 +21,15 @@ import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_IN_STASH import android.animation.Animator; import android.animation.Animator; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.popup.SystemShortcut; import com.android.launcher3.statemanager.StateManager; import com.android.launcher3.statemanager.StateManager; import com.android.quickstep.RecentsActivity; import com.android.quickstep.RecentsActivity; import com.android.quickstep.TopTaskTracker; import com.android.quickstep.fallback.RecentsState; import com.android.quickstep.fallback.RecentsState; import com.android.quickstep.views.RecentsView; import com.android.quickstep.views.RecentsView; import java.util.stream.Stream; /** /** * A data source which integrates with the fallback RecentsActivity instance (for 3P launchers). * A data source which integrates with the fallback RecentsActivity instance (for 3P launchers). */ */ Loading Loading @@ -81,18 +84,15 @@ public class FallbackTaskbarUIController extends TaskbarUIController { * Currently this animation just force stashes the taskbar in Overview. * Currently this animation just force stashes the taskbar in Overview. */ */ public Animator createAnimToRecentsState(RecentsState toState, long duration) { public Animator createAnimToRecentsState(RecentsState toState, long duration) { // Force stash the taskbar in overview modal state or when going home. We do not force // Force stash taskbar (disallow unstashing) when: // stash on home when running in a test as 3p launchers rely on taskbar instead of hotseat. // - in a 3P launcher or overview task. boolean isGoingHome = toState == RecentsState.HOME && !isRunningInTestHarness(); // - not running in a test harness (unstash is needed for tests) boolean useStashedLauncherState = toState.hasOverviewActions() || isGoingHome; boolean forceStash = isIn3pHomeOrRecents() && !isRunningInTestHarness(); boolean stashedLauncherState = useStashedLauncherState && ( (FeatureFlags.ENABLE_GRID_ONLY_OVERVIEW.get() && toState == RecentsState.MODAL_TASK) || isGoingHome); TaskbarStashController stashController = mControllers.taskbarStashController; TaskbarStashController stashController = mControllers.taskbarStashController; // Set both FLAG_IN_STASHED_LAUNCHER_STATE and FLAG_IN_APP to ensure the state is respected. // Set both FLAG_IN_STASHED_LAUNCHER_STATE and FLAG_IN_APP to ensure the state is respected. // For all other states, just use the current stashed-in-app setting (e.g. if long clicked). // For all other states, just use the current stashed-in-app setting (e.g. if long clicked). stashController.updateStateForFlag(FLAG_IN_STASHED_LAUNCHER_STATE, stashedLauncherState); stashController.updateStateForFlag(FLAG_IN_STASHED_LAUNCHER_STATE, forceStash); stashController.updateStateForFlag(FLAG_IN_APP, !useStashedLauncherState); stashController.updateStateForFlag(FLAG_IN_APP, !forceStash); return stashController.createApplyStateAnimator(duration); return stashController.createApplyStateAnimator(duration); } } Loading @@ -108,4 +108,20 @@ public class FallbackTaskbarUIController extends TaskbarUIController { public RecentsView getRecentsView() { public RecentsView getRecentsView() { return mRecentsActivity.getOverviewPanel(); return mRecentsActivity.getOverviewPanel(); } } @Override Stream<SystemShortcut.Factory<BaseTaskbarContext>> getSplitMenuOptions() { if (isIn3pHomeOrRecents()) { // Split from Taskbar is not supported in fallback launcher, so return empty stream return Stream.empty(); } else { return super.getSplitMenuOptions(); } } private boolean isIn3pHomeOrRecents() { TopTaskTracker.CachedTaskInfo topTask = TopTaskTracker.INSTANCE .get(mControllers.taskbarActivityContext).getCachedTopTask(true); return topTask.isHomeTask() || topTask.isRecentsTask(); } } } quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +4 −0 Original line number Original line Diff line number Diff line Loading @@ -1145,6 +1145,10 @@ public class TaskbarActivityContext extends BaseTaskbarContext { return mControllers.taskbarStashController.isInApp(); return mControllers.taskbarStashController.isInApp(); } } public boolean isInStashedLauncherState() { return mControllers.taskbarStashController.isInStashedLauncherState(); } protected void dumpLogs(String prefix, PrintWriter pw) { protected void dumpLogs(String prefix, PrintWriter pw) { pw.println(prefix + "TaskbarActivityContext:"); pw.println(prefix + "TaskbarActivityContext:"); Loading quickstep/src/com/android/launcher3/taskbar/TaskbarPopupController.java +2 −5 Original line number Original line Diff line number Diff line Loading @@ -32,7 +32,6 @@ import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.BubbleTextView; import com.android.launcher3.BubbleTextView; import com.android.launcher3.LauncherSettings; import com.android.launcher3.LauncherSettings; import com.android.launcher3.R; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.dot.FolderDotInfo; import com.android.launcher3.dot.FolderDotInfo; import com.android.launcher3.folder.Folder; import com.android.launcher3.folder.Folder; import com.android.launcher3.folder.FolderIcon; import com.android.launcher3.folder.FolderIcon; Loading Loading @@ -205,9 +204,7 @@ public class TaskbarPopupController implements TaskbarControllers.LoggableTaskba // append split options to APP_INFO shortcut, the order here will reflect in the popup // append split options to APP_INFO shortcut, the order here will reflect in the popup return Stream.concat( return Stream.concat( Stream.of(APP_INFO), Stream.of(APP_INFO), Utilities.getSplitPositionOptions(mContext.getDeviceProfile()) mControllers.uiController.getSplitMenuOptions() .stream() .map(this::createSplitShortcutFactory) ); ); } } Loading Loading @@ -265,7 +262,7 @@ public class TaskbarPopupController implements TaskbarControllers.LoggableTaskba * right. * right. * @return A factory function to be used in populating the long-press menu. * @return A factory function to be used in populating the long-press menu. */ */ private SystemShortcut.Factory<BaseTaskbarContext> createSplitShortcutFactory( SystemShortcut.Factory<BaseTaskbarContext> createSplitShortcutFactory( SplitPositionOption position) { SplitPositionOption position) { return (context, itemInfo, originalView) -> new TaskbarSplitShortcut(context, itemInfo, return (context, itemInfo, originalView) -> new TaskbarSplitShortcut(context, itemInfo, originalView, position, mAllowInitialSplitSelection); originalView, position, mAllowInitialSplitSelection); Loading quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java +13 −0 Original line number Original line Diff line number Diff line Loading @@ -30,8 +30,10 @@ import androidx.annotation.CallSuper; import androidx.annotation.NonNull; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.Nullable; import com.android.launcher3.Utilities; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.model.data.ItemInfoWithIcon; import com.android.launcher3.model.data.ItemInfoWithIcon; import com.android.launcher3.popup.SystemShortcut; import com.android.launcher3.util.ComponentKey; import com.android.launcher3.util.ComponentKey; import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.SplitConfigurationOptions; import com.android.launcher3.util.SplitConfigurationOptions; Loading @@ -41,6 +43,7 @@ import com.android.quickstep.views.TaskView; import com.android.quickstep.views.TaskView.TaskIdAttributeContainer; import com.android.quickstep.views.TaskView.TaskIdAttributeContainer; import java.io.PrintWriter; import java.io.PrintWriter; import java.util.stream.Stream; /** /** * Base class for providing different taskbar UI * Base class for providing different taskbar UI Loading Loading @@ -323,4 +326,14 @@ public class TaskbarUIController { * Refreshes the resumed state of this ui controller. * Refreshes the resumed state of this ui controller. */ */ public void refreshResumedState() {} public void refreshResumedState() {} /** * Returns a stream of split screen menu options appropriate to the device. */ Stream<SystemShortcut.Factory<BaseTaskbarContext>> getSplitMenuOptions() { return Utilities .getSplitPositionOptions(mControllers.taskbarActivityContext.getDeviceProfile()) .stream() .map(mControllers.taskbarPopupController::createSplitShortcutFactory); } } } quickstep/src/com/android/quickstep/TopTaskTracker.java +6 −0 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.quickstep; import static android.app.ActivityTaskManager.INVALID_TASK_ID; import static android.app.ActivityTaskManager.INVALID_TASK_ID; import static android.app.WindowConfiguration.ACTIVITY_TYPE_ASSISTANT; import static android.app.WindowConfiguration.ACTIVITY_TYPE_ASSISTANT; import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME; import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME; import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS; import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; import static android.content.Intent.ACTION_CHOOSER; import static android.content.Intent.ACTION_CHOOSER; import static android.content.Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS; import static android.content.Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS; Loading Loading @@ -244,6 +245,11 @@ public class TopTaskTracker extends ISplitScreenListener.Stub implements TaskSta .getActivityType() == ACTIVITY_TYPE_HOME; .getActivityType() == ACTIVITY_TYPE_HOME; } } public boolean isRecentsTask() { return mTopTask != null && mTopTask.configuration.windowConfiguration .getActivityType() == ACTIVITY_TYPE_RECENTS; } /** /** * Returns {@code true} if this task windowing mode is set to {@link * Returns {@code true} if this task windowing mode is set to {@link * android.app.WindowConfiguration#WINDOWING_MODE_FREEFORM} * android.app.WindowConfiguration#WINDOWING_MODE_FREEFORM} Loading Loading
quickstep/src/com/android/launcher3/taskbar/FallbackTaskbarUIController.java +26 −10 Original line number Original line Diff line number Diff line Loading @@ -21,12 +21,15 @@ import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_IN_STASH import android.animation.Animator; import android.animation.Animator; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.popup.SystemShortcut; import com.android.launcher3.statemanager.StateManager; import com.android.launcher3.statemanager.StateManager; import com.android.quickstep.RecentsActivity; import com.android.quickstep.RecentsActivity; import com.android.quickstep.TopTaskTracker; import com.android.quickstep.fallback.RecentsState; import com.android.quickstep.fallback.RecentsState; import com.android.quickstep.views.RecentsView; import com.android.quickstep.views.RecentsView; import java.util.stream.Stream; /** /** * A data source which integrates with the fallback RecentsActivity instance (for 3P launchers). * A data source which integrates with the fallback RecentsActivity instance (for 3P launchers). */ */ Loading Loading @@ -81,18 +84,15 @@ public class FallbackTaskbarUIController extends TaskbarUIController { * Currently this animation just force stashes the taskbar in Overview. * Currently this animation just force stashes the taskbar in Overview. */ */ public Animator createAnimToRecentsState(RecentsState toState, long duration) { public Animator createAnimToRecentsState(RecentsState toState, long duration) { // Force stash the taskbar in overview modal state or when going home. We do not force // Force stash taskbar (disallow unstashing) when: // stash on home when running in a test as 3p launchers rely on taskbar instead of hotseat. // - in a 3P launcher or overview task. boolean isGoingHome = toState == RecentsState.HOME && !isRunningInTestHarness(); // - not running in a test harness (unstash is needed for tests) boolean useStashedLauncherState = toState.hasOverviewActions() || isGoingHome; boolean forceStash = isIn3pHomeOrRecents() && !isRunningInTestHarness(); boolean stashedLauncherState = useStashedLauncherState && ( (FeatureFlags.ENABLE_GRID_ONLY_OVERVIEW.get() && toState == RecentsState.MODAL_TASK) || isGoingHome); TaskbarStashController stashController = mControllers.taskbarStashController; TaskbarStashController stashController = mControllers.taskbarStashController; // Set both FLAG_IN_STASHED_LAUNCHER_STATE and FLAG_IN_APP to ensure the state is respected. // Set both FLAG_IN_STASHED_LAUNCHER_STATE and FLAG_IN_APP to ensure the state is respected. // For all other states, just use the current stashed-in-app setting (e.g. if long clicked). // For all other states, just use the current stashed-in-app setting (e.g. if long clicked). stashController.updateStateForFlag(FLAG_IN_STASHED_LAUNCHER_STATE, stashedLauncherState); stashController.updateStateForFlag(FLAG_IN_STASHED_LAUNCHER_STATE, forceStash); stashController.updateStateForFlag(FLAG_IN_APP, !useStashedLauncherState); stashController.updateStateForFlag(FLAG_IN_APP, !forceStash); return stashController.createApplyStateAnimator(duration); return stashController.createApplyStateAnimator(duration); } } Loading @@ -108,4 +108,20 @@ public class FallbackTaskbarUIController extends TaskbarUIController { public RecentsView getRecentsView() { public RecentsView getRecentsView() { return mRecentsActivity.getOverviewPanel(); return mRecentsActivity.getOverviewPanel(); } } @Override Stream<SystemShortcut.Factory<BaseTaskbarContext>> getSplitMenuOptions() { if (isIn3pHomeOrRecents()) { // Split from Taskbar is not supported in fallback launcher, so return empty stream return Stream.empty(); } else { return super.getSplitMenuOptions(); } } private boolean isIn3pHomeOrRecents() { TopTaskTracker.CachedTaskInfo topTask = TopTaskTracker.INSTANCE .get(mControllers.taskbarActivityContext).getCachedTopTask(true); return topTask.isHomeTask() || topTask.isRecentsTask(); } } }
quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +4 −0 Original line number Original line Diff line number Diff line Loading @@ -1145,6 +1145,10 @@ public class TaskbarActivityContext extends BaseTaskbarContext { return mControllers.taskbarStashController.isInApp(); return mControllers.taskbarStashController.isInApp(); } } public boolean isInStashedLauncherState() { return mControllers.taskbarStashController.isInStashedLauncherState(); } protected void dumpLogs(String prefix, PrintWriter pw) { protected void dumpLogs(String prefix, PrintWriter pw) { pw.println(prefix + "TaskbarActivityContext:"); pw.println(prefix + "TaskbarActivityContext:"); Loading
quickstep/src/com/android/launcher3/taskbar/TaskbarPopupController.java +2 −5 Original line number Original line Diff line number Diff line Loading @@ -32,7 +32,6 @@ import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.BubbleTextView; import com.android.launcher3.BubbleTextView; import com.android.launcher3.LauncherSettings; import com.android.launcher3.LauncherSettings; import com.android.launcher3.R; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.dot.FolderDotInfo; import com.android.launcher3.dot.FolderDotInfo; import com.android.launcher3.folder.Folder; import com.android.launcher3.folder.Folder; import com.android.launcher3.folder.FolderIcon; import com.android.launcher3.folder.FolderIcon; Loading Loading @@ -205,9 +204,7 @@ public class TaskbarPopupController implements TaskbarControllers.LoggableTaskba // append split options to APP_INFO shortcut, the order here will reflect in the popup // append split options to APP_INFO shortcut, the order here will reflect in the popup return Stream.concat( return Stream.concat( Stream.of(APP_INFO), Stream.of(APP_INFO), Utilities.getSplitPositionOptions(mContext.getDeviceProfile()) mControllers.uiController.getSplitMenuOptions() .stream() .map(this::createSplitShortcutFactory) ); ); } } Loading Loading @@ -265,7 +262,7 @@ public class TaskbarPopupController implements TaskbarControllers.LoggableTaskba * right. * right. * @return A factory function to be used in populating the long-press menu. * @return A factory function to be used in populating the long-press menu. */ */ private SystemShortcut.Factory<BaseTaskbarContext> createSplitShortcutFactory( SystemShortcut.Factory<BaseTaskbarContext> createSplitShortcutFactory( SplitPositionOption position) { SplitPositionOption position) { return (context, itemInfo, originalView) -> new TaskbarSplitShortcut(context, itemInfo, return (context, itemInfo, originalView) -> new TaskbarSplitShortcut(context, itemInfo, originalView, position, mAllowInitialSplitSelection); originalView, position, mAllowInitialSplitSelection); Loading
quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java +13 −0 Original line number Original line Diff line number Diff line Loading @@ -30,8 +30,10 @@ import androidx.annotation.CallSuper; import androidx.annotation.NonNull; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.Nullable; import com.android.launcher3.Utilities; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.model.data.ItemInfoWithIcon; import com.android.launcher3.model.data.ItemInfoWithIcon; import com.android.launcher3.popup.SystemShortcut; import com.android.launcher3.util.ComponentKey; import com.android.launcher3.util.ComponentKey; import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.SplitConfigurationOptions; import com.android.launcher3.util.SplitConfigurationOptions; Loading @@ -41,6 +43,7 @@ import com.android.quickstep.views.TaskView; import com.android.quickstep.views.TaskView.TaskIdAttributeContainer; import com.android.quickstep.views.TaskView.TaskIdAttributeContainer; import java.io.PrintWriter; import java.io.PrintWriter; import java.util.stream.Stream; /** /** * Base class for providing different taskbar UI * Base class for providing different taskbar UI Loading Loading @@ -323,4 +326,14 @@ public class TaskbarUIController { * Refreshes the resumed state of this ui controller. * Refreshes the resumed state of this ui controller. */ */ public void refreshResumedState() {} public void refreshResumedState() {} /** * Returns a stream of split screen menu options appropriate to the device. */ Stream<SystemShortcut.Factory<BaseTaskbarContext>> getSplitMenuOptions() { return Utilities .getSplitPositionOptions(mControllers.taskbarActivityContext.getDeviceProfile()) .stream() .map(mControllers.taskbarPopupController::createSplitShortcutFactory); } } }
quickstep/src/com/android/quickstep/TopTaskTracker.java +6 −0 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.quickstep; import static android.app.ActivityTaskManager.INVALID_TASK_ID; import static android.app.ActivityTaskManager.INVALID_TASK_ID; import static android.app.WindowConfiguration.ACTIVITY_TYPE_ASSISTANT; import static android.app.WindowConfiguration.ACTIVITY_TYPE_ASSISTANT; import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME; import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME; import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS; import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; import static android.content.Intent.ACTION_CHOOSER; import static android.content.Intent.ACTION_CHOOSER; import static android.content.Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS; import static android.content.Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS; Loading Loading @@ -244,6 +245,11 @@ public class TopTaskTracker extends ISplitScreenListener.Stub implements TaskSta .getActivityType() == ACTIVITY_TYPE_HOME; .getActivityType() == ACTIVITY_TYPE_HOME; } } public boolean isRecentsTask() { return mTopTask != null && mTopTask.configuration.windowConfiguration .getActivityType() == ACTIVITY_TYPE_RECENTS; } /** /** * Returns {@code true} if this task windowing mode is set to {@link * Returns {@code true} if this task windowing mode is set to {@link * android.app.WindowConfiguration#WINDOWING_MODE_FREEFORM} * android.app.WindowConfiguration#WINDOWING_MODE_FREEFORM} Loading