diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java index cdb8082da7..488789b465 100644 --- a/quickstep/src/com/android/quickstep/views/TaskView.java +++ b/quickstep/src/com/android/quickstep/views/TaskView.java @@ -464,11 +464,15 @@ public class TaskView extends FrameLayout implements Reusable { return getItemInfo(mTask); } - protected WorkspaceItemInfo getItemInfo(Task task) { - ComponentKey componentKey = TaskUtils.getLaunchComponentKeyForTask(task.key); + protected WorkspaceItemInfo getItemInfo(@Nullable Task task) { WorkspaceItemInfo stubInfo = new WorkspaceItemInfo(); stubInfo.itemType = LauncherSettings.Favorites.ITEM_TYPE_TASK; stubInfo.container = LauncherSettings.Favorites.CONTAINER_TASKSWITCHER; + if (task == null) { + return stubInfo; + } + + ComponentKey componentKey = TaskUtils.getLaunchComponentKeyForTask(task.key); stubInfo.user = componentKey.user; stubInfo.intent = new Intent().setComponent(componentKey.componentName); stubInfo.title = task.title; diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index fcd147ffdf..8fb2f53ec6 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -1682,8 +1682,6 @@ public class Launcher extends StatefulActivity implements Launche AbstractFloatingView.closeOpenViews(this, false, TYPE_ALL & ~TYPE_REBIND_SAFE); finishAutoCancelActionMode(); - DragView.removeAllViews(this); - if (mPendingRequestArgs != null) { outState.putParcelable(RUNTIME_STATE_PENDING_REQUEST_ARGS, mPendingRequestArgs); } diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java index 99c9bb989e..a949e11155 100644 --- a/src/com/android/launcher3/config/FeatureFlags.java +++ b/src/com/android/launcher3/config/FeatureFlags.java @@ -139,12 +139,12 @@ public final class FeatureFlags { public static final BooleanFlag ENABLE_BULK_WORKSPACE_ICON_LOADING = getDebugFlag( "ENABLE_BULK_WORKSPACE_ICON_LOADING", - false, + true, "Enable loading workspace icons in bulk."); public static final BooleanFlag ENABLE_BULK_ALL_APPS_ICON_LOADING = getDebugFlag( "ENABLE_BULK_ALL_APPS_ICON_LOADING", - false, + true, "Enable loading all apps icons in bulk."); // Keep as DeviceFlag for remote disable in emergency. diff --git a/src/com/android/launcher3/dragndrop/DragView.java b/src/com/android/launcher3/dragndrop/DragView.java index 8bfd774918..b914ae2dac 100644 --- a/src/com/android/launcher3/dragndrop/DragView.java +++ b/src/com/android/launcher3/dragndrop/DragView.java @@ -565,19 +565,4 @@ public abstract class DragView extends Fram iv.setImageDrawable(drawable); return iv; } - - /** - * Removes any stray DragView from the DragLayer. - */ - public static void removeAllViews(ActivityContext activity) { - BaseDragLayer dragLayer = activity.getDragLayer(); - // Iterate in reverse order. DragView is added later to the dragLayer, - // and will be one of the last views. - for (int i = dragLayer.getChildCount() - 1; i >= 0; i--) { - View child = dragLayer.getChildAt(i); - if (child instanceof DragView) { - dragLayer.removeView(child); - } - } - } } diff --git a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java index 88ce57e40f..2459e0977a 100644 --- a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java +++ b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java @@ -111,7 +111,7 @@ import java.util.concurrent.ConcurrentLinkedQueue; * 3) Place appropriate elements like icons and first-page qsb * 4) Measure and draw the view on a canvas */ -@TargetApi(Build.VERSION_CODES.O) +@TargetApi(Build.VERSION_CODES.R) public class LauncherPreviewRenderer extends ContextWrapper implements ActivityContext, WorkspaceLayoutManager, LayoutInflater.Factory2 { @@ -186,19 +186,13 @@ public class LauncherPreviewRenderer extends ContextWrapper mIdp = idp; mDp = idp.getDeviceProfile(context).copy(context); - if (Utilities.ATLEAST_R) { - WindowInsets currentWindowInsets = context.getSystemService(WindowManager.class) - .getCurrentWindowMetrics().getWindowInsets(); - mInsets = new Rect( - currentWindowInsets.getSystemWindowInsetLeft(), - currentWindowInsets.getSystemWindowInsetTop(), - currentWindowInsets.getSystemWindowInsetRight(), - currentWindowInsets.getSystemWindowInsetBottom()); - } else { - mInsets = new Rect(); - mInsets.left = mInsets.right = (mDp.widthPx - mDp.availableWidthPx) / 2; - mInsets.top = mInsets.bottom = (mDp.heightPx - mDp.availableHeightPx) / 2; - } + WindowInsets currentWindowInsets = context.getSystemService(WindowManager.class) + .getCurrentWindowMetrics().getWindowInsets(); + mInsets = new Rect( + currentWindowInsets.getSystemWindowInsetLeft(), + currentWindowInsets.getSystemWindowInsetTop(), + currentWindowInsets.getSystemWindowInsetRight(), + mDp.isTaskbarPresent ? 0 : currentWindowInsets.getSystemWindowInsetBottom()); mDp.updateInsets(mInsets); BaseIconFactory iconFactory = diff --git a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java index a308182ebe..0d92e2542a 100644 --- a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java +++ b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java @@ -420,12 +420,12 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler { List options = new ArrayList<>(1); // Add both left and right options if we're in tablet mode if (dp.isTablet && dp.isLandscape) { - options.add(new SplitPositionOption( - R.drawable.ic_split_right, R.string.split_screen_position_right, - STAGE_POSITION_BOTTOM_OR_RIGHT, STAGE_TYPE_MAIN)); options.add(new SplitPositionOption( R.drawable.ic_split_left, R.string.split_screen_position_left, STAGE_POSITION_TOP_OR_LEFT, STAGE_TYPE_MAIN)); + options.add(new SplitPositionOption( + R.drawable.ic_split_right, R.string.split_screen_position_right, + STAGE_POSITION_BOTTOM_OR_RIGHT, STAGE_TYPE_MAIN)); } else { if (dp.isSeascape()) { // Add left/right options diff --git a/src/com/android/launcher3/touch/SeascapePagedViewHandler.java b/src/com/android/launcher3/touch/SeascapePagedViewHandler.java index 6dc0c9af42..69e19f4e6c 100644 --- a/src/com/android/launcher3/touch/SeascapePagedViewHandler.java +++ b/src/com/android/launcher3/touch/SeascapePagedViewHandler.java @@ -164,7 +164,7 @@ public class SeascapePagedViewHandler extends LandscapePagedViewHandler { // Add "right" option which is actually the top return Collections.singletonList(new SplitPositionOption( R.drawable.ic_split_right, R.string.split_screen_position_right, - STAGE_POSITION_TOP_OR_LEFT, STAGE_TYPE_MAIN)); + STAGE_POSITION_BOTTOM_OR_RIGHT, STAGE_TYPE_MAIN)); } @Override diff --git a/tests/src/com/android/launcher3/ui/workspace/TwoPanelWorkspaceTest.java b/tests/src/com/android/launcher3/ui/workspace/TwoPanelWorkspaceTest.java index 122a130f7b..d0daefc1d8 100644 --- a/tests/src/com/android/launcher3/ui/workspace/TwoPanelWorkspaceTest.java +++ b/tests/src/com/android/launcher3/ui/workspace/TwoPanelWorkspaceTest.java @@ -64,8 +64,7 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest { } @Test - // TODO(b/197631877) Enable in portrait. - // @PortraitLandscape + @PortraitLandscape public void testDragIconToRightPanel() { Workspace workspace = mLauncher.getWorkspace(); @@ -79,8 +78,7 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest { } @Test - // TODO(b/197631877) Enable in portrait. - // @PortraitLandscape + @PortraitLandscape public void testSinglePageDragIconWhenMultiplePageScrollingIsPossible() { Workspace workspace = mLauncher.getWorkspace(); @@ -134,8 +132,7 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest { } @Test - // TODO(b/197631877) Enable in portrait. - // @PortraitLandscape + @PortraitLandscape public void testDragIconToPage2() { Workspace workspace = mLauncher.getWorkspace(); @@ -151,8 +148,7 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest { } @Test - // TODO(b/197631877) Enable in portrait. - // @PortraitLandscape + @PortraitLandscape public void testDragIconToPage3() { Workspace workspace = mLauncher.getWorkspace(); @@ -168,8 +164,7 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest { } @Test - // TODO(b/197631877) Enable in portrait. - // @PortraitLandscape + @PortraitLandscape public void testMultiplePageDragIcon() { Workspace workspace = mLauncher.getWorkspace(); @@ -215,8 +210,7 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest { } @Test - // TODO(b/197631877) Enable in portrait. - // @PortraitLandscape + @PortraitLandscape public void testEmptyPageDoesNotGetRemovedIfPagePairIsNotEmpty() { Workspace workspace = mLauncher.getWorkspace(); @@ -256,8 +250,7 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest { } @Test - // TODO(b/197631877) Enable in portrait. - // @PortraitLandscape + @PortraitLandscape public void testEmptyPagesGetRemovedIfBothPagesAreEmpty() { Workspace workspace = mLauncher.getWorkspace(); @@ -284,8 +277,7 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest { } @Test - // TODO(b/197631877) Enable in portrait. - // @PortraitLandscape + @PortraitLandscape public void testMiddleEmptyPagesGetRemoved() { Workspace workspace = mLauncher.getWorkspace(); diff --git a/tests/tapl/com/android/launcher3/tapl/Workspace.java b/tests/tapl/com/android/launcher3/tapl/Workspace.java index 6e10b28c73..4f4ce30774 100644 --- a/tests/tapl/com/android/launcher3/tapl/Workspace.java +++ b/tests/tapl/com/android/launcher3/tapl/Workspace.java @@ -385,7 +385,8 @@ public final class Workspace extends Home { // Since the destination can be on another page, we need to drag to the edge first // until we reach the target page while (targetDest.x > displayX || targetDest.x < 0) { - int edgeX = targetDest.x > 0 ? displayX : 0; + // TODO: b/219919285 + int edgeX = targetDest.x > 0 ? displayX - 1 : 1; Point screenEdge = new Point(edgeX, targetDest.y); Point finalDragStart = dragStart; executeAndWaitForPageScroll(launcher,