From 7b3eb35e8e8e2abe3ccc719384a28489895a8209 Mon Sep 17 00:00:00 2001 From: Vishnu Nair Date: Thu, 1 Dec 2022 17:21:15 -0800 Subject: [PATCH 1/6] Launcher: Add WAKEUP_SURFACE_FLINGER permission Allow launcher to use eEarlyWakeupStart & eEarlyWakeupEnd flags to hint SF to wake up earlier for expensive composition. Test: presubmit Fixes: 261103978 Change-Id: I44ce200a8c8f0dddc597082f0a1b6053c974dece --- AndroidManifest-common.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/AndroidManifest-common.xml b/AndroidManifest-common.xml index 951be4e54e..12daa5993f 100644 --- a/AndroidManifest-common.xml +++ b/AndroidManifest-common.xml @@ -42,6 +42,7 @@ + From 196d55aa77ea7a092d7c11af72f5f1d35abb616b Mon Sep 17 00:00:00 2001 From: Holly Sun Date: Thu, 8 Dec 2022 14:05:37 -0800 Subject: [PATCH 2/6] [QL-v2] Reset input state on scroll and restore state on scrolling back. Bug: 261872461 Test: see video in bug Change-Id: I18e1923bdd4c40e84e46579296b69268d46c9fa1 --- .../android/launcher3/ExtendedEditText.java | 10 ++++++++ .../allapps/LauncherAllAppsContainerView.java | 23 ++++++++++++++----- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/com/android/launcher3/ExtendedEditText.java b/src/com/android/launcher3/ExtendedEditText.java index c59f25d85a..f94a3c5521 100644 --- a/src/com/android/launcher3/ExtendedEditText.java +++ b/src/com/android/launcher3/ExtendedEditText.java @@ -159,4 +159,14 @@ public class ExtendedEditText extends EditText { listener.onFocusChange(this, focused); } } + + /** + * Save the input, suggestion, hint states when it's on focus, and set to unfocused states. + */ + public void saveFocusedStateAndUpdateToUnfocusedState() {} + + /** + * Restore to the previous saved focused state. + */ + public void restoreToFocusedState() {} } diff --git a/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java b/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java index 92e29bbdf5..229d8f81e2 100644 --- a/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java @@ -41,12 +41,23 @@ public class LauncherAllAppsContainerView extends ActivityAllAppsContainerView 0) { + input.saveFocusedStateAndUpdateToUnfocusedState(); + } + + // Scroll up and scroll to top + if (dy < 0 && scrolledOffset == 0) { + // Show keyboard + boolean isImeEnabledOnSwipeUp = Launcher.getLauncher(mActivityContext) + .getSearchConfig().isImeEnabledOnSwipeUp(); + if (isImeEnabledOnSwipeUp || !TextUtils.isEmpty(input.getText())) { + input.showKeyboard(); + } + + // Restore state in input box + input.restoreToFocusedState(); } } } From be753137a2238e456da6900ba18cfbc74dfc7f7e Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Fri, 9 Dec 2022 16:46:54 +0000 Subject: [PATCH 3/6] Don't scale iconSize and textSize in non-default display size - Cells should get extra space by reducing borderSpace. If that's still not enough, use 0 borderSpace and distribute the space Fix: 256976071 Fix: 248348171 Test: manual Change-Id: I067c1aaa553d7a84caeeb9ce21e80cfaf86a3bed --- .../quickstep/HotseatWidthCalculationTest.kt | 24 +++--- src/com/android/launcher3/DeviceProfile.java | 80 ++++++++++++++++--- .../HotseatWidthCalculationTest.kt | 28 +++---- 3 files changed, 97 insertions(+), 35 deletions(-) diff --git a/quickstep/tests/src/com/android/quickstep/HotseatWidthCalculationTest.kt b/quickstep/tests/src/com/android/quickstep/HotseatWidthCalculationTest.kt index 3967f75fa6..0303bc192e 100644 --- a/quickstep/tests/src/com/android/quickstep/HotseatWidthCalculationTest.kt +++ b/quickstep/tests/src/com/android/quickstep/HotseatWidthCalculationTest.kt @@ -63,13 +63,13 @@ class HotseatWidthCalculationTest : DeviceProfileBaseTest() { assertThat(dp.hotseatBarEndOffset).isEqualTo(558) assertThat(dp.numShownHotseatIcons).isEqualTo(4) - assertThat(dp.hotseatBorderSpace).isEqualTo(76) + assertThat(dp.hotseatBorderSpace).isEqualTo(50) - assertThat(dp.getHotseatLayoutPadding(context).left).isEqualTo(122) + assertThat(dp.getHotseatLayoutPadding(context).left).isEqualTo(112) assertThat(dp.getHotseatLayoutPadding(context).right).isEqualTo(558) assertThat(dp.isQsbInline).isFalse() - assertThat(dp.hotseatQsbWidth).isEqualTo(1058) + assertThat(dp.hotseatQsbWidth).isEqualTo(1080) } /** @@ -84,13 +84,13 @@ class HotseatWidthCalculationTest : DeviceProfileBaseTest() { assertThat(dp.hotseatBarEndOffset).isEqualTo(744) assertThat(dp.numShownHotseatIcons).isEqualTo(6) - assertThat(dp.hotseatBorderSpace).isEqualTo(83) + assertThat(dp.hotseatBorderSpace).isEqualTo(82) assertThat(dp.getHotseatLayoutPadding(context).left).isEqualTo(106) assertThat(dp.getHotseatLayoutPadding(context).right).isEqualTo(744) assertThat(dp.isQsbInline).isFalse() - assertThat(dp.hotseatQsbWidth).isEqualTo(1467) + assertThat(dp.hotseatQsbWidth).isEqualTo(1468) } /** @@ -109,13 +109,13 @@ class HotseatWidthCalculationTest : DeviceProfileBaseTest() { assertThat(dp.hotseatBarEndOffset).isEqualTo(705) assertThat(dp.numShownHotseatIcons).isEqualTo(6) - assertThat(dp.hotseatBorderSpace).isEqualTo(108) + assertThat(dp.hotseatBorderSpace).isEqualTo(102) - assertThat(dp.getHotseatLayoutPadding(context).left).isEqualTo(631) + assertThat(dp.getHotseatLayoutPadding(context).left).isEqualTo(625) assertThat(dp.getHotseatLayoutPadding(context).right).isEqualTo(705) assertThat(dp.isQsbInline).isFalse() - assertThat(dp.hotseatQsbWidth).isEqualTo(1227) + assertThat(dp.hotseatQsbWidth).isEqualTo(1233) } /** @@ -132,11 +132,11 @@ class HotseatWidthCalculationTest : DeviceProfileBaseTest() { assertThat(dp.numShownHotseatIcons).isEqualTo(6) assertThat(dp.hotseatBorderSpace).isEqualTo(36) - assertThat(dp.getHotseatLayoutPadding(context).left).isEqualTo(884) + assertThat(dp.getHotseatLayoutPadding(context).left).isEqualTo(854) assertThat(dp.getHotseatLayoutPadding(context).right).isEqualTo(705) assertThat(dp.isQsbInline).isTrue() - assertThat(dp.hotseatQsbWidth).isEqualTo(559) + assertThat(dp.hotseatQsbWidth).isEqualTo(531) } /** @@ -152,9 +152,9 @@ class HotseatWidthCalculationTest : DeviceProfileBaseTest() { assertThat(dp.hotseatBarEndOffset).isEqualTo(705) assertThat(dp.numShownHotseatIcons).isEqualTo(5) - assertThat(dp.hotseatBorderSpace).isEqualTo(56) + assertThat(dp.hotseatBorderSpace).isEqualTo(43) - assertThat(dp.getHotseatLayoutPadding(context).left).isEqualTo(801) + assertThat(dp.getHotseatLayoutPadding(context).left).isEqualTo(782) assertThat(dp.getHotseatLayoutPadding(context).right).isEqualTo(705) assertThat(dp.isQsbInline).isTrue() diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index ce78fce8c0..eb016b2193 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -867,8 +867,8 @@ public class DeviceProfile { float invIconSizeDp = inv.iconSize[mTypeIndex]; float invIconTextSizeSp = inv.iconTextSize[mTypeIndex]; - iconSizePx = Math.max(1, pxFromDp(invIconSizeDp, mMetrics, iconScale)); - iconTextSizePx = (int) (pxFromSp(invIconTextSizeSp, mMetrics) * iconScale); + iconSizePx = Math.max(1, pxFromDp(invIconSizeDp, mMetrics)); + iconTextSizePx = pxFromSp(invIconTextSizeSp, mMetrics); iconDrawablePaddingPx = (int) (iconDrawablePaddingOriginalPx * iconScale); cellLayoutBorderSpacePx = getCellLayoutBorderSpace(inv, scale); @@ -876,8 +876,46 @@ public class DeviceProfile { if (isScalableGrid) { cellWidthPx = pxFromDp(inv.minCellSize[mTypeIndex].x, mMetrics, scale); cellHeightPx = pxFromDp(inv.minCellSize[mTypeIndex].y, mMetrics, scale); - int cellContentHeight = iconSizePx + iconDrawablePaddingPx - + Utilities.calculateTextHeight(iconTextSizePx); + + if (cellWidthPx < iconSizePx) { + // If cellWidth no longer fit iconSize, reduce borderSpace to make cellWidth bigger. + int numColumns = getPanelCount() * inv.numColumns; + int numBorders = numColumns - 1; + int extraWidthRequired = (iconSizePx - cellWidthPx) * numColumns; + if (cellLayoutBorderSpacePx.x * numBorders >= extraWidthRequired) { + cellWidthPx = iconSizePx; + cellLayoutBorderSpacePx.x -= extraWidthRequired / numBorders; + } else { + // If it still doesn't fit, set borderSpace to 0 and distribute the space for + // cellWidth, and reduce iconSize. + cellWidthPx = (cellWidthPx * numColumns + + cellLayoutBorderSpacePx.x * numBorders) / numColumns; + iconSizePx = Math.min(iconSizePx, cellWidthPx); + cellLayoutBorderSpacePx.x = 0; + } + } + + int cellTextAndPaddingHeight = + iconDrawablePaddingPx + Utilities.calculateTextHeight(iconTextSizePx); + int cellContentHeight = iconSizePx + cellTextAndPaddingHeight; + if (cellHeightPx < cellContentHeight) { + // If cellHeight no longer fit iconSize, reduce borderSpace to make cellHeight + // bigger. + int numBorders = inv.numRows - 1; + int extraHeightRequired = (cellContentHeight - cellHeightPx) * inv.numRows; + if (cellLayoutBorderSpacePx.y * numBorders >= extraHeightRequired) { + cellHeightPx = cellContentHeight; + cellLayoutBorderSpacePx.y -= extraHeightRequired / numBorders; + } else { + // If it still doesn't fit, set borderSpace to 0 and distribute the space for + // cellHeight, and reduce iconSize. + cellHeightPx = (cellHeightPx * inv.numRows + + cellLayoutBorderSpacePx.y * numBorders) / inv.numRows; + iconSizePx = Math.min(iconSizePx, cellHeightPx - cellTextAndPaddingHeight); + cellLayoutBorderSpacePx.y = 0; + } + cellContentHeight = iconSizePx + cellTextAndPaddingHeight; + } cellYPaddingPx = Math.max(0, cellHeightPx - cellContentHeight) / 2; desiredWorkspaceHorizontalMarginPx = (int) (desiredWorkspaceHorizontalMarginOriginalPx * scale); @@ -929,17 +967,41 @@ public class DeviceProfile { pxFromDp(inv.allAppsBorderSpaces[mTypeIndex].y, mMetrics, scale)); // AllApps cells don't have real space between cells, // so we add the border space to the cell height - allAppsCellHeightPx = pxFromDp(inv.allAppsCellSize[mTypeIndex].y, mMetrics, scale) + allAppsCellHeightPx = pxFromDp(inv.allAppsCellSize[mTypeIndex].y, mMetrics) + allAppsBorderSpacePx.y; // but width is just the cell, // the border is added in #updateAllAppsContainerWidth if (isScalableGrid) { - allAppsIconSizePx = - pxFromDp(inv.allAppsIconSize[mTypeIndex], mMetrics, scale); - allAppsIconTextSizePx = - pxFromSp(inv.allAppsIconTextSize[mTypeIndex], mMetrics, scale); + allAppsIconSizePx = pxFromDp(inv.allAppsIconSize[mTypeIndex], mMetrics); + allAppsIconTextSizePx = pxFromSp(inv.allAppsIconTextSize[mTypeIndex], mMetrics); allAppsIconDrawablePaddingPx = iconDrawablePaddingOriginalPx; allAppsCellWidthPx = pxFromDp(inv.allAppsCellSize[mTypeIndex].x, mMetrics, scale); + + if (allAppsCellWidthPx < allAppsIconSizePx) { + // If allAppsCellWidth no longer fit allAppsIconSize, reduce allAppsBorderSpace to + // make allAppsCellWidth bigger. + int numBorders = inv.numAllAppsColumns - 1; + int extraWidthRequired = + (allAppsIconSizePx - allAppsCellWidthPx) * inv.numAllAppsColumns; + if (allAppsBorderSpacePx.x * numBorders >= extraWidthRequired) { + allAppsCellWidthPx = allAppsIconSizePx; + allAppsBorderSpacePx.x -= extraWidthRequired / numBorders; + } else { + // If it still doesn't fit, set allAppsBorderSpace to 0 and distribute the space + // for allAppsCellWidth, and reduce allAppsIconSize. + allAppsCellWidthPx = (allAppsCellWidthPx * inv.numAllAppsColumns + + allAppsBorderSpacePx.x * numBorders) / inv.numAllAppsColumns; + allAppsIconSizePx = Math.min(allAppsIconSizePx, allAppsCellWidthPx); + allAppsBorderSpacePx.x = 0; + } + } + + int cellContentHeight = allAppsIconSizePx + + Utilities.calculateTextHeight(allAppsIconTextSizePx) + allAppsBorderSpacePx.y; + if (allAppsCellHeightPx < cellContentHeight) { + // Increase allAppsCellHeight to fit its content. + allAppsCellHeightPx = cellContentHeight; + } } else { float invIconSizeDp = inv.allAppsIconSize[mTypeIndex]; float invIconTextSizeSp = inv.allAppsIconTextSize[mTypeIndex]; diff --git a/tests/src/com/android/launcher3/nonquickstep/HotseatWidthCalculationTest.kt b/tests/src/com/android/launcher3/nonquickstep/HotseatWidthCalculationTest.kt index 55520e8ade..c99ad7604a 100644 --- a/tests/src/com/android/launcher3/nonquickstep/HotseatWidthCalculationTest.kt +++ b/tests/src/com/android/launcher3/nonquickstep/HotseatWidthCalculationTest.kt @@ -63,13 +63,13 @@ class HotseatWidthCalculationTest : DeviceProfileBaseTest() { assertThat(dp.hotseatBarEndOffset).isEqualTo(0) assertThat(dp.numShownHotseatIcons).isEqualTo(6) - assertThat(dp.hotseatBorderSpace).isEqualTo(94) + assertThat(dp.hotseatBorderSpace).isEqualTo(72) - assertThat(dp.getHotseatLayoutPadding(context).left).isEqualTo(121) - assertThat(dp.getHotseatLayoutPadding(context).right).isEqualTo(121) + assertThat(dp.getHotseatLayoutPadding(context).left).isEqualTo(110) + assertThat(dp.getHotseatLayoutPadding(context).right).isEqualTo(110) assertThat(dp.isQsbInline).isFalse() - assertThat(dp.hotseatQsbWidth).isEqualTo(1058) + assertThat(dp.hotseatQsbWidth).isEqualTo(1080) } /** @@ -84,13 +84,13 @@ class HotseatWidthCalculationTest : DeviceProfileBaseTest() { assertThat(dp.hotseatBarEndOffset).isEqualTo(0) assertThat(dp.numShownHotseatIcons).isEqualTo(6) - assertThat(dp.hotseatBorderSpace).isEqualTo(105) + assertThat(dp.hotseatBorderSpace).isEqualTo(104) assertThat(dp.getHotseatLayoutPadding(context).left).isEqualTo(370) assertThat(dp.getHotseatLayoutPadding(context).right).isEqualTo(370) assertThat(dp.isQsbInline).isFalse() - assertThat(dp.hotseatQsbWidth).isEqualTo(1467) + assertThat(dp.hotseatQsbWidth).isEqualTo(1468) } /** @@ -130,13 +130,13 @@ class HotseatWidthCalculationTest : DeviceProfileBaseTest() { assertThat(dp.hotseatBarEndOffset).isEqualTo(0) assertThat(dp.numShownHotseatIcons).isEqualTo(6) - assertThat(dp.hotseatBorderSpace).isEqualTo(96) + assertThat(dp.hotseatBorderSpace).isEqualTo(91) - assertThat(dp.getHotseatLayoutPadding(context).left).isEqualTo(643) - assertThat(dp.getHotseatLayoutPadding(context).right).isEqualTo(643) + assertThat(dp.getHotseatLayoutPadding(context).left).isEqualTo(640) + assertThat(dp.getHotseatLayoutPadding(context).right).isEqualTo(640) assertThat(dp.isQsbInline).isFalse() - assertThat(dp.hotseatQsbWidth).isEqualTo(1174) + assertThat(dp.hotseatQsbWidth).isEqualTo(1179) } /** @@ -152,12 +152,12 @@ class HotseatWidthCalculationTest : DeviceProfileBaseTest() { assertThat(dp.hotseatBarEndOffset).isEqualTo(0) assertThat(dp.numShownHotseatIcons).isEqualTo(6) - assertThat(dp.hotseatBorderSpace).isEqualTo(89) + assertThat(dp.hotseatBorderSpace).isEqualTo(75) - assertThat(dp.getHotseatLayoutPadding(context).left).isEqualTo(589) - assertThat(dp.getHotseatLayoutPadding(context).right).isEqualTo(589) + assertThat(dp.getHotseatLayoutPadding(context).left).isEqualTo(582) + assertThat(dp.getHotseatLayoutPadding(context).right).isEqualTo(582) assertThat(dp.isQsbInline).isFalse() - assertThat(dp.hotseatQsbWidth).isEqualTo(1081) + assertThat(dp.hotseatQsbWidth).isEqualTo(1095) } } From 2a2f1b6cd39e05c96d12224f89c1321e634b2e53 Mon Sep 17 00:00:00 2001 From: Brian Isganitis Date: Mon, 12 Dec 2022 16:23:22 -0500 Subject: [PATCH 4/6] Polish all apps taskbar unstash behavior for transient and persistent. - During gestures from taskbar all apps, unstash immediately in transient. - Overlay closes sooner if all apps is open (still done later for EDU). - Taskbar stashes in overview when All Apps is opened. - Transient app-window threshold is ignored if All Apps is opened. Test: Manual Fix: 262076812 Change-Id: I46b2dcdc75ee0cc15c1b47da2139ff8c20cf618a --- .../taskbar/TaskbarActivityContext.java | 5 +++++ .../launcher3/taskbar/TaskbarUIController.java | 12 ++++++++++-- .../allapps/TaskbarAllAppsController.java | 16 +++++++++++----- .../allapps/TaskbarAllAppsViewController.java | 17 +++++++---------- .../android/quickstep/AbsSwipeUpHandler.java | 6 ++++-- .../TaskbarStashInputConsumer.java | 5 ++++- 6 files changed, 41 insertions(+), 20 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index 83b8d83044..e944480ecc 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -887,6 +887,11 @@ public class TaskbarActivityContext extends BaseTaskbarContext { return mControllers.taskbarStashController.isStashed(); } + /** Returns {@code true} if taskbar All Apps is open. */ + public boolean isTaskbarAllAppsOpen() { + return mControllers.taskbarAllAppsController.isOpen(); + } + /** * Called to start the taskbar translation spring to its settled translation (0). */ diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java index b3b53c2732..7a47f299b1 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java @@ -85,7 +85,8 @@ public class TaskbarUIController { * Manually closes the overlay window. */ public void hideOverlayWindow() { - if (!DisplayController.isTransientTaskbar(mControllers.taskbarActivityContext)) { + if (!DisplayController.isTransientTaskbar(mControllers.taskbarActivityContext) + || mControllers.taskbarAllAppsController.isOpen()) { mControllers.taskbarOverlayController.hideWindow(); } } @@ -102,12 +103,19 @@ public class TaskbarUIController { } /** - * Returns true iff taskbar is stashed. + * Returns {@code true} iff taskbar is stashed. */ public boolean isTaskbarStashed() { return mControllers.taskbarStashController.isStashed(); } + /** + * Returns {@code true} iff taskbar All Apps is open. + */ + public boolean isTaskbarAllAppsOpen() { + return mControllers.taskbarAllAppsController.isOpen(); + } + /** * Called at the end of the swipe gesture on Transient taskbar. */ diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java index 4dc8d47f05..7a34869e2a 100644 --- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java +++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java @@ -42,6 +42,7 @@ import java.util.List; public final class TaskbarAllAppsController { private TaskbarControllers mControllers; + private @Nullable TaskbarAllAppsSlideInView mSlideInView; private @Nullable TaskbarAllAppsContainerView mAppsView; // Application data models. @@ -107,6 +108,11 @@ public final class TaskbarAllAppsController { show(true); } + /** Returns {@code true} if All Apps is open. */ + public boolean isOpen() { + return mSlideInView != null && mSlideInView.isOpen(); + } + private void show(boolean animate) { if (mAppsView != null) { return; @@ -117,15 +123,15 @@ public final class TaskbarAllAppsController { TaskbarOverlayContext overlayContext = mControllers.taskbarOverlayController.requestWindow(); - TaskbarAllAppsSlideInView slideInView = - (TaskbarAllAppsSlideInView) overlayContext.getLayoutInflater().inflate( - R.layout.taskbar_all_apps, overlayContext.getDragLayer(), false); - slideInView.addOnCloseListener(() -> { + mSlideInView = (TaskbarAllAppsSlideInView) overlayContext.getLayoutInflater().inflate( + R.layout.taskbar_all_apps, overlayContext.getDragLayer(), false); + mSlideInView.addOnCloseListener(() -> { mControllers.getSharedState().allAppsVisible = false; + mSlideInView = null; mAppsView = null; }); TaskbarAllAppsViewController viewController = new TaskbarAllAppsViewController( - overlayContext, slideInView, mControllers); + overlayContext, mSlideInView, mControllers); viewController.show(animate); mAppsView = overlayContext.getAppsView(); diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsViewController.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsViewController.java index 721f81656a..7a3b3e8c7b 100644 --- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsViewController.java @@ -15,8 +15,6 @@ */ package com.android.launcher3.taskbar.allapps; -import static com.android.launcher3.LauncherState.ALL_APPS; -import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_STASHED_IN_APP_AUTO; import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_STASHED_IN_TASKBAR_ALL_APPS; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import static com.android.launcher3.util.OnboardingPrefs.ALL_APPS_VISITED_COUNT; @@ -90,20 +88,19 @@ final class TaskbarAllAppsViewController { } private void setUpTaskbarStashing() { - mTaskbarStashController.updateStateForFlag( - DisplayController.isTransientTaskbar(mContext) - ? FLAG_STASHED_IN_APP_AUTO - : FLAG_STASHED_IN_TASKBAR_ALL_APPS, - true); - mTaskbarStashController.applyState( - ALL_APPS.getTransitionDuration(mContext, true /* isToState */)); + mTaskbarStashController.updateStateForFlag(FLAG_STASHED_IN_TASKBAR_ALL_APPS, true); + mTaskbarStashController.applyState(mOverlayController.getOpenDuration()); mNavbarButtonsViewController.setSlideInViewVisible(true); mSlideInView.setOnCloseBeginListener(() -> { mNavbarButtonsViewController.setSlideInViewVisible(false); AbstractFloatingView.closeOpenContainer( mContext, AbstractFloatingView.TYPE_ACTION_POPUP); - if (!DisplayController.isTransientTaskbar(mContext)) { + + if (DisplayController.isTransientTaskbar(mContext)) { + mTaskbarStashController.updateStateForFlag(FLAG_STASHED_IN_TASKBAR_ALL_APPS, false); + mTaskbarStashController.applyState(mOverlayController.getCloseDuration()); + } else { // Post in case view is closing due to gesture navigation. If a gesture is in // progress, wait to unstash until after the gesture is finished. MAIN_EXECUTOR.post(() -> mTaskbarStashController.resetFlagIfNoGestureInProgress( diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index 3d8ffc418a..34237284a8 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -318,7 +318,8 @@ public abstract class AbsSwipeUpHandler, private final int mTaskbarAppWindowThreshold; private final int mTaskbarHomeOverviewThreshold; private final int mTaskbarCatchUpThreshold; - private boolean mTaskbarAlreadyOpen; + private final boolean mTaskbarAlreadyOpen; + private final boolean mIsTaskbarAllAppsOpen; private final boolean mIsTransientTaskbar; // May be set to false when mIsTransientTaskbar is true. private boolean mCanSlowSwipeGoHome = true; @@ -359,6 +360,7 @@ public abstract class AbsSwipeUpHandler, && DisplayController.isTransientTaskbar(mActivity); TaskbarUIController controller = mActivityInterface.getTaskbarController(); mTaskbarAlreadyOpen = controller != null && !controller.isTaskbarStashed(); + mIsTaskbarAllAppsOpen = controller != null && controller.isTaskbarAllAppsOpen(); mTaskbarAppWindowThreshold = res .getDimensionPixelSize(ENABLE_TASKBAR_REVISED_THRESHOLDS.get() ? R.dimen.taskbar_app_window_threshold_v2 @@ -2264,7 +2266,7 @@ public abstract class AbsSwipeUpHandler, return displacement; } - if (mTaskbarAlreadyOpen) { + if (mTaskbarAlreadyOpen || mIsTaskbarAllAppsOpen) { return displacement; } diff --git a/quickstep/src/com/android/quickstep/inputconsumers/TaskbarStashInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/TaskbarStashInputConsumer.java index c8326c4189..9f59c76fff 100644 --- a/quickstep/src/com/android/quickstep/inputconsumers/TaskbarStashInputConsumer.java +++ b/quickstep/src/com/android/quickstep/inputconsumers/TaskbarStashInputConsumer.java @@ -56,6 +56,7 @@ public class TaskbarStashInputConsumer extends DelegateInputConsumer { private final int mTaskbarNavThresholdY; private final int mTaskbarAppWindowThresholdY; private final boolean mTaskbarAlreadyOpen; + private final boolean mIsTaskbarAllAppsOpen; private boolean mHasPassedTaskbarNavThreshold; private boolean mHasPassedTaskbarAppWindowThreshold; @@ -88,6 +89,8 @@ public class TaskbarStashInputConsumer extends DelegateInputConsumer { mTaskbarAppWindowThresholdY = screenHeight - taskbarAppWindowThreshold; mTaskbarAlreadyOpen = mTaskbarActivityContext != null && !mTaskbarActivityContext.isTaskbarStashed(); + mIsTaskbarAllAppsOpen = + mTaskbarActivityContext != null && mTaskbarActivityContext.isTaskbarAllAppsOpen(); mIsTransientTaskbar = DisplayController.isTransientTaskbar(context); @@ -184,7 +187,7 @@ public class TaskbarStashInputConsumer extends DelegateInputConsumer { if (dY < 0) { dY = -OverScroll.dampedScroll(-dY, mTaskbarNavThresholdY); - if (mTransitionCallback != null) { + if (mTransitionCallback != null && !mIsTaskbarAllAppsOpen) { mTransitionCallback.onActionMove(dY); } } From 47da4167ea5d6a95afa9239db797c95ce9b679ff Mon Sep 17 00:00:00 2001 From: Brian Isganitis Date: Tue, 13 Dec 2022 16:43:36 -0500 Subject: [PATCH 5/6] Assign taskbar EDU same interpolator as all apps. This polishes closing both at the same time when they are on top of each other. Test: Manual Bug: 217261955 Change-Id: Iecb8658b98debb0225d3b59da99ecb34d008971a --- .../com/android/launcher3/taskbar/TaskbarEduView.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarEduView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarEduView.java index d38c6d1d4d..5702b6bb5c 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarEduView.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarEduView.java @@ -15,7 +15,7 @@ */ package com.android.launcher3.taskbar; -import static com.android.launcher3.anim.Interpolators.AGGRESSIVE_EASE; +import static com.android.launcher3.anim.Interpolators.EMPHASIZED; import android.animation.PropertyValuesHolder; import android.content.Context; @@ -24,6 +24,7 @@ import android.provider.Settings; import android.util.AttributeSet; import android.util.Pair; import android.view.View; +import android.view.animation.Interpolator; import android.widget.Button; import com.android.launcher3.Insettable; @@ -65,6 +66,11 @@ public class TaskbarEduView extends AbstractSlideInView handleClose(animate, mTaskbarEduCallbacks.getCloseDuration()); } + @Override + protected Interpolator getIdleInterpolator() { + return EMPHASIZED; + } + @Override protected boolean isOfType(int type) { return (type & TYPE_TASKBAR_EDUCATION_DIALOG) != 0; @@ -157,7 +163,7 @@ public class TaskbarEduView extends AbstractSlideInView mIsOpen = true; mOpenCloseAnimator.setValues( PropertyValuesHolder.ofFloat(TRANSLATION_SHIFT, TRANSLATION_SHIFT_OPENED)); - mOpenCloseAnimator.setInterpolator(AGGRESSIVE_EASE); + mOpenCloseAnimator.setInterpolator(EMPHASIZED); mOpenCloseAnimator.setDuration(mTaskbarEduCallbacks.getOpenDuration()).start(); } From e7417ce2aed563adab70967074064612153fc46f Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Tue, 13 Dec 2022 10:22:49 -0800 Subject: [PATCH 6/6] Taskbar All Apps button visual updates - Moved to new position - Using 3x3 icon - New Colors Checked with visd that this half is good to go, will follow up with positioning of the 3x3 icon within its container. Bug: 259712417 Test: manual, LTR/RTL modes, transient/persisent models Change-Id: I298b6dbca004cdb8920e6533fffc8ca83e0197f9 --- .../res/layout/taskbar_all_apps_button.xml | 2 +- .../launcher3/taskbar/TaskbarView.java | 7 ++- .../taskbar/TaskbarViewController.java | 4 +- res/drawable/ic_all_apps_button.xml | 49 +++++++++++-------- res/values-night-v31/colors.xml | 5 +- res/values-night/colors.xml | 6 +-- res/values-v31/colors.xml | 2 + res/values/colors.xml | 6 +-- 8 files changed, 42 insertions(+), 39 deletions(-) diff --git a/quickstep/res/layout/taskbar_all_apps_button.xml b/quickstep/res/layout/taskbar_all_apps_button.xml index b275305da4..79d087a8ef 100644 --- a/quickstep/res/layout/taskbar_all_apps_button.xml +++ b/quickstep/res/layout/taskbar_all_apps_button.xml @@ -18,6 +18,6 @@ android:layout_width="@dimen/taskbar_icon_touch_size" android:layout_height="@dimen/taskbar_icon_touch_size" android:contentDescription="@string/all_apps_button_label" - android:backgroundTint="@color/all_apps_button_bg_color" + android:backgroundTint="@android:color/transparent" android:icon="@drawable/ic_all_apps_button" /> diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java index c4eeca7beb..2433a3497a 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java @@ -63,6 +63,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar private final int mIconTouchSize; private final int mItemMarginLeftRight; private final int mItemPadding; + private final boolean mIsRtl; private final TaskbarActivityContext mActivityContext; @@ -100,6 +101,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar super(context, attrs, defStyleAttr, defStyleRes); mActivityContext = ActivityContext.lookupContext(context); mIconLayoutBounds = mActivityContext.getTransientTaskbarBounds(); + mIsRtl = Utilities.isRtl(getResources()); Resources resources = getResources(); mIconTouchSize = resources.getDimensionPixelSize(R.dimen.taskbar_icon_touch_size); @@ -122,6 +124,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar mAllAppsButton = LayoutInflater.from(context) .inflate(R.layout.taskbar_all_apps_button, this, false); mAllAppsButton.setPadding(mItemPadding, mItemPadding, mItemPadding, mItemPadding); + mAllAppsButton.setScaleX(mIsRtl ? -1 : 1); if (mActivityContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_PC)) { mAllAppsButton.setVisibility(GONE); } @@ -254,11 +257,11 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar } if (mAllAppsButton != null) { - int index = Utilities.isRtl(getResources()) ? 0 : getChildCount(); + int index = mIsRtl ? getChildCount() : 0; addView(mAllAppsButton, index); } if (mActivityContext.getDeviceProfile().isQsbInline) { - addView(mQsb, Utilities.isRtl(getResources()) ? getChildCount() : 0); + addView(mQsb, mIsRtl ? getChildCount() : 0); // Always set QSB to invisible after re-adding. mQsb.setVisibility(View.INVISIBLE); } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java index 5c9b51ab19..b58b6b5273 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java @@ -401,8 +401,8 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar // Note that there is no All Apps button in the hotseat, this position is only used // as its convenient for animation purposes. positionInHotseat = Utilities.isRtl(child.getResources()) - ? -1 - : taskbarDp.numShownHotseatIcons; + ? taskbarDp.numShownHotseatIcons + : -1; } else if (child.getTag() instanceof ItemInfo) { positionInHotseat = ((ItemInfo) child.getTag()).screenId; } else { diff --git a/res/drawable/ic_all_apps_button.xml b/res/drawable/ic_all_apps_button.xml index 7de390ac4a..4f0b6a8fbf 100644 --- a/res/drawable/ic_all_apps_button.xml +++ b/res/drawable/ic_all_apps_button.xml @@ -15,32 +15,41 @@ --> + android:width="29dp" + android:height="28dp" + android:viewportWidth="29" + android:viewportHeight="28"> + android:pivotY="14.5" + android:pivotX="22" + android:scaleX=".50" + android:scaleY=".50"> + android:pathData="M4 7C3.0375 7 2.215 6.65 1.5325 5.9675C0.85 5.285 0.5 4.4625 0.5 3.5C0.5 2.5375 0.85 1.715 1.5325 1.0325C2.215 0.35 3.0375 0 4 0C4.9625 0 5.785 0.35 6.4675 1.0325C7.15 1.715 7.5 2.5375 7.5 3.5C7.5 4.4625 7.15 5.285 6.4675 5.9675C5.785 6.65 4.9625 7 4 7Z" + android:fillColor="@color/all_apps_button_color"/> + android:pathData="M14.5 7C13.5375 7 12.715 6.65 12.0325 5.9675C11.35 5.285 11 4.4625 11 3.5C11 2.5375 11.35 1.715 12.0325 1.0325C12.715 0.35 13.5375 0 14.5 0C15.4625 0 16.285 0.35 16.9675 1.0325C17.65 1.715 18 2.5375 18 3.5C18 4.4625 17.65 5.285 16.9675 5.9675C16.285 6.65 15.4625 7 14.5 7Z" + android:fillColor="@color/all_apps_button_color"/> + android:pathData="M25 7C24.0375 7 23.215 6.65 22.5325 5.9675C21.85 5.285 21.5 4.4625 21.5 3.5C21.5 2.5375 21.85 1.715 22.5325 1.0325C23.215 0.35 24.0375 0 25 0C25.9625 0 26.785 0.35 27.4675 1.0325C28.15 1.715 28.5 2.5375 28.5 3.5C28.5 4.4625 28.15 5.285 27.4675 5.9675C26.785 6.65 25.9625 7 25 7Z" + android:fillColor="@color/all_apps_button_color"/> + android:pathData="M4 17.5C3.0375 17.5 2.215 17.15 1.5325 16.4675C0.85 15.785 0.5 14.9625 0.5 14C0.5 13.0375 0.85 12.215 1.5325 11.5325C2.215 10.85 3.0375 10.5 4 10.5C4.9625 10.5 5.785 10.85 6.4675 11.5325C7.15 12.215 7.5 13.0375 7.5 14C7.5 14.9625 7.15 15.785 6.4675 16.4675C5.785 17.15 4.9625 17.5 4 17.5Z" + android:fillColor="@color/all_apps_button_color"/> + android:pathData="M14.5 17.5C13.5375 17.5 12.715 17.15 12.0325 16.4675C11.35 15.785 11 14.9625 11 14C11 13.0375 11.35 12.215 12.0325 11.5325C12.715 10.85 13.5375 10.5 14.5 10.5C15.4625 10.5 16.285 10.85 16.9675 11.5325C17.65 12.215 18 13.0375 18 14C18 14.9625 17.65 15.785 16.9675 16.4675C16.285 17.15 15.4625 17.5 14.5 17.5Z" + android:fillColor="@color/all_apps_button_color"/> + android:pathData="M25 17.5C24.0375 17.5 23.215 17.15 22.5325 16.4675C21.85 15.785 21.5 14.9625 21.5 14C21.5 13.0375 21.85 12.215 22.5325 11.5325C23.215 10.85 24.0375 10.5 25 10.5C25.9625 10.5 26.785 10.85 27.4675 11.5325C28.15 12.215 28.5 13.0375 28.5 14C28.5 14.9625 28.15 15.785 27.4675 16.4675C26.785 17.15 25.9625 17.5 25 17.5Z" + android:fillColor="@color/all_apps_button_color"/> + + + diff --git a/res/values-night-v31/colors.xml b/res/values-night-v31/colors.xml index eefe8c5f81..54d6d8876f 100644 --- a/res/values-night-v31/colors.xml +++ b/res/values-night-v31/colors.xml @@ -25,8 +25,5 @@ @android:color/system_accent2_700 @android:color/system_neutral1_700 - @android:color/system_neutral1_800 - @android:color/system_accent1_300 - @android:color/system_accent1_100 - @android:color/system_accent2_100 + ?android:attr/textColorSecondary \ No newline at end of file diff --git a/res/values-night/colors.xml b/res/values-night/colors.xml index ce272ceade..17fe419a8c 100644 --- a/res/values-night/colors.xml +++ b/res/values-night/colors.xml @@ -17,9 +17,5 @@ --> - #2E3132 - #33B9DB - #EFFBFF - #B1EBFF - #DEE0FF + #BFC8CC \ No newline at end of file diff --git a/res/values-v31/colors.xml b/res/values-v31/colors.xml index 7a75ddb5c4..cf4f000340 100644 --- a/res/values-v31/colors.xml +++ b/res/values-v31/colors.xml @@ -61,4 +61,6 @@ @android:color/system_accent2_200 @android:color/system_accent1_300 @android:color/system_neutral2_700 + + ?android:attr/textColorSecondary diff --git a/res/values/colors.xml b/res/values/colors.xml index 309a1c564a..9d6927b99a 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -80,11 +80,7 @@ #ff8df5e3 #ff3d665f - #F7F9FA - #00677E - #00677E - #5F757E - #005A6E + #40484B #00668B #B5CAD7