From 73c6288038c05d8e1c692e4027927e4fd6452fd7 Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Wed, 9 Feb 2022 15:59:13 -0800 Subject: [PATCH 1/6] Add null check for null task in getItemInfo() * Pass back an empty WorkspaceItemInfo with correct itemType set on it so at least it can be identified if remaining fields are missing. Fixes: 218625473 Test: Wasn't able to repro crash Change-Id: If20d8fa648edf6c210ad5398905bf78e173b23a1 --- quickstep/src/com/android/quickstep/views/TaskView.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java index 6a2c997e05..d046fefda8 100644 --- a/quickstep/src/com/android/quickstep/views/TaskView.java +++ b/quickstep/src/com/android/quickstep/views/TaskView.java @@ -462,11 +462,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; From baf1ef55abe488b382281afca611dbe7c0f800b3 Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Mon, 14 Feb 2022 20:26:21 -0800 Subject: [PATCH 2/6] Revert "Clear all DragView in onSaveInstanceState" This reverts commit 14d6771aae2037d5e9bb330f608c4a7e461786d3 to fix bootline regression. Bug: 210383463 Test: manual Change-Id: I5a0dadee59bfd6b5a164fd2ca3ecdd1885cb4134 --- src/com/android/launcher3/Launcher.java | 2 -- src/com/android/launcher3/dragndrop/DragView.java | 15 --------------- 2 files changed, 17 deletions(-) diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index ebc0c75fe6..b75b610cfd 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -1681,8 +1681,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/dragndrop/DragView.java b/src/com/android/launcher3/dragndrop/DragView.java index 4588a04444..8313571d2d 100644 --- a/src/com/android/launcher3/dragndrop/DragView.java +++ b/src/com/android/launcher3/dragndrop/DragView.java @@ -564,19 +564,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); - } - } - } } From 659cfbe1f670ad445c4668e2cb29f567c2443507 Mon Sep 17 00:00:00 2001 From: Andras Kloczl Date: Tue, 8 Feb 2022 17:04:45 +0000 Subject: [PATCH 3/6] Fix two panel tapl test dragging issue It seems if the dragging target position's X coordinate is 0 then there is a weird bug in portrait mode. Test: atest TwoPanelWorkspaceTest Bug: 197631877 Change-Id: I7d8702b06e5ed396814339080f8e814e9f8a6a65 --- .../ui/workspace/TwoPanelWorkspaceTest.java | 24 +++++++------------ .../com/android/launcher3/tapl/Workspace.java | 3 ++- 2 files changed, 10 insertions(+), 17 deletions(-) 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 1947da30a7..20d860d460 100644 --- a/tests/tapl/com/android/launcher3/tapl/Workspace.java +++ b/tests/tapl/com/android/launcher3/tapl/Workspace.java @@ -411,7 +411,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, From 76d56ee5a1d57c0cd69a31db5b1e1f3159216374 Mon Sep 17 00:00:00 2001 From: Schneider Victor-tulias Date: Wed, 16 Feb 2022 12:23:34 -0800 Subject: [PATCH 4/6] Re-enable bulk icon loading Bug: 195674813 Test: manual Change-Id: I8cc02cb8648797e55a83bbb184ed2cd5088a1626 --- src/com/android/launcher3/config/FeatureFlags.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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. From 0551313a9ba32f97ff130f83ac4630316a060b44 Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Thu, 17 Feb 2022 00:14:50 -0800 Subject: [PATCH 5/6] Correct order of split action buttons Fixes: 219988163 Fixes: 217965089 Test: https://screenshot.googleplex.com/8LNMBeEQhMVnDSm Change-Id: I760c0b8085069181d9a1cdc582ac7d58a08f4724 --- .../android/launcher3/touch/PortraitPagedViewHandler.java | 6 +++--- .../android/launcher3/touch/SeascapePagedViewHandler.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) 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 From 83b345338b6e0cd1aec2ddb36802250dd5c7a23d Mon Sep 17 00:00:00 2001 From: Thales Lima Date: Mon, 14 Feb 2022 14:27:23 +0000 Subject: [PATCH 6/6] Stop using bottom inset in preview We are not using the bottom inset (navbar) in Launcher anymore, so we should not use it in preview as well. Fixes 205284107 Test: manual Change-Id: Iefd71b3cbe8e738c4559716af8c85015ba7c3c41 --- .../graphics/LauncherPreviewRenderer.java | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) 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 =