From d1c4c1c1827ebfa7654af37f6e43f9d6813e2665 Mon Sep 17 00:00:00 2001 From: Jakob Schneider Date: Mon, 26 Feb 2024 18:23:30 +0000 Subject: [PATCH 01/13] Add dedicated a11y label for archived apps. Bug: 326862963 Test: N/A Flag: ACONFIG com.android.launcher3.enable_support_for_archiving TRUNKFOOD Change-Id: I2614df570bcd4e731d56088b5ef2db4a6874fb71 --- res/values/strings.xml | 2 ++ src/com/android/launcher3/BubbleTextView.java | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 379cdda8db..2a3af79501 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -322,6 +322,8 @@ %1$s downloading, %2$s complete %1$s waiting to install + + %1$s is archived. Tap to download. 0dp 76dp + 64dp 0dp @@ -47,6 +48,7 @@ 20dp 32dp 16dp + 32dp diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index 563dfe2f20..a6ff6c1a89 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -83,6 +83,7 @@ public class DeviceProfile { // Minimum aspect ratio beyond which an extra top padding may be applied to a bottom sheet. private static final float MIN_ASPECT_RATIO_FOR_EXTRA_TOP_PADDING = 1.5f; + private static final float MAX_ASPECT_RATIO_FOR_ALTERNATE_EDIT_STATE = 1.5f; public static final PointF DEFAULT_SCALE = new PointF(1.0f, 1.0f); public static final ViewScaleProvider DEFAULT_PROVIDER = itemInfo -> DEFAULT_SCALE; @@ -500,8 +501,17 @@ public class DeviceProfile { } dropTargetBarSizePx = res.getDimensionPixelSize(R.dimen.dynamic_grid_drop_target_size); - dropTargetBarTopMarginPx = res.getDimensionPixelSize(R.dimen.drop_target_top_margin); - dropTargetBarBottomMarginPx = res.getDimensionPixelSize(R.dimen.drop_target_bottom_margin); + // Some foldable portrait modes are too wide in terms of aspect ratio so we need to tweak + // the dimensions for edit state. + final boolean shouldApplyWidePortraitDimens = isTablet + && !isLandscape + && aspectRatio < MAX_ASPECT_RATIO_FOR_ALTERNATE_EDIT_STATE; + dropTargetBarTopMarginPx = shouldApplyWidePortraitDimens + ? 0 + : res.getDimensionPixelSize(R.dimen.drop_target_top_margin); + dropTargetBarBottomMarginPx = shouldApplyWidePortraitDimens + ? res.getDimensionPixelSize(R.dimen.drop_target_bottom_margin_wide_portrait) + : res.getDimensionPixelSize(R.dimen.drop_target_bottom_margin); dropTargetDragPaddingPx = res.getDimensionPixelSize(R.dimen.drop_target_drag_padding); dropTargetTextSizePx = res.getDimensionPixelSize(R.dimen.drop_target_text_size); dropTargetHorizontalPaddingPx = res.getDimensionPixelSize( @@ -592,8 +602,9 @@ public class DeviceProfile { } } - springLoadedHotseatBarTopMarginPx = res.getDimensionPixelSize( - R.dimen.spring_loaded_hotseat_top_margin); + springLoadedHotseatBarTopMarginPx = shouldApplyWidePortraitDimens + ? res.getDimensionPixelSize(R.dimen.spring_loaded_hotseat_top_margin_wide_portrait) + : res.getDimensionPixelSize(R.dimen.spring_loaded_hotseat_top_margin); if (mIsResponsiveGrid) { updateHotseatSizes(mResponsiveWorkspaceCellSpec.getIconSize()); diff --git a/tests/assets/dumpTests/DeviceProfileDumpTest/twoPanelPortrait.txt b/tests/assets/dumpTests/DeviceProfileDumpTest/twoPanelPortrait.txt index 93ab6f29b4..3169f41b22 100644 --- a/tests/assets/dumpTests/DeviceProfileDumpTest/twoPanelPortrait.txt +++ b/tests/assets/dumpTests/DeviceProfileDumpTest/twoPanelPortrait.txt @@ -79,7 +79,7 @@ DeviceProfile: hotseatBarEndOffset: 0.0px (0.0dp) hotseatQsbSpace: 0.0px (0.0dp) hotseatQsbHeight: 0.0px (0.0dp) - springLoadedHotseatBarTopMarginPx: 171.0px (65.14286dp) + springLoadedHotseatBarTopMarginPx: 168.0px (64.0dp) getHotseatLayoutPadding(context).top: 0.0px (0.0dp) getHotseatLayoutPadding(context).bottom: 108.0px (41.142857dp) getHotseatLayoutPadding(context).left: 98.0px (37.333332dp) @@ -118,12 +118,12 @@ DeviceProfile: overviewPageSpacing: 0.0px (0.0dp) overviewRowSpacing: 0.0px (0.0dp) overviewGridSideMargin: 0.0px (0.0dp) - dropTargetBarTopMarginPx: 168.0px (64.0dp) + dropTargetBarTopMarginPx: 0.0px (0.0dp) dropTargetBarSizePx: 147.0px (56.0dp) - dropTargetBarBottomMarginPx: 42.0px (16.0dp) - getCellLayoutSpringLoadShrunkTop(): 490.0px (186.66667dp) - getCellLayoutSpringLoadShrunkBottom(): 1770.0px (674.2857dp) + dropTargetBarBottomMarginPx: 84.0px (32.0dp) + getCellLayoutSpringLoadShrunkTop(): 364.0px (138.66667dp) + getCellLayoutSpringLoadShrunkBottom(): 1773.0px (675.4286dp) workspaceSpringLoadedMinNextPageVisiblePx: 63.0px (24.0dp) - getWorkspaceSpringLoadScale(): 0.7437536px (0.2833347dp) + getWorkspaceSpringLoadScale(): 0.81871px (0.31188953dp) getCellLayoutHeight(): 1721.0px (655.619dp) getCellLayoutWidth(): 899.0px (342.4762dp) diff --git a/tests/assets/dumpTests/DeviceProfileDumpTest/twoPanelPortrait3Button.txt b/tests/assets/dumpTests/DeviceProfileDumpTest/twoPanelPortrait3Button.txt index ec9a10e6cc..9d3d7bc0d6 100644 --- a/tests/assets/dumpTests/DeviceProfileDumpTest/twoPanelPortrait3Button.txt +++ b/tests/assets/dumpTests/DeviceProfileDumpTest/twoPanelPortrait3Button.txt @@ -79,7 +79,7 @@ DeviceProfile: hotseatBarEndOffset: 0.0px (0.0dp) hotseatQsbSpace: 0.0px (0.0dp) hotseatQsbHeight: 0.0px (0.0dp) - springLoadedHotseatBarTopMarginPx: 171.0px (65.14286dp) + springLoadedHotseatBarTopMarginPx: 168.0px (64.0dp) getHotseatLayoutPadding(context).top: 0.0px (0.0dp) getHotseatLayoutPadding(context).bottom: 108.0px (41.142857dp) getHotseatLayoutPadding(context).left: 98.0px (37.333332dp) @@ -118,12 +118,12 @@ DeviceProfile: overviewPageSpacing: 0.0px (0.0dp) overviewRowSpacing: 0.0px (0.0dp) overviewGridSideMargin: 0.0px (0.0dp) - dropTargetBarTopMarginPx: 168.0px (64.0dp) + dropTargetBarTopMarginPx: 0.0px (0.0dp) dropTargetBarSizePx: 147.0px (56.0dp) - dropTargetBarBottomMarginPx: 42.0px (16.0dp) - getCellLayoutSpringLoadShrunkTop(): 490.0px (186.66667dp) - getCellLayoutSpringLoadShrunkBottom(): 1770.0px (674.2857dp) + dropTargetBarBottomMarginPx: 84.0px (32.0dp) + getCellLayoutSpringLoadShrunkTop(): 364.0px (138.66667dp) + getCellLayoutSpringLoadShrunkBottom(): 1773.0px (675.4286dp) workspaceSpringLoadedMinNextPageVisiblePx: 63.0px (24.0dp) - getWorkspaceSpringLoadScale(): 0.7437536px (0.2833347dp) + getWorkspaceSpringLoadScale(): 0.81871px (0.31188953dp) getCellLayoutHeight(): 1721.0px (655.619dp) getCellLayoutWidth(): 899.0px (342.4762dp) From dae8b65dea6bceafbcf225ffb691f2ec6ab281d0 Mon Sep 17 00:00:00 2001 From: Vadim Tryshev Date: Mon, 26 Feb 2024 17:48:51 -0800 Subject: [PATCH 04/13] Removing logging for verifying internal Launcher state from tests Bug: 322823209 Test: presubmit Flag: N/A Change-Id: I25afcc30446d429171445f8e1b6033b277166725 --- src/com/android/launcher3/BaseActivity.java | 6 ------ .../com/android/launcher3/testing/shared/TestProtocol.java | 1 - 2 files changed, 7 deletions(-) diff --git a/src/com/android/launcher3/BaseActivity.java b/src/com/android/launcher3/BaseActivity.java index acfc5e40ca..1049314016 100644 --- a/src/com/android/launcher3/BaseActivity.java +++ b/src/com/android/launcher3/BaseActivity.java @@ -16,8 +16,6 @@ package com.android.launcher3; -import static com.android.launcher3.testing.shared.TestProtocol.ACTIVITY_NOT_RESUMED_AFTER_BACK; -import static com.android.launcher3.testing.shared.TestProtocol.sDebugTracing; import static com.android.launcher3.util.FlagDebugUtils.appendFlag; import static com.android.launcher3.util.FlagDebugUtils.formatFlagChange; import static com.android.launcher3.util.SystemUiController.UI_STATE_FULLSCREEN_TASK; @@ -310,9 +308,6 @@ public abstract class BaseActivity extends Activity implements ActivityContext { * Sets the activity to appear as paused. */ public void setPaused() { - if (sDebugTracing) { - Log.d(ACTIVITY_NOT_RESUMED_AFTER_BACK, "Activity setPaused: " + this, new Throwable()); - } removeActivityFlags(ACTIVITY_STATE_RESUMED | ACTIVITY_STATE_DEFERRED_RESUMED); } @@ -320,7 +315,6 @@ public abstract class BaseActivity extends Activity implements ActivityContext { * Sets the activity to appear as resumed. */ public void setResumed() { - if (sDebugTracing) Log.d(ACTIVITY_NOT_RESUMED_AFTER_BACK, "Activity setResumed: " + this); addActivityFlags(ACTIVITY_STATE_RESUMED | ACTIVITY_STATE_USER_ACTIVE); removeActivityFlags(ACTIVITY_STATE_USER_WILL_BE_ACTIVE); } diff --git a/tests/multivalentTests/shared/com/android/launcher3/testing/shared/TestProtocol.java b/tests/multivalentTests/shared/com/android/launcher3/testing/shared/TestProtocol.java index 8929d5d15c..1c274bf5db 100644 --- a/tests/multivalentTests/shared/com/android/launcher3/testing/shared/TestProtocol.java +++ b/tests/multivalentTests/shared/com/android/launcher3/testing/shared/TestProtocol.java @@ -171,7 +171,6 @@ public final class TestProtocol { public static final String ICON_MISSING = "b/282963545"; public static final String OVERVIEW_OVER_HOME = "b/279059025"; public static final String UIOBJECT_STALE_ELEMENT = "b/319501259"; - public static final String ACTIVITY_NOT_RESUMED_AFTER_BACK = "b/322823209"; public static final String GET_FROM_RECENTS_FAILURE = "b/321775748"; public static final String REQUEST_EMULATE_DISPLAY = "emulate-display"; From dfbf253f90d385ebd862287d89825b8a47150e63 Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Tue, 27 Feb 2024 16:54:02 -0800 Subject: [PATCH 05/13] Remove A11y node info for SplitInstructionsView * Individual text view and cancel button still have their own a11y actions, but top level view doesn't need one Test: Tested w/ switches to ensure parent view doesn't get selected. Tested w/ Talkback to ensure we can still cancel through talkback Fixes: 323462927 Change-Id: I60d21f6e768c59f29f51007f56ff784821487895 --- .../views/SplitInstructionsView.java | 28 ------------------- 1 file changed, 28 deletions(-) diff --git a/quickstep/src/com/android/quickstep/views/SplitInstructionsView.java b/quickstep/src/com/android/quickstep/views/SplitInstructionsView.java index a11a913e42..be07e8a995 100644 --- a/quickstep/src/com/android/quickstep/views/SplitInstructionsView.java +++ b/quickstep/src/com/android/quickstep/views/SplitInstructionsView.java @@ -21,11 +21,9 @@ import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCH import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.content.Context; -import android.os.Bundle; import android.util.AttributeSet; import android.util.FloatProperty; import android.view.ViewGroup; -import android.view.accessibility.AccessibilityNodeInfo; import android.widget.LinearLayout; import android.widget.TextView; @@ -141,32 +139,6 @@ public class SplitInstructionsView extends LinearLayout { mLauncher.getStateManager().goToState(LauncherState.NORMAL); } - @Override - public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfo(info); - if (!FeatureFlags.enableSplitContextually()) { - return; - } - - info.addAction(new AccessibilityNodeInfo.AccessibilityAction( - R.string.toast_split_select_cont_desc, - getResources().getString(R.string.toast_split_select_cont_desc) - )); - } - - @Override - public boolean performAccessibilityAction(int action, Bundle arguments) { - if (!FeatureFlags.enableSplitContextually()) { - return super.performAccessibilityAction(action, arguments); - } - - if (action == R.string.toast_split_select_cont_desc) { - exitSplitSelection(); - return true; - } - return super.performAccessibilityAction(action, arguments); - } - void ensureProperRotation() { ((RecentsView) mLauncher.getOverviewPanel()).getPagedOrientationHandler() .setSplitInstructionsParams( From 75306186e06c0db1b94fd1d2f96070740a42bdf8 Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Tue, 27 Feb 2024 17:07:44 -0800 Subject: [PATCH 06/13] Add toString() dump for Launcher SplitBounds Bug: 286509643 Change-Id: I57e04c571678dbb553c7d35128d8e63700a2f382 --- .../launcher3/util/SplitConfigurationOptions.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/com/android/launcher3/util/SplitConfigurationOptions.java b/src/com/android/launcher3/util/SplitConfigurationOptions.java index f4a022544c..837d7bc04d 100644 --- a/src/com/android/launcher3/util/SplitConfigurationOptions.java +++ b/src/com/android/launcher3/util/SplitConfigurationOptions.java @@ -169,6 +169,15 @@ public final class SplitConfigurationOptions { dividerWidthPercent = visualDividerBounds.width() / totalWidth; dividerHeightPercent = visualDividerBounds.height() / totalHeight; } + + @Override + public String toString() { + return "LeftTop: " + leftTopBounds + ", taskId: " + leftTopTaskId + "\n" + + "RightBottom: " + rightBottomBounds + ", taskId: " + rightBottomTaskId + "\n" + + "Divider: " + visualDividerBounds + "\n" + + "AppsVertical? " + appsStackedVertically + "\n" + + "snapPosition: " + snapPosition; + } } public static class SplitStageInfo { From 544f6e228c05281bf545e7603855ccc38ed287dc Mon Sep 17 00:00:00 2001 From: Vadim Tryshev Date: Wed, 28 Feb 2024 10:26:01 -0800 Subject: [PATCH 07/13] Add TestStabilityRule so that @Stability annotation works Bug: 319923578 Test: presubmit Flag: N/A Change-Id: I5613a2ee658a458871ea89219764d13796d07b83 --- tests/src/com/android/launcher3/model/FolderIconLoadTest.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/src/com/android/launcher3/model/FolderIconLoadTest.kt b/tests/src/com/android/launcher3/model/FolderIconLoadTest.kt index 34c41a6873..2118ed6721 100644 --- a/tests/src/com/android/launcher3/model/FolderIconLoadTest.kt +++ b/tests/src/com/android/launcher3/model/FolderIconLoadTest.kt @@ -30,6 +30,7 @@ import com.google.common.truth.Truth.assertWithMessage import java.util.concurrent.CountDownLatch import org.junit.After import org.junit.Before +import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith @@ -57,6 +58,8 @@ class FolderIconLoadTest { TEST_ACTIVITY14 ) + @get:Rule(order = 0) val testStabilityRule = TestStabilityRule() + @Before fun setUp() { modelHelper = LauncherModelHelper() From 872b9f9a6108a59acafdbfe85b1e6917221f929a Mon Sep 17 00:00:00 2001 From: Sukesh Ram Date: Tue, 27 Feb 2024 23:38:32 +0000 Subject: [PATCH 08/13] Debugging Logs for TaplDragTest#testDragAppIconToMultipleWorkspaceCells Add logging for TaplDragTest#testDragAppIconToMultipleWorkspaceCells. Flag: NONE Test: Manually tested in pixel 7. Bug: 326908466 Change-Id: Icb3262d6af66c9b947cb0cc92c1c67556fba315f --- .../testing/shared/TestProtocol.java | 1 + .../com/android/launcher3/tapl/AppIcon.java | 7 ++++++- .../android/launcher3/tapl/Launchable.java | 14 +++++++++---- .../tapl/LauncherInstrumentation.java | 20 ++++++++++++++++++- .../com/android/launcher3/tapl/Workspace.java | 3 +++ .../launcher3/tapl/WorkspaceDragSource.java | 6 ++++++ .../launcher3/dragging/TaplDragTest.java | 6 ++++++ 7 files changed, 51 insertions(+), 6 deletions(-) diff --git a/tests/multivalentTests/shared/com/android/launcher3/testing/shared/TestProtocol.java b/tests/multivalentTests/shared/com/android/launcher3/testing/shared/TestProtocol.java index 623f9f264c..afda3a3aed 100644 --- a/tests/multivalentTests/shared/com/android/launcher3/testing/shared/TestProtocol.java +++ b/tests/multivalentTests/shared/com/android/launcher3/testing/shared/TestProtocol.java @@ -175,6 +175,7 @@ public final class TestProtocol { public static final String ACTIVITY_NOT_RESUMED_AFTER_BACK = "b/322823209"; public static final String GET_FROM_RECENTS_FAILURE = "b/321775748"; public static final String SUCCESSFUL_GESTURE_MISMATCH_EVENTS = "b/324940434"; + public static final String TEST_DRAG_APP_ICON_TO_MULTIPLE_WORKSPACES_FAILURE = "b/326908466"; public static final String TEST_TAPL_OVERVIEW_ACTIONS_MENU_FAILURE = "b/326073471"; public static final String REQUEST_EMULATE_DISPLAY = "emulate-display"; diff --git a/tests/multivalentTests/tapl/com/android/launcher3/tapl/AppIcon.java b/tests/multivalentTests/tapl/com/android/launcher3/tapl/AppIcon.java index 156568b0f4..7c6d684e66 100644 --- a/tests/multivalentTests/tapl/com/android/launcher3/tapl/AppIcon.java +++ b/tests/multivalentTests/tapl/com/android/launcher3/tapl/AppIcon.java @@ -16,6 +16,9 @@ package com.android.launcher3.tapl; +import static com.android.launcher3.testing.shared.TestProtocol.TEST_DRAG_APP_ICON_TO_MULTIPLE_WORKSPACES_FAILURE; + +import android.util.Log; import android.widget.TextView; import androidx.annotation.NonNull; @@ -49,7 +52,7 @@ public abstract class AppIcon extends Launchable { /** * Find an app icon with the given name. * - * @param appName app icon to look for + * @param appName app icon to look for * @param launcher (optional) - only match ui elements from Launcher's package */ static BySelector getAppIconSelector(String appName, LauncherInstrumentation launcher) { @@ -95,6 +98,8 @@ public abstract class AppIcon extends Launchable { @Override protected void waitForLongPressConfirmation() { + Log.d(TEST_DRAG_APP_ICON_TO_MULTIPLE_WORKSPACES_FAILURE, + "AppIcon.waitForLongPressConfirmation, resName: popupContainer"); mLauncher.waitForLauncherObject("popup_container"); } diff --git a/tests/multivalentTests/tapl/com/android/launcher3/tapl/Launchable.java b/tests/multivalentTests/tapl/com/android/launcher3/tapl/Launchable.java index ed47334577..9d3bc6e952 100644 --- a/tests/multivalentTests/tapl/com/android/launcher3/tapl/Launchable.java +++ b/tests/multivalentTests/tapl/com/android/launcher3/tapl/Launchable.java @@ -17,8 +17,10 @@ package com.android.launcher3.tapl; import static com.android.launcher3.testing.shared.TestProtocol.SPRING_LOADED_STATE_ORDINAL; +import static com.android.launcher3.testing.shared.TestProtocol.TEST_DRAG_APP_ICON_TO_MULTIPLE_WORKSPACES_FAILURE; import android.graphics.Point; +import android.util.Log; import android.view.MotionEvent; import androidx.test.uiautomator.UiObject2; @@ -113,11 +115,15 @@ public abstract class Launchable { iconCenter.y - getStartDragThreshold()); if (runToSpringLoadedState) { + Log.d(TEST_DRAG_APP_ICON_TO_MULTIPLE_WORKSPACES_FAILURE, + "Launchable.startDrag: actionName: long-pressing and triggering drag start" + + " iconCenter: " + iconCenter + " dragStartCenter: " + + dragStartCenter); mLauncher.runToState(() -> movePointerForStartDrag( - downTime, - iconCenter, - dragStartCenter, - expectLongClickEvents), + downTime, + iconCenter, + dragStartCenter, + expectLongClickEvents), SPRING_LOADED_STATE_ORDINAL, "long-pressing and triggering drag start"); } else { movePointerForStartDrag( diff --git a/tests/multivalentTests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/multivalentTests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java index b15ed91dd3..053b360645 100644 --- a/tests/multivalentTests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +++ b/tests/multivalentTests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java @@ -31,6 +31,7 @@ import static com.android.launcher3.testing.shared.TestProtocol.NORMAL_STATE_ORD import static com.android.launcher3.testing.shared.TestProtocol.REQUEST_GET_SPLIT_SELECTION_ACTIVE; import static com.android.launcher3.testing.shared.TestProtocol.REQUEST_NUM_ALL_APPS_COLUMNS; import static com.android.launcher3.testing.shared.TestProtocol.SUCCESSFUL_GESTURE_MISMATCH_EVENTS; +import static com.android.launcher3.testing.shared.TestProtocol.TEST_DRAG_APP_ICON_TO_MULTIPLE_WORKSPACES_FAILURE; import static com.android.launcher3.testing.shared.TestProtocol.TEST_INFO_RESPONSE_FIELD; import static com.android.launcher3.testing.shared.TestProtocol.testLogD; @@ -1165,7 +1166,11 @@ public final class LauncherInstrumentation { log("Hierarchy before clicking home:"); dumpViewHierarchy(); action = "clicking home button"; - + Log.d(TEST_DRAG_APP_ICON_TO_MULTIPLE_WORKSPACES_FAILURE, + "LauncherInstrumentation.goHome: isThreeFingerTrackpadGesture: " + + isThreeFingerTrackpadGesture + + "getNavigationModel() == NavigationModel.ZERO_BUTTON: " + ( + getNavigationModel() == NavigationModel.ZERO_BUTTON)); runToState( getHomeButton()::click, NORMAL_STATE_ORDINAL, @@ -1512,6 +1517,8 @@ public final class LauncherInstrumentation { @NonNull UiObject2 waitForLauncherObject(String resName) { + Log.d(TEST_DRAG_APP_ICON_TO_MULTIPLE_WORKSPACES_FAILURE, + "LauncherInstrumentation.waitForLauncherObject"); return waitForObjectBySelector(getLauncherObjectSelector(resName)); } @@ -1541,12 +1548,16 @@ public final class LauncherInstrumentation { @NonNull List waitForObjectsBySelector(BySelector selector) { + Log.d(TEST_DRAG_APP_ICON_TO_MULTIPLE_WORKSPACES_FAILURE, + "LauncherInstrumentation.waitForObjectsBySelector"); final List objects = mDevice.wait(Until.findObjects(selector), WAIT_TIME_MS); assertNotNull("Can't find any view in Launcher, selector: " + selector, objects); return objects; } private UiObject2 waitForObjectBySelector(BySelector selector) { + Log.d(TEST_DRAG_APP_ICON_TO_MULTIPLE_WORKSPACES_FAILURE, + "LauncherInstrumentation.waitForObjectBySelector"); final UiObject2 object = mDevice.wait(Until.findObject(selector), WAIT_TIME_MS); assertNotNull("Can't find a view in Launcher, selector: " + selector, object); return object; @@ -1589,6 +1600,9 @@ public final class LauncherInstrumentation { void runToState(Runnable command, int expectedState, boolean requireEvent, String actionName) { if (requireEvent) { + Log.d(TEST_DRAG_APP_ICON_TO_MULTIPLE_WORKSPACES_FAILURE, + "LauncherInstrumentation.runToState: command: " + command + " expectedState: " + + expectedState + " actionName: " + actionName + "requireEvent: true"); runToState(command, expectedState, actionName); } else { command.run(); @@ -1966,11 +1980,15 @@ public final class LauncherInstrumentation { mPointerCount = 1; pointerCount = mPointerCount; } + Log.d(TEST_DRAG_APP_ICON_TO_MULTIPLE_WORKSPACES_FAILURE, + "LauncherInstrumentation.sendPointer: ACTION_DOWN"); break; case MotionEvent.ACTION_UP: if (hasTIS && gestureScope == GestureScope.EXPECT_PILFER) { expectEvent(TestProtocol.SEQUENCE_PILFER, EVENT_PILFER_POINTERS); } + Log.d(TEST_DRAG_APP_ICON_TO_MULTIPLE_WORKSPACES_FAILURE, + "LauncherInstrumentation.sendPointer: ACTION_UP"); break; case MotionEvent.ACTION_POINTER_DOWN: mPointerCount++; diff --git a/tests/multivalentTests/tapl/com/android/launcher3/tapl/Workspace.java b/tests/multivalentTests/tapl/com/android/launcher3/tapl/Workspace.java index 506e563777..4e926341b6 100644 --- a/tests/multivalentTests/tapl/com/android/launcher3/tapl/Workspace.java +++ b/tests/multivalentTests/tapl/com/android/launcher3/tapl/Workspace.java @@ -25,6 +25,7 @@ import static android.view.accessibility.AccessibilityEvent.TYPE_VIEW_SCROLLED; import static com.android.launcher3.testing.shared.TestProtocol.ALL_APPS_STATE_ORDINAL; import static com.android.launcher3.testing.shared.TestProtocol.NORMAL_STATE_ORDINAL; import static com.android.launcher3.testing.shared.TestProtocol.OVERVIEW_STATE_ORDINAL; +import static com.android.launcher3.testing.shared.TestProtocol.TEST_DRAG_APP_ICON_TO_MULTIPLE_WORKSPACES_FAILURE; import static com.android.launcher3.testing.shared.TestProtocol.UIOBJECT_STALE_ELEMENT; import static junit.framework.TestCase.assertNotNull; @@ -626,6 +627,8 @@ public final class Workspace extends Home { try (LauncherInstrumentation.Closable ignored = launcher.addContextLayer( "want to drag icon to workspace")) { final long downTime = SystemClock.uptimeMillis(); + Log.d(TEST_DRAG_APP_ICON_TO_MULTIPLE_WORKSPACES_FAILURE, + "Workspace.dragIconToWorkspace: starting drag | downtime: " + downTime); Point dragStart = launchable.startDrag( downTime, expectLongClickEvents, diff --git a/tests/multivalentTests/tapl/com/android/launcher3/tapl/WorkspaceDragSource.java b/tests/multivalentTests/tapl/com/android/launcher3/tapl/WorkspaceDragSource.java index e5a2a2ef6c..b42d43b0db 100644 --- a/tests/multivalentTests/tapl/com/android/launcher3/tapl/WorkspaceDragSource.java +++ b/tests/multivalentTests/tapl/com/android/launcher3/tapl/WorkspaceDragSource.java @@ -15,7 +15,10 @@ */ package com.android.launcher3.tapl; +import static com.android.launcher3.testing.shared.TestProtocol.TEST_DRAG_APP_ICON_TO_MULTIPLE_WORKSPACES_FAILURE; + import android.graphics.Point; +import android.util.Log; import java.util.function.Supplier; @@ -76,6 +79,9 @@ interface WorkspaceDragSource { LauncherInstrumentation.Closable c = launcher.addContextLayer( String.format("want to drag the icon to cell(%d, %d)", cellX, cellY))) { final Supplier dest = () -> Workspace.getCellCenter(launcher, cellX, cellY); + Log.d(TEST_DRAG_APP_ICON_TO_MULTIPLE_WORKSPACES_FAILURE, + "WorkspaceDragSource.dragToWorkspace: dragging icon to workspace | dest: " + + dest.get()); Workspace.dragIconToWorkspace( launcher, launchable, diff --git a/tests/src/com/android/launcher3/dragging/TaplDragTest.java b/tests/src/com/android/launcher3/dragging/TaplDragTest.java index 615f679154..d1227d8693 100644 --- a/tests/src/com/android/launcher3/dragging/TaplDragTest.java +++ b/tests/src/com/android/launcher3/dragging/TaplDragTest.java @@ -15,6 +15,7 @@ */ package com.android.launcher3.dragging; +import static com.android.launcher3.testing.shared.TestProtocol.TEST_DRAG_APP_ICON_TO_MULTIPLE_WORKSPACES_FAILURE; import static com.android.launcher3.util.TestConstants.AppNames.GMAIL_APP_NAME; import static com.android.launcher3.util.TestConstants.AppNames.MAPS_APP_NAME; import static com.android.launcher3.util.TestConstants.AppNames.PHOTOS_APP_NAME; @@ -233,6 +234,11 @@ public class TaplDragTest extends AbstractLauncherUiTest { final HomeAppIcon launcherTestAppIcon = createShortcutInCenterIfNotExist(TEST_APP_NAME); for (Point target : targets) { startTime = SystemClock.uptimeMillis(); + Log.d(TEST_DRAG_APP_ICON_TO_MULTIPLE_WORKSPACES_FAILURE, + "TaplDragTest.java.testDragAppIconToMultipleWorkspaceCells: shortcut name: " + + launcherTestAppIcon.getIconName() + + " | target cell coordinates: (" + target.x + ", " + target.y + + ") | start time: " + startTime); launcherTestAppIcon.dragToWorkspace(target.x, target.y); endTime = SystemClock.uptimeMillis(); elapsedTime = endTime - startTime; From bd528add50e69430d816bb545c4644890f0c3525 Mon Sep 17 00:00:00 2001 From: fbaron Date: Wed, 28 Feb 2024 12:07:49 -0800 Subject: [PATCH 09/13] Add ScreenRecord for workTabExists tapl test Bug: 325383911 Test: TaplWorkProfileTest#workTabExists Flag: NONE Change-Id: I83c92376b16c9b0de352a03ce297e7a9ae51123d --- tests/src/com/android/launcher3/ui/TaplWorkProfileTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/src/com/android/launcher3/ui/TaplWorkProfileTest.java b/tests/src/com/android/launcher3/ui/TaplWorkProfileTest.java index f8f5dde385..cabe8b1ed9 100644 --- a/tests/src/com/android/launcher3/ui/TaplWorkProfileTest.java +++ b/tests/src/com/android/launcher3/ui/TaplWorkProfileTest.java @@ -133,6 +133,7 @@ public class TaplWorkProfileTest extends AbstractLauncherUiTest { } @Test + @com.android.launcher3.util.rule.ScreenRecordRule.ScreenRecord // b/325383911 public void workTabExists() { assumeTrue(mWorkProfileSetupSuccessful); waitForWorkTabSetup(); From ba04c0c1dc7c1f0b1938778057f63052d3a8cc1e Mon Sep 17 00:00:00 2001 From: Saumya Prakash Date: Wed, 28 Feb 2024 00:16:29 +0000 Subject: [PATCH 10/13] Remove the tint from taskbar themed icons for dark mode. We remove the added tint to taskbar themed icons to match how they look in the hotseat on launcher home screen specifically for dark mode. Fix: 323952706 Test: Turn on themed icons and dark mode. Compare app icons in taskbar and in hotseat Flag: N/A Change-Id: I4dfe352ca17ef5537e48fcc3cff66ba4fd4f603a --- .../taskbar/TaskbarModelCallbacks.java | 11 +----- .../launcher3/taskbar/TaskbarView.java | 17 --------- .../taskbar/TaskbarViewController.java | 37 +------------------ 3 files changed, 3 insertions(+), 62 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarModelCallbacks.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarModelCallbacks.java index 7692760834..14d46d1382 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarModelCallbacks.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarModelCallbacks.java @@ -206,19 +206,12 @@ public class TaskbarModelCallbacks implements if (mDeferUpdatesForSUW) { ItemInfo[] finalHotseatItemInfos = hotseatItemInfos; - mDeferredUpdates = () -> { - updateHotseatItemsAndBackground(finalHotseatItemInfos); - }; + mDeferredUpdates = () -> mContainer.updateHotseatItems(finalHotseatItemInfos); } else { - updateHotseatItemsAndBackground(hotseatItemInfos); + mContainer.updateHotseatItems(hotseatItemInfos); } } - private void updateHotseatItemsAndBackground(ItemInfo[] hotseatItemInfos) { - mContainer.updateHotseatItems(hotseatItemInfos); - mControllers.taskbarViewController.updateIconsBackground(); - } - /** * This is used to defer UI updates after SUW builds the unstash animation. * @param defer if true, defers updates to the UI diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java index d9e23309bd..367bf6cfb2 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java @@ -52,7 +52,6 @@ import com.android.launcher3.Utilities; import com.android.launcher3.apppairs.AppPairIcon; import com.android.launcher3.folder.FolderIcon; import com.android.launcher3.folder.PreviewBackground; -import com.android.launcher3.icons.ThemedIconDrawable; import com.android.launcher3.model.data.FolderInfo; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.model.data.WorkspaceItemInfo; @@ -60,7 +59,6 @@ import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.LauncherBindableItemsContainer; import com.android.launcher3.util.Themes; import com.android.launcher3.views.ActivityContext; -import com.android.launcher3.views.DoubleShadowBubbleTextView; import com.android.launcher3.views.IconButtonView; import java.util.function.Predicate; @@ -409,21 +407,6 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar } } - /** - * Traverse all the child views and change the background of themeIcons - **/ - public void setThemedIconsBackgroundColor(int color) { - for (View icon : getIconViews()) { - if (icon instanceof DoubleShadowBubbleTextView) { - DoubleShadowBubbleTextView textView = ((DoubleShadowBubbleTextView) icon); - if (textView.getIcon() != null - && textView.getIcon() instanceof ThemedIconDrawable) { - ((ThemedIconDrawable) textView.getIcon()).changeBackgroundColor(color); - } - } - } - } - /** * Sets OnClickListener and OnLongClickListener for the given view. */ diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java index 5494853d2c..4b1963b2ba 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java @@ -45,7 +45,6 @@ import android.view.View; import android.view.animation.Interpolator; import androidx.annotation.Nullable; -import androidx.core.graphics.ColorUtils; import androidx.core.view.OneShotPreDrawListener; import com.android.app.animation.Interpolators; @@ -62,7 +61,6 @@ import com.android.launcher3.anim.PendingAnimation; import com.android.launcher3.anim.RevealOutlineAnimation; import com.android.launcher3.anim.RoundedRectRevealOutlineProvider; import com.android.launcher3.config.FeatureFlags; -import com.android.launcher3.icons.ThemedIconDrawable; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.ItemInfoMatcher; @@ -93,8 +91,6 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar public static final int ALPHA_INDEX_SMALL_SCREEN = 6; private static final int NUM_ALPHA_CHANNELS = 7; - private static final float TASKBAR_DARK_THEME_ICONS_BACKGROUND_LUMINANCE = 0.30f; - private final TaskbarActivityContext mActivity; private final TaskbarView mTaskbarView; private final MultiValueAlpha mTaskbarIconAlpha; @@ -125,12 +121,6 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar private int mTaskbarBottomMargin; private final int mStashedHandleHeight; - private final int mLauncherThemedIconsBackgroundColor; - private final int mTaskbarThemedIconsBackgroundColor; - - /** Progress from {@code 0} for Launcher's color to {@code 1} for Taskbar's color. */ - private final AnimatedFloat mThemedIconsBackgroundProgress = new AnimatedFloat( - this::updateIconsBackground); private final TaskbarModelCallbacks mModelCallbacks; @@ -173,16 +163,7 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar mTaskbarBottomMargin = activity.getDeviceProfile().taskbarBottomMargin; mStashedHandleHeight = activity.getResources() .getDimensionPixelSize(R.dimen.taskbar_stashed_handle_height); - mLauncherThemedIconsBackgroundColor = ThemedIconDrawable.getColors(mActivity)[0]; - if (!Utilities.isDarkTheme(mActivity)) { - mTaskbarThemedIconsBackgroundColor = mLauncherThemedIconsBackgroundColor; - } else { - // Increase luminance for dark themed icons given they are on a dark Taskbar background. - float[] colorHSL = new float[3]; - ColorUtils.colorToHSL(mLauncherThemedIconsBackgroundColor, colorHSL); - colorHSL[2] = TASKBAR_DARK_THEME_ICONS_BACKGROUND_LUMINANCE; - mTaskbarThemedIconsBackgroundColor = ColorUtils.HSLToColor(colorHSL); - } + mIsRtl = Utilities.isRtl(mTaskbarView.getResources()); mTaskbarLeftRightMargin = mActivity.getResources().getDimensionPixelSize( R.dimen.transient_taskbar_padding); @@ -470,18 +451,6 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar return taskbarIconTranslationYForPinningValue; } - /** - * Updates the Taskbar's themed icons background according to the progress between in-app/home. - */ - protected void updateIconsBackground() { - mTaskbarView.setThemedIconsBackgroundColor( - ColorUtils.blendARGB( - mLauncherThemedIconsBackgroundColor, - mTaskbarThemedIconsBackgroundColor, - mThemedIconsBackgroundProgress.value - )); - } - private ValueAnimator createRevealAnimForView(View view, boolean isStashed, float newWidth, boolean isQsb, boolean dispatchOnAnimationStart) { Rect viewBounds = new Rect(0, 0, view.getWidth(), view.getHeight()); @@ -679,10 +648,6 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar setter.setFloat(mTaskbarNavButtonTranslationY, VALUE, -offsetY, interpolator); setter.setFloat(mTaskbarNavButtonTranslationYForInAppDisplay, VALUE, offsetY, interpolator); - if (Utilities.isDarkTheme(mTaskbarView.getContext())) { - setter.addFloat(mThemedIconsBackgroundProgress, VALUE, 1f, 0f, LINEAR); - } - int collapsedHeight = mActivity.getDefaultTaskbarWindowSize(); int expandedHeight = Math.max(collapsedHeight, taskbarDp.taskbarHeight + offsetY); setter.addOnFrameListener(anim -> mActivity.setTaskbarWindowSize( From bf885ceb5f81bb01e15cbf61e96d7d0cf0fda1a3 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Sat, 17 Feb 2024 00:26:48 +0000 Subject: [PATCH 11/13] Call showCurrentTask again if applyLoadPlan doesn't include running task Test: swipe up from an app that has excludeFromRecents=true, e.g. Volume Dialog, Home quick settings tile, and Routines widget; ensure the gesture works as expected (e.g. can quick switch, go home, or to overview with all tasks visible). Flag: none Fixes: 324495241 Change-Id: If3b61f7d1725ee573fad38140bfeb77f3a6cea1e --- .../android/quickstep/views/RecentsView.java | 36 ++++++++++++++----- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 7bfa5eddd1..ea33b4d195 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -493,9 +493,10 @@ public abstract class RecentsView= 0; i--) { + if (i == stubRunningTaskIndex) { + continue; + } removeView(requireTaskViewAt(i)); } - if (indexOfChild(mClearAllButton) != -1) { + if (getTaskViewCount() == 0 && indexOfChild(mClearAllButton) != -1) { removeView(mClearAllButton); } } @@ -2375,7 +2391,7 @@ public abstract class RecentsView Date: Wed, 28 Feb 2024 18:56:31 -0800 Subject: [PATCH 12/13] Update app pair error strings with UXW-approved ones Fixes: 327432662 Flag: ACONFIG com.android.wm.shell.enable_app_pairs TRUNKFOOD Test: N/A Change-Id: Ie437a67be7029da404dbb2c8f326a2140ac36138 --- res/values/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index fa7057f19d..ddbbfa0f1b 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -47,9 +47,9 @@ %1$s | %2$s - This pair isn\'t supported at this screen size + This app pair isn\'t supported on this device - Unfold your device to use this pair + Unfold device to use this app pair From 41d8ae8a7a570cc87d8b7855684f94837a15f7cb Mon Sep 17 00:00:00 2001 From: Jeremy Sim Date: Thu, 22 Feb 2024 23:51:31 +0000 Subject: [PATCH 13/13] Implements the "Save App Pair" button in Overview Actions Second attempt at enabling this feature. See ag/25143701, linked bugs, and revert history for details. This patch is tested with mokey devices and does not crash! This patch includes: - Ability to "save app pair" from Overview Actions. - Internally the actions bar is not longer hidden for GroupedTasks; instead the individual buttons for "Select", "Screenshot", and "Split screen" are toggled off and "Save app pair" is toggled on. - "Save app pair" option does not appear in icon menu when it is visible in the Actions Bar. - Addition to go/quickstep/res/layout/overview_actions_container.xml to support addition of the new button. Note: This patch introduces a slight regression where users are now able to long-press to select text on task 1 of a paired GroupedTaskView (previously we did not let them select text on either task for consistency.) Will follow up with a fix -- see bug for details. Flag: ACONFIG com.android.wm.shell.enable_app_pairs TRUNKFOOD Fixes: 315545418 Fixes: 315292030 Test: Manual, all action buttons still work and "Save app pair" appears and disappears correctly Change-Id: I4b4ac525cfd5eb9cfcd757d0bffc7215b04f9a3d --- .../res/layout/overview_actions_container.xml | 10 ++ .../res/layout/overview_actions_container.xml | 9 ++ quickstep/res/values/strings.xml | 2 + .../android/quickstep/TaskOverlayFactory.java | 16 ++- .../quickstep/TaskShortcutFactory.java | 14 +- .../quickstep/views/GroupedTaskView.java | 11 +- .../quickstep/views/OverviewActionsView.java | 129 +++++++++++++----- .../android/quickstep/views/RecentsView.java | 22 +-- .../testing/TestInformationHandler.java | 6 + .../testing/shared/TestProtocol.java | 1 + .../android/launcher3/tapl/BaseOverview.java | 7 +- .../tapl/LauncherInstrumentation.java | 4 + 12 files changed, 181 insertions(+), 50 deletions(-) diff --git a/go/quickstep/res/layout/overview_actions_container.xml b/go/quickstep/res/layout/overview_actions_container.xml index 48650aac20..077cfaee19 100644 --- a/go/quickstep/res/layout/overview_actions_container.xml +++ b/go/quickstep/res/layout/overview_actions_container.xml @@ -120,6 +120,16 @@ android:layout_height="1dp" android:layout_weight="1" android:visibility="gone" /> + +