Loading quickstep/src/com/android/quickstep/TaskShortcutFactory.java +31 −31 Original line number Diff line number Diff line Loading @@ -218,7 +218,8 @@ public interface TaskShortcutFactory { new AppTransitionAnimationSpecsFuture(mHandler) { @Override public List<AppTransitionAnimationSpecCompat> composeSpecs() { return Collections.singletonList(new AppTransitionAnimationSpecCompat( return Collections.singletonList( new AppTransitionAnimationSpecCompat( taskId, thumbnail, taskBounds)); } }; Loading Loading @@ -264,13 +265,12 @@ public interface TaskShortcutFactory { /** * Does NOT add split options in the following scenarios: * * The taskView to add split options is already showing split screen tasks * * There aren't at least 2 tasks in overview to show split options for * * Split isn't supported by the task itself (non resizable activity) * * We aren't currently in multi-window * * The taskView to show split options for is the focused task AND we haven't started * scrolling in overview (if we haven't scrolled, there's a split overview action button so * we don't need this menu option) * * 1. Taskbar is not present AND aren't at least 2 tasks in overview to show split options for * * 2. Split isn't supported by the task itself (non resizable activity) * * 3. We aren't currently in multi-window * * 4. The taskView to show split options for is the focused task AND we haven't started * * scrolling in overview (if we haven't scrolled, there's a split overview action button so * * we don't need this menu option) */ TaskShortcutFactory SPLIT_SELECT = new TaskShortcutFactory() { @Override Loading @@ -284,18 +284,16 @@ public interface TaskShortcutFactory { final PagedOrientationHandler orientationHandler = recentsView.getPagedOrientationHandler(); boolean notEnoughTasksToSplit = recentsView.getTaskViewCount() < 2; boolean isFocusedTask = deviceProfile.isTablet && taskView.isFocusedTask(); boolean isTaskInExpectedScrollPosition = recentsView.isTaskInExpectedScrollPosition(recentsView.indexOfChild(taskView)); boolean notEnoughTasksToSplit = !deviceProfile.isTaskbarPresent && recentsView.getTaskViewCount() < 2; boolean isTaskSplitNotSupported = !task.isDockable || (intentFlags & FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) != 0; boolean hideForExistingMultiWindow = activity.getDeviceProfile().isMultiWindowMode; boolean isFocusedTask = deviceProfile.isTablet && taskView.isFocusedTask(); boolean isTaskInExpectedScrollPosition = recentsView.isTaskInExpectedScrollPosition(recentsView.indexOfChild(taskView)); if (taskView.containsMultipleTasks() || notEnoughTasksToSplit || isTaskSplitNotSupported || hideForExistingMultiWindow if (notEnoughTasksToSplit || isTaskSplitNotSupported || hideForExistingMultiWindow || (isFocusedTask && isTaskInExpectedScrollPosition)) { return null; } Loading Loading @@ -389,7 +387,8 @@ public interface TaskShortcutFactory { @Override public void onClick(View view) { if (mTaskView.launchTaskAnimated() != null) { SystemUiProxy.INSTANCE.get(mTarget).startScreenPinning(mTaskView.getTask().key.id); SystemUiProxy.INSTANCE.get(mTarget).startScreenPinning( mTaskView.getTask().key.id); } dismissTaskMenuView(mTarget); mTarget.getStatsLogManager().logger().withItemInfo(mTaskView.getItemInfo()) Loading Loading @@ -425,7 +424,8 @@ public interface TaskShortcutFactory { @Override public List<SystemShortcut> getShortcuts(BaseDraggingActivity activity, TaskIdAttributeContainer taskContainer) { SystemShortcut screenshotShortcut = taskContainer.getThumbnailView().getTaskOverlay() SystemShortcut screenshotShortcut = taskContainer.getThumbnailView().getTaskOverlay() .getScreenshotShortcut(activity, taskContainer.getItemInfo(), taskContainer.getTaskView()); return createSingletonShortcutList(screenshotShortcut); Loading quickstep/tests/src/com/android/quickstep/TaplTestsSplitscreen.java +28 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,9 @@ import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.LargeTest; import androidx.test.platform.app.InstrumentationRegistry; import com.android.launcher3.tapl.Overview; import com.android.launcher3.tapl.Taskbar; import com.android.launcher3.tapl.TaskbarAppIcon; import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape; import com.android.launcher3.ui.TaplTestsLauncher3; import com.android.launcher3.util.rule.TestStabilityRule; Loading Loading @@ -137,6 +140,31 @@ public class TaplTestsSplitscreen extends AbstractQuickStepTest { .hasMenuItem("Save app pair")); } @Test public void testSplitSingleTaskFromTaskbar() { // Currently only tablets have Taskbar in Overview, so test is only active on tablets assumeTrue(mLauncher.isTablet()); if (!mLauncher.getRecentTasks().isEmpty()) { // Clear all recent tasks mLauncher.goHome().switchToOverview().dismissAllTasks(); } startAppFast(getAppPackageName()); Overview overview = mLauncher.goHome().switchToOverview(); if (mLauncher.isGridOnlyOverviewEnabled()) { overview.getCurrentTask().tapMenu().tapSplitMenuItem(); } else { overview.getOverviewActions().clickSplit(); } Taskbar taskbar = overview.getTaskbar(); String firstAppName = taskbar.getIconNames().get(0); TaskbarAppIcon firstApp = taskbar.getAppIcon(firstAppName); firstApp.launchIntoSplitScreen(); } private void createAndLaunchASplitPair() { startTestActivity(2); startTestActivity(3); Loading tests/tapl/com/android/launcher3/tapl/BaseOverview.java +19 −0 Original line number Diff line number Diff line Loading @@ -16,9 +16,12 @@ package com.android.launcher3.tapl; import static com.android.launcher3.tapl.LauncherInstrumentation.TASKBAR_RES_ID; import android.graphics.Rect; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.test.uiautomator.By; import androidx.test.uiautomator.BySelector; import androidx.test.uiautomator.Direction; Loading Loading @@ -322,6 +325,22 @@ public class BaseOverview extends LauncherInstrumentation.VisibleContainer { mLauncher.getOverviewObjectSelector("clear_all")); } /** * Returns the taskbar if it's a tablet, or {@code null} otherwise. */ @Nullable public Taskbar getTaskbar() { if (!mLauncher.isTablet()) { return null; } try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer( "want to get the taskbar")) { mLauncher.waitForSystemLauncherObject(TASKBAR_RES_ID); return new Taskbar(mLauncher); } } protected boolean isActionsViewVisible() { if (!hasTasks() || isClearAllVisible()) { return false; Loading Loading
quickstep/src/com/android/quickstep/TaskShortcutFactory.java +31 −31 Original line number Diff line number Diff line Loading @@ -218,7 +218,8 @@ public interface TaskShortcutFactory { new AppTransitionAnimationSpecsFuture(mHandler) { @Override public List<AppTransitionAnimationSpecCompat> composeSpecs() { return Collections.singletonList(new AppTransitionAnimationSpecCompat( return Collections.singletonList( new AppTransitionAnimationSpecCompat( taskId, thumbnail, taskBounds)); } }; Loading Loading @@ -264,13 +265,12 @@ public interface TaskShortcutFactory { /** * Does NOT add split options in the following scenarios: * * The taskView to add split options is already showing split screen tasks * * There aren't at least 2 tasks in overview to show split options for * * Split isn't supported by the task itself (non resizable activity) * * We aren't currently in multi-window * * The taskView to show split options for is the focused task AND we haven't started * scrolling in overview (if we haven't scrolled, there's a split overview action button so * we don't need this menu option) * * 1. Taskbar is not present AND aren't at least 2 tasks in overview to show split options for * * 2. Split isn't supported by the task itself (non resizable activity) * * 3. We aren't currently in multi-window * * 4. The taskView to show split options for is the focused task AND we haven't started * * scrolling in overview (if we haven't scrolled, there's a split overview action button so * * we don't need this menu option) */ TaskShortcutFactory SPLIT_SELECT = new TaskShortcutFactory() { @Override Loading @@ -284,18 +284,16 @@ public interface TaskShortcutFactory { final PagedOrientationHandler orientationHandler = recentsView.getPagedOrientationHandler(); boolean notEnoughTasksToSplit = recentsView.getTaskViewCount() < 2; boolean isFocusedTask = deviceProfile.isTablet && taskView.isFocusedTask(); boolean isTaskInExpectedScrollPosition = recentsView.isTaskInExpectedScrollPosition(recentsView.indexOfChild(taskView)); boolean notEnoughTasksToSplit = !deviceProfile.isTaskbarPresent && recentsView.getTaskViewCount() < 2; boolean isTaskSplitNotSupported = !task.isDockable || (intentFlags & FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) != 0; boolean hideForExistingMultiWindow = activity.getDeviceProfile().isMultiWindowMode; boolean isFocusedTask = deviceProfile.isTablet && taskView.isFocusedTask(); boolean isTaskInExpectedScrollPosition = recentsView.isTaskInExpectedScrollPosition(recentsView.indexOfChild(taskView)); if (taskView.containsMultipleTasks() || notEnoughTasksToSplit || isTaskSplitNotSupported || hideForExistingMultiWindow if (notEnoughTasksToSplit || isTaskSplitNotSupported || hideForExistingMultiWindow || (isFocusedTask && isTaskInExpectedScrollPosition)) { return null; } Loading Loading @@ -389,7 +387,8 @@ public interface TaskShortcutFactory { @Override public void onClick(View view) { if (mTaskView.launchTaskAnimated() != null) { SystemUiProxy.INSTANCE.get(mTarget).startScreenPinning(mTaskView.getTask().key.id); SystemUiProxy.INSTANCE.get(mTarget).startScreenPinning( mTaskView.getTask().key.id); } dismissTaskMenuView(mTarget); mTarget.getStatsLogManager().logger().withItemInfo(mTaskView.getItemInfo()) Loading Loading @@ -425,7 +424,8 @@ public interface TaskShortcutFactory { @Override public List<SystemShortcut> getShortcuts(BaseDraggingActivity activity, TaskIdAttributeContainer taskContainer) { SystemShortcut screenshotShortcut = taskContainer.getThumbnailView().getTaskOverlay() SystemShortcut screenshotShortcut = taskContainer.getThumbnailView().getTaskOverlay() .getScreenshotShortcut(activity, taskContainer.getItemInfo(), taskContainer.getTaskView()); return createSingletonShortcutList(screenshotShortcut); Loading
quickstep/tests/src/com/android/quickstep/TaplTestsSplitscreen.java +28 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,9 @@ import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.LargeTest; import androidx.test.platform.app.InstrumentationRegistry; import com.android.launcher3.tapl.Overview; import com.android.launcher3.tapl.Taskbar; import com.android.launcher3.tapl.TaskbarAppIcon; import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape; import com.android.launcher3.ui.TaplTestsLauncher3; import com.android.launcher3.util.rule.TestStabilityRule; Loading Loading @@ -137,6 +140,31 @@ public class TaplTestsSplitscreen extends AbstractQuickStepTest { .hasMenuItem("Save app pair")); } @Test public void testSplitSingleTaskFromTaskbar() { // Currently only tablets have Taskbar in Overview, so test is only active on tablets assumeTrue(mLauncher.isTablet()); if (!mLauncher.getRecentTasks().isEmpty()) { // Clear all recent tasks mLauncher.goHome().switchToOverview().dismissAllTasks(); } startAppFast(getAppPackageName()); Overview overview = mLauncher.goHome().switchToOverview(); if (mLauncher.isGridOnlyOverviewEnabled()) { overview.getCurrentTask().tapMenu().tapSplitMenuItem(); } else { overview.getOverviewActions().clickSplit(); } Taskbar taskbar = overview.getTaskbar(); String firstAppName = taskbar.getIconNames().get(0); TaskbarAppIcon firstApp = taskbar.getAppIcon(firstAppName); firstApp.launchIntoSplitScreen(); } private void createAndLaunchASplitPair() { startTestActivity(2); startTestActivity(3); Loading
tests/tapl/com/android/launcher3/tapl/BaseOverview.java +19 −0 Original line number Diff line number Diff line Loading @@ -16,9 +16,12 @@ package com.android.launcher3.tapl; import static com.android.launcher3.tapl.LauncherInstrumentation.TASKBAR_RES_ID; import android.graphics.Rect; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.test.uiautomator.By; import androidx.test.uiautomator.BySelector; import androidx.test.uiautomator.Direction; Loading Loading @@ -322,6 +325,22 @@ public class BaseOverview extends LauncherInstrumentation.VisibleContainer { mLauncher.getOverviewObjectSelector("clear_all")); } /** * Returns the taskbar if it's a tablet, or {@code null} otherwise. */ @Nullable public Taskbar getTaskbar() { if (!mLauncher.isTablet()) { return null; } try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer( "want to get the taskbar")) { mLauncher.waitForSystemLauncherObject(TASKBAR_RES_ID); return new Taskbar(mLauncher); } } protected boolean isActionsViewVisible() { if (!hasTasks() || isClearAllVisible()) { return false; Loading