Merge "Update KQS task launch animation" into main
diff --git a/aconfig/launcher.aconfig b/aconfig/launcher.aconfig
index 22ed567..a62f809 100644
--- a/aconfig/launcher.aconfig
+++ b/aconfig/launcher.aconfig
@@ -71,13 +71,6 @@
}
flag {
- name: "enable_split_from_fullscreen_with_keyboard_shortcuts"
- namespace: "launcher"
- description: "Enables initiating split from a fullscreen app using keyboard shortcuts"
- bug: "270394122"
-}
-
-flag {
name: "enable_launcher_br_metrics"
namespace: "launcher"
description: "Enables logging of Launcher restore metrics to the Backup & Restore team"
diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
index 2ebbe6f..67d3827 100644
--- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
+++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
@@ -1607,7 +1607,7 @@
|| mLauncher.getWorkspace().isOverlayShown()
|| shouldPlayFallbackClosingAnimation(appTargets);
- boolean playWorkspaceReveal = true;
+ boolean playWorkspaceReveal = !fromPredictiveBack;
boolean skipAllAppsScale = false;
if (fromUnlock) {
anim.play(getUnlockWindowAnimator(appTargets, wallpaperTargets));
@@ -1649,7 +1649,7 @@
// targets list because it is already visible). In that case, we force
// invisibility on touch down, and only reset it after the animation to home
// is initialized.
- if (launcherIsForceInvisibleOrOpening) {
+ if (launcherIsForceInvisibleOrOpening || fromPredictiveBack) {
addCujInstrumentation(anim, playFallBackAnimation
? Cuj.CUJ_LAUNCHER_APP_CLOSE_TO_HOME_FALLBACK
: Cuj.CUJ_LAUNCHER_APP_CLOSE_TO_HOME);
@@ -1666,7 +1666,7 @@
// Only register the content animation for cancellation when state changes
mLauncher.getStateManager().setCurrentAnimation(anim);
- if (mLauncher.isInState(LauncherState.ALL_APPS)) {
+ if (mLauncher.isInState(LauncherState.ALL_APPS) && !fromPredictiveBack) {
Pair<AnimatorSet, Runnable> contentAnimator =
getLauncherContentAnimator(false, LAUNCHER_RESUME_START_DELAY,
skipAllAppsScale);
@@ -1677,10 +1677,8 @@
contentAnimator.second.run();
}
});
- } else {
- if (playWorkspaceReveal) {
+ } else if (playWorkspaceReveal) {
anim.play(new WorkspaceRevealAnim(mLauncher, false).getAnimators());
- }
}
}
diff --git a/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java b/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java
index ea1d286..f012197 100644
--- a/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java
+++ b/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java
@@ -56,6 +56,11 @@
private final T mActivityContext;
private int mNumPredictedAppsPerRow;
+ // Vertical padding of the icon that contributes to the expected cell height.
+ private final int mVerticalPadding;
+ // Extra padding that is used in the top app rows (prediction and search) that is not used in
+ // the regular A-Z list. This only applies to single line label.
+ private final int mTopRowExtraHeight;
// Helper to drawing the focus indicator.
private final FocusIndicatorHelper mFocusHelper;
@@ -78,6 +83,10 @@
mFocusHelper = new SimpleFocusIndicatorHelper(this);
mActivityContext = ActivityContext.lookupContext(context);
mNumPredictedAppsPerRow = mActivityContext.getDeviceProfile().numShownAllAppsColumns;
+ mTopRowExtraHeight = getResources().getDimensionPixelSize(
+ R.dimen.all_apps_search_top_row_extra_height);
+ mVerticalPadding = getResources().getDimensionPixelSize(
+ R.dimen.all_apps_predicted_icon_vertical_padding);
updateVisibility();
}
@@ -126,13 +135,11 @@
int iconHeight = deviceProfile.allAppsIconSizePx;
int iconPadding = deviceProfile.allAppsIconDrawablePaddingPx;
int textHeight = Utilities.calculateTextHeight(deviceProfile.allAppsIconTextSizePx);
- int verticalPadding = getResources().getDimensionPixelSize(
- R.dimen.all_apps_predicted_icon_vertical_padding);
- int totalHeight = iconHeight + iconPadding + textHeight + verticalPadding * 2;
- if (FeatureFlags.enableTwolineAllapps()) {
- // Add extra textHeight to the existing total height.
- totalHeight += textHeight;
- }
+ int totalHeight = iconHeight + iconPadding + textHeight + mVerticalPadding * 2;
+ // Prediction row height will be 4dp bigger than the regular apps in A-Z list when two line
+ // is not enabled. Otherwise, the extra height will increase by just the textHeight.
+ int extraHeight = FeatureFlags.enableTwolineAllapps() ? textHeight : mTopRowExtraHeight;
+ totalHeight += extraHeight;
return getVisibility() == GONE ? 0 : totalHeight + getPaddingTop() + getPaddingBottom();
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java
index 709d3ba..6d4fc18 100644
--- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java
@@ -61,6 +61,7 @@
import android.graphics.Region;
import android.graphics.Region.Op;
import android.graphics.drawable.AnimatedVectorDrawable;
+import android.graphics.drawable.Drawable;
import android.graphics.drawable.PaintDrawable;
import android.graphics.drawable.RotateDrawable;
import android.inputmethodservice.InputMethodService;
@@ -96,6 +97,7 @@
import com.android.launcher3.util.TouchController;
import com.android.launcher3.util.window.WindowManagerProxy;
import com.android.launcher3.views.BaseDragLayer;
+import com.android.systemui.shared.navigationbar.KeyButtonRipple;
import com.android.systemui.shared.rotation.FloatingRotationButton;
import com.android.systemui.shared.rotation.RotationButton;
import com.android.systemui.shared.rotation.RotationButtonController;
@@ -665,6 +667,11 @@
for (ImageView button : mAllButtons) {
button.setImageTintList(ColorStateList.valueOf(iconColor));
+ Drawable background = button.getBackground();
+ if (background instanceof KeyButtonRipple) {
+ ((KeyButtonRipple) background).setDarkIntensity(
+ mTaskbarNavButtonDarkIntensity.value);
+ }
}
}
@@ -751,6 +758,7 @@
mA11yButton, res, isInKidsMode, isInSetup, isThreeButtonNav,
mContext.isPhoneMode(), mWindowManagerProxy.getRotation(mContext));
navButtonLayoutter.layoutButtons(mContext, isA11yButtonPersistent());
+ updateButtonsBackground();
updateNavButtonColor();
return;
}
@@ -870,7 +878,27 @@
}
}
}
+ }
+ private void updateButtonsBackground() {
+ boolean clipped = !mContext.isPhoneButtonNavMode();
+ mNavButtonContainer.setClipToPadding(clipped);
+ mNavButtonContainer.setClipChildren(clipped);
+ mNavButtonsView.setClipToPadding(clipped);
+ mNavButtonsView.setClipChildren(clipped);
+
+ for (ImageView button : mAllButtons) {
+ updateButtonBackground(button, mContext.isPhoneButtonNavMode());
+ }
+ }
+
+ private static void updateButtonBackground(View view, boolean isPhoneButtonNavMode) {
+ if (isPhoneButtonNavMode) {
+ view.setBackground(new KeyButtonRipple(view.getContext(), view,
+ R.dimen.key_button_ripple_max_width));
+ } else {
+ view.setBackgroundResource(R.drawable.taskbar_icon_click_feedback_roundrect);
+ }
}
public void onDestroy() {
diff --git a/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java b/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java
index ad2dc23..e5a6021 100644
--- a/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java
@@ -149,7 +149,7 @@
});
initRegionSampler();
if (mActivity.isPhoneGestureNavMode()) {
- onIsStashedChanged(true);
+ onIsStashedChanged();
}
}
@@ -232,10 +232,10 @@
}
/** Called when taskbar is stashed or unstashed. */
- public void onIsStashedChanged(boolean isStashed) {
- mIsStashed = isStashed;
+ public void onIsStashedChanged() {
+ mIsStashed = isStashedHandleVisible();
updateRegionSamplingWindowVisibility();
- if (isStashed) {
+ if (mIsStashed) {
mStashedHandleView.updateSampledRegion(mStashedHandleBounds);
mRegionSamplingHelper.start(mStashedHandleView.getSampledRegion());
} else {
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
index eff6e27..913ca6c 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
@@ -456,6 +456,10 @@
return mTransientTaskbarBounds;
}
+ protected float getCurrentTaskbarWidth() {
+ return mControllers.taskbarViewController.getCurrentVisualTaskbarWidth();
+ }
+
@Override
public StatsLogManager getStatsLogManager() {
// Used to mock, can't mock a default interface method directly
@@ -1341,6 +1345,16 @@
}
}
+ /** Unstashes the Bubble Bar if it is stashed. */
+ @VisibleForTesting
+ public void unstashBubbleBarIfStashed() {
+ mControllers.bubbleControllers.ifPresent(bubbleControllers -> {
+ if (bubbleControllers.bubbleStashController.isStashed()) {
+ bubbleControllers.bubbleStashController.showBubbleBar(false);
+ }
+ });
+ }
+
protected boolean isUserSetupComplete() {
return mIsUserSetupComplete;
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarBackgroundRenderer.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarBackgroundRenderer.kt
index 30f8d56..e290c3f 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarBackgroundRenderer.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarBackgroundRenderer.kt
@@ -203,12 +203,7 @@
val newBackgroundHeight =
mapRange(progress, backgroundHeightWhileAnimating, maxTransientTaskbarHeight)
val fullWidth = transientBackgroundBounds.width()
-
- // .9f is here to restrict min width of the background while animating, so transient
- // background keeps it pill shape until animation end.
- val animationWidth =
- if (DisplayController.isTransientTaskbar(context)) fullWidth.toFloat() * .9f
- else fullWidth.toFloat()
+ val animationWidth = context.currentTaskbarWidth
val backgroundWidthWhileAnimating =
if (isAnimatingPinning) animationWidth else stashedHandleWidth.toFloat()
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt
index 1a34b7a..7ebc18d 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt
@@ -101,8 +101,10 @@
windowLayoutParams.providedInsets =
if (enableTaskbarNoRecreate()) {
- getProvidedInsets(controllers.sharedState!!.insetsFrameProviders!!,
- insetsRoundedCornerFlag)
+ getProvidedInsets(
+ controllers.sharedState!!.insetsFrameProviders!!,
+ insetsRoundedCornerFlag
+ )
} else {
getProvidedInsets(insetsRoundedCornerFlag)
}
@@ -164,19 +166,18 @@
/**
* This is for when ENABLE_TASKBAR_NO_RECREATION is enabled. We generate one instance of
- * providedInsets and use it across the entire lifecycle of TaskbarManager. The only thing
- * we need to reset is nav bar flags based on insetsRoundedCornerFlag.
+ * providedInsets and use it across the entire lifecycle of TaskbarManager. The only thing we
+ * need to reset is nav bar flags based on insetsRoundedCornerFlag.
*/
- private fun getProvidedInsets(providedInsets: Array<InsetsFrameProvider>,
- insetsRoundedCornerFlag: Int): Array<InsetsFrameProvider> {
+ private fun getProvidedInsets(
+ providedInsets: Array<InsetsFrameProvider>,
+ insetsRoundedCornerFlag: Int
+ ): Array<InsetsFrameProvider> {
val navBarsFlag =
- (if (context.isGestureNav) FLAG_SUPPRESS_SCRIM else 0) or insetsRoundedCornerFlag
+ (if (context.isGestureNav) FLAG_SUPPRESS_SCRIM else 0) or insetsRoundedCornerFlag
for (provider in providedInsets) {
if (provider.type == navigationBars()) {
- provider.setFlags(
- navBarsFlag,
- FLAG_SUPPRESS_SCRIM or FLAG_INSETS_ROUNDED_CORNER
- )
+ provider.setFlags(navBarsFlag, FLAG_SUPPRESS_SCRIM or FLAG_INSETS_ROUNDED_CORNER)
}
}
return providedInsets
@@ -184,25 +185,22 @@
/**
* The inset types and number of insets provided have to match for both gesture nav and button
- * nav. The values and the order of the elements in array are allowed to differ.
- * Reason being WM does not allow types and number of insets changing for a given window once it
- * is added into the hierarchy for performance reasons.
+ * nav. The values and the order of the elements in array are allowed to differ. Reason being WM
+ * does not allow types and number of insets changing for a given window once it is added into
+ * the hierarchy for performance reasons.
*/
private fun getProvidedInsets(insetsRoundedCornerFlag: Int): Array<InsetsFrameProvider> {
val navBarsFlag =
- (if (context.isGestureNav) FLAG_SUPPRESS_SCRIM else 0) or insetsRoundedCornerFlag
+ (if (context.isGestureNav) FLAG_SUPPRESS_SCRIM else 0) or insetsRoundedCornerFlag
return arrayOf(
- InsetsFrameProvider(insetsOwner, 0, navigationBars())
- .setFlags(
- navBarsFlag,
- FLAG_SUPPRESS_SCRIM or FLAG_INSETS_ROUNDED_CORNER
- ),
- InsetsFrameProvider(insetsOwner, 0, tappableElement()),
- InsetsFrameProvider(insetsOwner, 0, mandatorySystemGestures()),
- InsetsFrameProvider(insetsOwner, INDEX_LEFT, systemGestures())
- .setSource(SOURCE_DISPLAY),
- InsetsFrameProvider(insetsOwner, INDEX_RIGHT, systemGestures())
- .setSource(SOURCE_DISPLAY)
+ InsetsFrameProvider(insetsOwner, 0, navigationBars())
+ .setFlags(navBarsFlag, FLAG_SUPPRESS_SCRIM or FLAG_INSETS_ROUNDED_CORNER),
+ InsetsFrameProvider(insetsOwner, 0, tappableElement()),
+ InsetsFrameProvider(insetsOwner, 0, mandatorySystemGestures()),
+ InsetsFrameProvider(insetsOwner, INDEX_LEFT, systemGestures())
+ .setSource(SOURCE_DISPLAY),
+ InsetsFrameProvider(insetsOwner, INDEX_RIGHT, systemGestures())
+ .setSource(SOURCE_DISPLAY)
)
}
@@ -216,46 +214,52 @@
provider.insetsSize = getInsetsForGravity(tappableHeight, gravity)
} else if (provider.type == systemGestures() && provider.index == INDEX_LEFT) {
val leftIndexInset =
- if (context.isThreeButtonNav) 0
- else gestureNavSettingsObserver.getLeftSensitivityForCallingUser(res)
+ if (context.isThreeButtonNav) 0
+ else gestureNavSettingsObserver.getLeftSensitivityForCallingUser(res)
provider.insetsSize = Insets.of(leftIndexInset, 0, 0, 0)
} else if (provider.type == systemGestures() && provider.index == INDEX_RIGHT) {
val rightIndexInset =
- if (context.isThreeButtonNav) 0
- else gestureNavSettingsObserver.getRightSensitivityForCallingUser(res)
+ if (context.isThreeButtonNav) 0
+ else gestureNavSettingsObserver.getRightSensitivityForCallingUser(res)
provider.insetsSize = Insets.of(0, 0, rightIndexInset, 0)
}
// When in gesture nav, report the stashed height to the IME, to allow hiding the
// IME navigation bar.
- val imeInsetsSize = if (ENABLE_HIDE_IME_CAPTION_BAR && context.isGestureNav) {
- getInsetsForGravity(controllers.taskbarStashController.stashedHeight, gravity);
- } else {
- getInsetsForGravity(taskbarHeightForIme, gravity)
- }
+ val imeInsetsSize =
+ if (ENABLE_HIDE_IME_CAPTION_BAR && context.isGestureNav) {
+ getInsetsForGravity(controllers.taskbarStashController.stashedHeight, gravity)
+ } else {
+ getInsetsForGravity(taskbarHeightForIme, gravity)
+ }
val imeInsetsSizeOverride =
- arrayOf(
- InsetsFrameProvider.InsetsSizeOverride(TYPE_INPUT_METHOD, imeInsetsSize),
- InsetsFrameProvider.InsetsSizeOverride(TYPE_VOICE_INTERACTION,
- // No-op override to keep the size and types in sync with the
- // override below (insetsSizeOverrides must have the same length and
- // types after the window is added according to
- // WindowManagerService#relayoutWindow)
- provider.insetsSize)
+ arrayOf(
+ InsetsFrameProvider.InsetsSizeOverride(TYPE_INPUT_METHOD, imeInsetsSize),
+ InsetsFrameProvider.InsetsSizeOverride(
+ TYPE_VOICE_INTERACTION,
+ // No-op override to keep the size and types in sync with the
+ // override below (insetsSizeOverrides must have the same length and
+ // types after the window is added according to
+ // WindowManagerService#relayoutWindow)
+ provider.insetsSize
)
+ )
// Use 0 tappableElement insets for the VoiceInteractionWindow when gesture nav is enabled.
val visInsetsSizeForTappableElement =
- if (context.isGestureNav) getInsetsForGravity(0, gravity)
- else getInsetsForGravity(tappableHeight, gravity)
+ if (context.isGestureNav) getInsetsForGravity(0, gravity)
+ else getInsetsForGravity(tappableHeight, gravity)
val insetsSizeOverrideForTappableElement =
- arrayOf(
- InsetsFrameProvider.InsetsSizeOverride(TYPE_INPUT_METHOD, imeInsetsSize),
- InsetsFrameProvider.InsetsSizeOverride(TYPE_VOICE_INTERACTION,
- visInsetsSizeForTappableElement
- ),
- )
- if ((context.isGestureNav || ENABLE_TASKBAR_NAVBAR_UNIFICATION)
- && provider.type == tappableElement()) {
+ arrayOf(
+ InsetsFrameProvider.InsetsSizeOverride(TYPE_INPUT_METHOD, imeInsetsSize),
+ InsetsFrameProvider.InsetsSizeOverride(
+ TYPE_VOICE_INTERACTION,
+ visInsetsSizeForTappableElement
+ ),
+ )
+ if (
+ (context.isGestureNav || ENABLE_TASKBAR_NAVBAR_UNIFICATION) &&
+ provider.type == tappableElement()
+ ) {
provider.insetsSizeOverrides = insetsSizeOverrideForTappableElement
} else if (provider.type != systemGestures()) {
// We only override insets at the bottom of the screen
@@ -264,8 +268,8 @@
}
/**
- * @return [Insets] where the [inset] is either used as a bottom inset or
- * right/left inset if using 3 button nav
+ * @return [Insets] where the [inset] is either used as a bottom inset or right/left inset if
+ * using 3 button nav
*/
private fun getInsetsForGravity(inset: Int, gravity: Int): Insets {
if ((gravity and Gravity.BOTTOM) == Gravity.BOTTOM) {
@@ -277,7 +281,7 @@
val isSeascape = (gravity and Gravity.START) == Gravity.START
val leftInset = if (isSeascape) inset else 0
val rightInset = if (isSeascape) 0 else inset
- return Insets.of(leftInset , 0, rightInset, 0)
+ return Insets.of(leftInset, 0, rightInset, 0)
}
/**
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarPinningController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarPinningController.kt
index 6cb28ee..5b117fc 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarPinningController.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarPinningController.kt
@@ -20,6 +20,7 @@
import android.view.View
import androidx.annotation.VisibleForTesting
import androidx.core.animation.doOnEnd
+import com.android.app.animation.Interpolators
import com.android.launcher3.LauncherPrefs
import com.android.launcher3.LauncherPrefs.Companion.TASKBAR_PINNING
import com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_DIVIDER_MENU_CLOSE
@@ -106,6 +107,7 @@
taskbarViewController.taskbarIconTranslationXForPinning.animateToValue(animateToValue)
)
+ animatorSet.interpolator = Interpolators.EMPHASIZED
return animatorSet
}
@@ -129,6 +131,6 @@
companion object {
const val PINNING_PERSISTENT = 1f
const val PINNING_TRANSIENT = 0f
- const val PINNING_ANIMATION_DURATION = 500L
+ const val PINNING_ANIMATION_DURATION = 600L
}
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
index 48c83da..eced202 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
@@ -590,6 +590,7 @@
mAnimator.addListener(AnimatorListeners.forEndCallback(() -> {
mAnimator = null;
mIsStashed = isStashed;
+ onIsStashedChanged();
}));
return;
}
@@ -604,7 +605,7 @@
@Override
public void onAnimationStart(Animator animation) {
mIsStashed = isStashed;
- onIsStashedChanged(mIsStashed);
+ onIsStashedChanged();
cancelTimeoutIfExists();
}
@@ -829,9 +830,9 @@
.setDuration(TASKBAR_HINT_STASH_DURATION).start();
}
- private void onIsStashedChanged(boolean isStashed) {
+ private void onIsStashedChanged() {
mControllers.runAfterInit(() -> {
- mControllers.stashedHandleViewController.onIsStashedChanged(isStashed);
+ mControllers.stashedHandleViewController.onIsStashedChanged();
mControllers.taskbarInsetsController.onTaskbarOrBubblebarWindowHeightOrInsetsChanged();
});
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java
index 33fb395..1f03f24 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java
@@ -159,6 +159,8 @@
private final int mTransientIconSize;
private final int mPersistentIconSize;
+ private final float mTaskbarLeftRightMargin;
+
public TaskbarViewController(TaskbarActivityContext activity, TaskbarView taskbarView) {
mActivity = activity;
mTransientTaskbarDp = mActivity.getTransientTaskbarDeviceProfile();
@@ -184,6 +186,9 @@
mTaskbarThemedIconsBackgroundColor = ColorUtils.HSLToColor(colorHSL);
}
mIsRtl = Utilities.isRtl(mTaskbarView.getResources());
+ mTaskbarLeftRightMargin = mActivity.getResources().getDimensionPixelSize(
+ R.dimen.transient_taskbar_padding);
+
}
public void init(TaskbarControllers controllers) {
@@ -391,6 +396,26 @@
}
}
+ /**
+ * Calculates visual taskbar view width.
+ */
+ public float getCurrentVisualTaskbarWidth() {
+ if (mTaskbarView.getIconViews().length == 0) {
+ return 0;
+ }
+
+ View[] iconViews = mTaskbarView.getIconViews();
+
+ int leftIndex = mActivity.getDeviceProfile().isQsbInline && !mIsRtl ? 1 : 0;
+ int rightIndex = mActivity.getDeviceProfile().isQsbInline && mIsRtl
+ ? iconViews.length - 2
+ : iconViews.length - 1;
+
+ float left = iconViews[leftIndex].getX();
+ float right = iconViews[rightIndex].getRight() + iconViews[rightIndex].getTranslationX();
+
+ return right - left + (2 * mTaskbarLeftRightMargin);
+ }
/**
* Sets the translation of the TaskbarView during the swipe up gesture.
diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
index 42b18bd..cbf6ad6 100644
--- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
+++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
@@ -1572,7 +1572,8 @@
mSwipePipToHomeAnimator.getTaskId(),
mSwipePipToHomeAnimator.getComponentName(),
mSwipePipToHomeAnimator.getDestinationBounds(),
- mSwipePipToHomeAnimator.getContentOverlay());
+ mSwipePipToHomeAnimator.getContentOverlay(),
+ mSwipePipToHomeAnimator.getAppBounds());
windowAnim = mSwipePipToHomeAnimators;
} else {
diff --git a/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java b/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java
index 9d942c5..65c8662 100644
--- a/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java
+++ b/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java
@@ -1,5 +1,6 @@
package com.android.quickstep;
+import static com.android.launcher3.taskbar.TaskbarThresholdUtils.getFromNavThreshold;
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import android.app.Activity;
@@ -10,7 +11,6 @@
import androidx.annotation.Nullable;
-import com.android.launcher3.R;
import com.android.launcher3.taskbar.TaskbarActivityContext;
import com.android.launcher3.testing.TestInformationHandler;
import com.android.launcher3.testing.shared.TestProtocol;
@@ -18,6 +18,7 @@
import com.android.launcher3.util.DisplayController;
import com.android.quickstep.util.LayoutUtils;
import com.android.quickstep.util.TISBindHelper;
+import com.android.quickstep.views.RecentsView;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
@@ -77,6 +78,11 @@
return response;
}
+ case TestProtocol.REQUEST_GET_OVERVIEW_CURRENT_PAGE_INDEX: {
+ return getLauncherUIProperty(Bundle::putInt,
+ launcher -> launcher.<RecentsView>getOverviewPanel().getCurrentPage());
+ }
+
case TestProtocol.REQUEST_HAS_TIS: {
response.putBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD, true);
return response;
@@ -93,7 +99,7 @@
case TestProtocol.REQUEST_TASKBAR_FROM_NAV_THRESHOLD: {
final Resources resources = mContext.getResources();
response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD,
- resources.getDimensionPixelSize(R.dimen.taskbar_from_nav_threshold));
+ getFromNavThreshold(resources, mDeviceProfile));
return response;
}
@@ -154,6 +160,14 @@
// Allow null-pointer to catch illegal states.
runOnTISBinder(tisBinder -> tisBinder.getTaskbarManager().recreateTaskbar());
return response;
+
+ case TestProtocol.REQUEST_UNSTASH_BUBBLE_BAR_IF_STASHED:
+ runOnTISBinder(tisBinder -> {
+ // Allow null-pointer to catch illegal states.
+ tisBinder.getTaskbarManager().getCurrentActivityContext()
+ .unstashBubbleBarIfStashed();
+ });
+ return response;
}
return super.call(method, arg, extras);
diff --git a/quickstep/src/com/android/quickstep/SystemUiProxy.java b/quickstep/src/com/android/quickstep/SystemUiProxy.java
index 94ed5b9..a8c6809 100644
--- a/quickstep/src/com/android/quickstep/SystemUiProxy.java
+++ b/quickstep/src/com/android/quickstep/SystemUiProxy.java
@@ -630,10 +630,11 @@
* should be responsible for cleaning up the overlay.
*/
public void stopSwipePipToHome(int taskId, ComponentName componentName, Rect destinationBounds,
- SurfaceControl overlay) {
+ SurfaceControl overlay, Rect appBounds) {
if (mPip != null) {
try {
- mPip.stopSwipePipToHome(taskId, componentName, destinationBounds, overlay);
+ mPip.stopSwipePipToHome(taskId, componentName, destinationBounds, overlay,
+ appBounds);
} catch (RemoteException e) {
Log.w(TAG, "Failed call stopSwipePipToHome");
}
diff --git a/quickstep/src/com/android/quickstep/TaskAnimationManager.java b/quickstep/src/com/android/quickstep/TaskAnimationManager.java
index 69db91b..4f885af 100644
--- a/quickstep/src/com/android/quickstep/TaskAnimationManager.java
+++ b/quickstep/src/com/android/quickstep/TaskAnimationManager.java
@@ -38,6 +38,7 @@
import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
+import com.android.internal.util.ArrayUtils;
import com.android.launcher3.Utilities;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.util.DisplayController;
@@ -185,6 +186,16 @@
cleanUpRecentsAnimation(newCallbacks);
}
+ private boolean isNonRecentsStartedTasksAppeared(
+ RemoteAnimationTarget[] appearedTaskTargets) {
+ // For example, right after swiping from task X to task Y (e.g. from
+ // AbsSwipeUpHandler#startNewTask), and then task Y starts X immediately
+ // (e.g. in Y's onResume). The case will be: lastStartedTask=Y and appearedTask=X.
+ return mLastGestureState.getEndTarget() == GestureState.GestureEndTarget.NEW_TASK
+ && ArrayUtils.find(appearedTaskTargets,
+ mLastGestureState.mLastStartedTaskIdPredicate) == null;
+ }
+
@Override
public void onTasksAppeared(RemoteAnimationTarget[] appearedTaskTargets) {
RemoteAnimationTarget appearedTaskTarget = appearedTaskTargets[0];
@@ -213,7 +224,8 @@
nonAppTargets = new RemoteAnimationTarget[0];
}
if ((activityInterface.isInLiveTileMode()
- || mLastGestureState.getEndTarget() == RECENTS)
+ || mLastGestureState.getEndTarget() == RECENTS
+ || isNonRecentsStartedTasksAppeared(appearedTaskTargets))
&& activityInterface.getCreatedActivity() != null) {
RecentsView recentsView =
activityInterface.getCreatedActivity().getOverviewPanel();
diff --git a/quickstep/src/com/android/quickstep/util/SwipePipToHomeAnimator.java b/quickstep/src/com/android/quickstep/util/SwipePipToHomeAnimator.java
index a36b32c..6c89be1 100644
--- a/quickstep/src/com/android/quickstep/util/SwipePipToHomeAnimator.java
+++ b/quickstep/src/com/android/quickstep/util/SwipePipToHomeAnimator.java
@@ -264,6 +264,10 @@
return mDestinationBounds;
}
+ public Rect getAppBounds() {
+ return mAppBounds;
+ }
+
@Nullable
public SurfaceControl getContentOverlay() {
return mPipContentOverlay == null ? null : mPipContentOverlay.getLeash();
diff --git a/quickstep/src/com/android/quickstep/views/TaskMenuView.java b/quickstep/src/com/android/quickstep/views/TaskMenuView.java
index cf89d2e..77033b2 100644
--- a/quickstep/src/com/android/quickstep/views/TaskMenuView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskMenuView.java
@@ -115,9 +115,6 @@
animateClose();
} else {
closeComplete();
- if (enableOverviewIconMenu()) {
- ((IconAppChipView) mTaskContainer.getIconView()).reset();
- }
}
}
@@ -378,9 +375,18 @@
private void closeComplete() {
mIsOpen = false;
+ resetOverviewIconMenu();
mActivity.getDragLayer().removeView(this);
}
+ private void resetOverviewIconMenu() {
+ if (enableOverviewIconMenu()) {
+ ((IconAppChipView) mTaskContainer.getIconView()).reset();
+ setTranslationY(mMenuTranslationYBeforeOpen);
+ mTaskContainer.getIconView().asView().setTranslationY(mIconViewTranslationYBeforeOpen);
+ }
+ }
+
private RoundedRectRevealOutlineProvider createOpenCloseOutlineProvider() {
float radius = TaskCornerRadius.get(mContext);
Rect fromRect = new Rect(
diff --git a/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java b/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java
index 0a325ac..6614414 100644
--- a/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java
+++ b/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java
@@ -77,6 +77,7 @@
import org.junit.runners.model.Statement;
import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import java.util.function.Function;
@@ -193,6 +194,7 @@
@Test
public void goToOverviewFromApp() {
startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR));
+ waitForRecentsActivityStop();
mLauncher.getLaunchedAppState().switchToOverview();
}
@@ -229,6 +231,19 @@
}
private void waitForRecentsActivityStop() {
+ try {
+ final boolean recentsActivityIsNull = MAIN_EXECUTOR.submit(
+ () -> RecentsActivity.ACTIVITY_TRACKER.getCreatedActivity() == null).get();
+ if (recentsActivityIsNull) {
+ // Null activity counts as a "stopped" one.
+ return;
+ }
+ } catch (ExecutionException e) {
+ throw new RuntimeException(e);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+
Wait.atMost("Recents activity didn't stop",
() -> getFromRecents(recents -> !recents.isStarted()),
DEFAULT_UI_TIMEOUT, mLauncher);
@@ -241,6 +256,7 @@
startAppFast(getAppPackageName());
startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR));
startTestActivity(2);
+ waitForRecentsActivityStop();
Wait.atMost("Expected three apps in the task list",
() -> mLauncher.getRecentTasks().size() >= 3, DEFAULT_ACTIVITY_TIMEOUT, mLauncher);
diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
index ebe3365..1b8866a 100644
--- a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
+++ b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
@@ -28,7 +28,6 @@
import android.content.Intent;
import android.content.res.Configuration;
-import android.platform.test.annotations.PlatinumTest;
import androidx.test.filters.LargeTest;
import androidx.test.platform.app.InstrumentationRegistry;
@@ -113,7 +112,6 @@
@Test
@PortraitLandscape
- @PlatinumTest(focusArea = "launcher")
public void testOverview() throws Exception {
startTestAppsWithCheck();
// mLauncher.pressHome() also tests an important case of pressing home while in background.
@@ -412,7 +410,6 @@
@Test
@PortraitLandscape
@TaskbarModeSwitch()
- @PlatinumTest(focusArea = "launcher")
@TestStabilityRule.Stability(flavors = LOCAL | PLATFORM_POSTSUBMIT) // b/309820115
@ScreenRecord // b/309820115
public void testOverviewForTablet() throws Exception {
diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsTransientTaskbar.java b/quickstep/tests/src/com/android/quickstep/TaplTestsTransientTaskbar.java
index 7109bbf..38d6046 100644
--- a/quickstep/tests/src/com/android/quickstep/TaplTestsTransientTaskbar.java
+++ b/quickstep/tests/src/com/android/quickstep/TaplTestsTransientTaskbar.java
@@ -25,6 +25,7 @@
import androidx.test.runner.AndroidJUnit4;
import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape;
+import com.android.launcher3.util.rule.ScreenRecordRule.ScreenRecord;
import com.android.quickstep.TaskbarModeSwitchRule.TaskbarModeSwitch;
import org.junit.Test;
@@ -69,6 +70,7 @@
@Test
@TaskbarModeSwitch(mode = TRANSIENT)
@PortraitLandscape
+ @ScreenRecord // b/317798731
public void testSwipeToStashAndUnstash() {
getTaskbar().swipeDownToStash();
mLauncher.getLaunchedAppState().swipeUpToUnstashTaskbar();
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index 8d84c90..77af671 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -189,6 +189,10 @@
defaults to 2 * numAllAppsColumns -->
<attr name="numExtendedAllAppsColumns" format="integer" />
+ <!-- Number of rows to calculate the cell height for all apps when it's necessary.
+ Defaults to numRows. Requires FeatureFlags.ENABLE_RESPONSIVE_WORKSPACE to be enabled. -->
+ <attr name="numAllAppsRowsForCellHeightCalculation" format="integer" />
+
<!-- numHotseatIcons defaults to numColumns, if not specified -->
<attr name="numHotseatIcons" format="integer" />
<!-- Number of icons to use when extending the hotseat size,
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 6d115b2..603e697 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -103,6 +103,7 @@
<dimen name="all_apps_search_bar_content_overlap">24dp</dimen>
<dimen name="all_apps_search_bar_bottom_padding">30dp</dimen>
<dimen name="all_apps_empty_search_message_top_offset">40dp</dimen>
+ <dimen name="all_apps_search_top_row_extra_height">4dp</dimen>
<dimen name="all_apps_header_pill_height">48dp</dimen>
<dimen name="all_apps_header_pill_corner_radius">12dp</dimen>
<dimen name="all_apps_header_tab_height">48dp</dimen>
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index 72d2213..834ba04 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -640,8 +640,8 @@
DimensionType.WIDTH, numShownAllAppsColumns, availableWidthPx,
mResponsiveWorkspaceWidthSpec);
mResponsiveAllAppsHeightSpec = allAppsSpecs.getCalculatedSpec(responsiveAspectRatio,
- DimensionType.HEIGHT, inv.numRows, heightPx - mInsets.top,
- mResponsiveWorkspaceHeightSpec);
+ DimensionType.HEIGHT, inv.numAllAppsRowsForCellHeightCalculation,
+ heightPx - mInsets.top, mResponsiveWorkspaceHeightSpec);
ResponsiveSpecsProvider folderSpecs = ResponsiveSpecsProvider.create(
new ResourceHelper(context,
@@ -988,16 +988,6 @@
float workspaceCellPaddingY = getCellSize().y - iconSizePx - iconDrawablePaddingPx
- iconTextHeight;
- if (mIsResponsiveGrid) {
- iconTextSizePx = 0;
- iconDrawablePaddingPx = 0;
- int iconSizeWithOverlap = getIconSizeWithOverlap(iconSizePx);
- cellYPaddingPx = Math.max(0, getCellSize().y - iconSizeWithOverlap) / 2;
- autoResizeAllAppsCells();
-
- return;
- }
-
// We want enough space so that the text is closer to its corresponding icon.
if (workspaceCellPaddingY < iconTextHeight) {
iconTextSizePx = 0;
@@ -1115,25 +1105,28 @@
iconSizePx = mIconSizeSteps.getIconSmallerThan(cellWidthPx);
}
- iconDrawablePaddingPx = getNormalizedIconDrawablePadding();
+ if (isVerticalLayout) {
+ iconDrawablePaddingPx = 0;
+ iconTextSizePx = 0;
+ } else {
+ iconDrawablePaddingPx = getNormalizedIconDrawablePadding();
+ }
CellContentDimensions cellContentDimensions = new CellContentDimensions(iconSizePx,
iconDrawablePaddingPx,
iconTextSizePx);
- if (isVerticalLayout) {
- if (cellHeightPx < iconSizePx) {
- cellContentDimensions.setIconSizePx(
- mIconSizeSteps.getIconSmallerThan(cellHeightPx));
- }
- } else {
- cellContentDimensions.resizeToFitCellHeight(cellHeightPx, mIconSizeSteps);
- }
+ int cellContentHeight = cellContentDimensions.resizeToFitCellHeight(cellHeightPx,
+ mIconSizeSteps);
iconSizePx = cellContentDimensions.getIconSizePx();
iconDrawablePaddingPx = cellContentDimensions.getIconDrawablePaddingPx();
iconTextSizePx = cellContentDimensions.getIconTextSizePx();
- int cellContentHeight = cellContentDimensions.getCellContentHeight();
- cellYPaddingPx = Math.max(0, cellHeightPx - cellContentHeight) / 2;
+ if (isVerticalLayout) {
+ cellYPaddingPx = Math.max(0, getCellSize().y - getIconSizeWithOverlap(iconSizePx))
+ / 2;
+ } else {
+ cellYPaddingPx = Math.max(0, cellHeightPx - cellContentHeight) / 2;
+ }
} else if (mIsScalableGrid) {
iconDrawablePaddingPx = (int) (getNormalizedIconDrawablePadding() * iconScale);
cellWidthPx = pxFromDp(inv.minCellSize[mTypeIndex].x, mMetrics, scale);
@@ -1217,7 +1210,7 @@
updateAllAppsIconSize(scale, res);
}
updateAllAppsContainerWidth();
- if (isVerticalBarLayout()) {
+ if (isVerticalLayout && !mIsResponsiveGrid) {
hideWorkspaceLabelsIfNotEnoughSpace();
}
if (FeatureFlags.enableTwolineAllapps()) {
@@ -1341,7 +1334,7 @@
if (allAppsCellHeightPx < cellContentDimensions.getCellContentHeight()) {
if (isVerticalBarLayout()) {
- if (allAppsCellHeightPx < iconSizePx) {
+ if (allAppsCellHeightPx < allAppsIconSizePx) {
cellContentDimensions.setIconSizePx(
mIconSizeSteps.getIconSmallerThan(allAppsCellHeightPx));
}
@@ -1355,6 +1348,10 @@
}
allAppsCellHeightPx += mResponsiveAllAppsHeightSpec.getGutterPx();
+
+ if (isVerticalBarLayout()) {
+ autoResizeAllAppsCells();
+ }
}
/**
diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java
index 1cbc5b6..78c12e5 100644
--- a/src/com/android/launcher3/InvariantDeviceProfile.java
+++ b/src/com/android/launcher3/InvariantDeviceProfile.java
@@ -170,6 +170,7 @@
* Number of columns in the all apps list.
*/
public int numAllAppsColumns;
+ public int numAllAppsRowsForCellHeightCalculation;
public int numDatabaseAllAppsColumns;
public @StyleRes int allAppsStyle;
@@ -393,6 +394,8 @@
workspaceCellSpecsTwoPanelId = closestProfile.mWorkspaceCellSpecsTwoPanelId;
allAppsCellSpecsId = closestProfile.mAllAppsCellSpecsId;
allAppsCellSpecsTwoPanelId = closestProfile.mAllAppsCellSpecsTwoPanelId;
+ numAllAppsRowsForCellHeightCalculation =
+ closestProfile.mNumAllAppsRowsForCellHeightCalculation;
this.deviceType = deviceType;
inlineNavButtonsEndSpacing = closestProfile.inlineNavButtonsEndSpacing;
@@ -423,6 +426,7 @@
allAppsStyle = closestProfile.allAppsStyle;
numAllAppsColumns = closestProfile.numAllAppsColumns;
+
numDatabaseAllAppsColumns = deviceType == TYPE_MULTI_DISPLAY
? closestProfile.numDatabaseAllAppsColumns : closestProfile.numAllAppsColumns;
@@ -821,6 +825,7 @@
private final @StyleRes int allAppsStyle;
private final int numAllAppsColumns;
+ private final int mNumAllAppsRowsForCellHeightCalculation;
private final int numDatabaseAllAppsColumns;
private final int numHotseatIcons;
private final int numDatabaseHotseatIcons;
@@ -971,6 +976,9 @@
mAllAppsCellSpecsTwoPanelId = a.getResourceId(
R.styleable.GridDisplayOption_allAppsCellSpecsTwoPanelId,
INVALID_RESOURCE_HANDLE);
+ mNumAllAppsRowsForCellHeightCalculation = a.getInt(
+ R.styleable.GridDisplayOption_numAllAppsRowsForCellHeightCalculation,
+ numRows);
} else {
mWorkspaceSpecsId = INVALID_RESOURCE_HANDLE;
mWorkspaceSpecsTwoPanelId = INVALID_RESOURCE_HANDLE;
@@ -984,6 +992,7 @@
mWorkspaceCellSpecsTwoPanelId = INVALID_RESOURCE_HANDLE;
mAllAppsCellSpecsId = INVALID_RESOURCE_HANDLE;
mAllAppsCellSpecsTwoPanelId = INVALID_RESOURCE_HANDLE;
+ mNumAllAppsRowsForCellHeightCalculation = numRows;
}
int inlineForRotation = a.getInt(R.styleable.GridDisplayOption_inlineQsb,
diff --git a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java
index 1782791..3e55f61 100644
--- a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java
+++ b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java
@@ -22,6 +22,7 @@
import android.content.Context;
import androidx.annotation.Nullable;
+import androidx.annotation.VisibleForTesting;
import androidx.recyclerview.widget.DiffUtil;
import com.android.launcher3.Flags;
@@ -338,26 +339,14 @@
hasPrivateApps = appList.stream().
allMatch(mPrivateProviderManager.getItemInfoMatcher());
}
- int privateAppCount = 0;
- int numberOfColumns = mActivityContext.getDeviceProfile().numShownAllAppsColumns;
- int numberOfAppRows = (int) Math.ceil((double) appList.size() / numberOfColumns);
- for (AppInfo info : appList) {
+ for (int i = 0; i < appList.size(); i++) {
+ AppInfo info = appList.get(i);
// Apply decorator to private apps.
if (hasPrivateApps) {
- int roundRegion = ROUND_NOTHING;
- if ((privateAppCount / numberOfColumns) == numberOfAppRows - 1) {
- if ((privateAppCount % numberOfColumns) == 0) {
- // App is the first column
- roundRegion = ROUND_BOTTOM_LEFT;
- } else if ((privateAppCount % numberOfColumns) == numberOfColumns-1) {
- roundRegion = ROUND_BOTTOM_RIGHT;
- }
- }
mAdapterItems.add(AdapterItem.asAppWithDecorationInfo(info,
new SectionDecorationInfo(mActivityContext.getApplicationContext(),
- roundRegion,
+ getRoundRegions(i, appList.size()),
true /* decorateTogether */)));
- privateAppCount += 1;
} else {
mAdapterItems.add(AdapterItem.asApp(info));
}
@@ -372,6 +361,43 @@
}
}
+ /**
+ * Determines the corner regions that should be rounded for a specific app icon based on its
+ * position in a grid. Apps that should only be cared about rounding are the apps in the last
+ * row. In the last row on the first column, the app should only be rounded on the bottom left.
+ * Apps in the middle would not be rounded and the last app on the last row will ALWAYS have a
+ * {@link SectionDecorationInfo#ROUND_BOTTOM_RIGHT}.
+ *
+ * @param appIndex The index of the app icon within the app list.
+ * @param appListSize The total number of apps within the app list.
+ * @return An integer representing the corner regions to be rounded, using bitwise flags:
+ * - {@link SectionDecorationInfo#ROUND_NOTHING}: No corners should be rounded.
+ * - {@link SectionDecorationInfo#ROUND_TOP_LEFT}: Round the top-left corner.
+ * - {@link SectionDecorationInfo#ROUND_TOP_RIGHT}: Round the top-right corner.
+ * - {@link SectionDecorationInfo#ROUND_BOTTOM_LEFT}: Round the bottom-left corner.
+ * - {@link SectionDecorationInfo#ROUND_BOTTOM_RIGHT}: Round the bottom-right corner.
+ */
+ @VisibleForTesting
+ int getRoundRegions(int appIndex, int appListSize) {
+ int numberOfAppRows = (int) Math.ceil((double) appListSize / mNumAppsPerRowAllApps);
+ int roundRegion = ROUND_NOTHING;
+ // App is in the last row.
+ if ((appIndex / mNumAppsPerRowAllApps) == numberOfAppRows - 1) {
+ if ((appIndex % mNumAppsPerRowAllApps) == 0) {
+ // App is the first column.
+ roundRegion = ROUND_BOTTOM_LEFT;
+ } else if ((appIndex % mNumAppsPerRowAllApps) == mNumAppsPerRowAllApps-1) {
+ // App is in the last column.
+ roundRegion = ROUND_BOTTOM_RIGHT;
+ }
+ // Ensure the last private app is rounded on the bottom right.
+ if (appIndex == appListSize - 1) {
+ roundRegion |= ROUND_BOTTOM_RIGHT;
+ }
+ }
+ return roundRegion;
+ }
+
private static class MyDiffCallback extends DiffUtil.Callback {
private final List<AdapterItem> mOldList;
diff --git a/src/com/android/launcher3/allapps/SectionDecorationInfo.java b/src/com/android/launcher3/allapps/SectionDecorationInfo.java
index 1fed2b6..c438d19 100644
--- a/src/com/android/launcher3/allapps/SectionDecorationInfo.java
+++ b/src/com/android/launcher3/allapps/SectionDecorationInfo.java
@@ -22,11 +22,11 @@
public class SectionDecorationInfo {
- public static final int ROUND_NOTHING = 1 << 1;
- public static final int ROUND_TOP_LEFT = 1 << 2;
- public static final int ROUND_TOP_RIGHT = 1 << 3;
- public static final int ROUND_BOTTOM_LEFT = 1 << 4;
- public static final int ROUND_BOTTOM_RIGHT = 1 << 5;
+ public static final int ROUND_NOTHING = 0;
+ public static final int ROUND_TOP_LEFT = 1 << 1;
+ public static final int ROUND_TOP_RIGHT = 1 << 2;
+ public static final int ROUND_BOTTOM_LEFT = 1 << 3;
+ public static final int ROUND_BOTTOM_RIGHT = 1 << 4;
public static final int DECORATOR_ALPHA = 255;
protected boolean mShouldDecorateItemsTogether;
diff --git a/src/com/android/launcher3/model/LoaderTask.java b/src/com/android/launcher3/model/LoaderTask.java
index 7c40a31..7b9f6fa 100644
--- a/src/com/android/launcher3/model/LoaderTask.java
+++ b/src/com/android/launcher3/model/LoaderTask.java
@@ -18,6 +18,7 @@
import static com.android.launcher3.BuildConfig.WIDGET_ON_FIRST_SCREEN;
import static com.android.launcher3.Flags.enableSupportForArchiving;
+import static com.android.launcher3.Flags.enableLauncherBrMetrics;
import static com.android.launcher3.LauncherPrefs.IS_FIRST_LOAD_AFTER_RESTORE;
import static com.android.launcher3.LauncherPrefs.SHOULD_SHOW_SMARTSPACE;
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APP_PAIR;
@@ -232,8 +233,11 @@
LoaderMemoryLogger memoryLogger = new LoaderMemoryLogger();
mIsRestoreFromBackup =
(Boolean) LauncherPrefs.get(mApp.getContext()).get(IS_FIRST_LOAD_AFTER_RESTORE);
- LauncherRestoreEventLogger restoreEventLogger = LauncherRestoreEventLogger
- .Companion.newInstance(mApp.getContext());
+ LauncherRestoreEventLogger restoreEventLogger = null;
+ if (enableLauncherBrMetrics()) {
+ restoreEventLogger = LauncherRestoreEventLogger.Companion
+ .newInstance(mApp.getContext());
+ }
try (LauncherModel.LoaderTransaction transaction = mApp.getModel().beginLoader(this)) {
List<ShortcutInfo> allShortcuts = new ArrayList<>();
@@ -364,9 +368,11 @@
transaction.commit();
memoryLogger.clearLogs();
if (mIsRestoreFromBackup) {
- restoreEventLogger.reportLauncherRestoreResults();
mIsRestoreFromBackup = false;
LauncherPrefs.get(mApp.getContext()).putSync(IS_FIRST_LOAD_AFTER_RESTORE.to(false));
+ if (restoreEventLogger != null) {
+ restoreEventLogger.reportLauncherRestoreResults();
+ }
}
} catch (CancellationException e) {
// Loader stopped, ignore
@@ -421,7 +427,7 @@
final WidgetManagerHelper widgetHelper = new WidgetManagerHelper(context);
ModelDbController dbController = mApp.getModel().getModelDbController();
- dbController.tryMigrateDB();
+ dbController.tryMigrateDB(restoreEventLogger);
Log.d(TAG, "loadWorkspace: loading default favorites");
dbController.loadDefaultFavoritesIfNecessary();
diff --git a/src/com/android/launcher3/model/ModelDbController.java b/src/com/android/launcher3/model/ModelDbController.java
index d2b7161..c68274a 100644
--- a/src/com/android/launcher3/model/ModelDbController.java
+++ b/src/com/android/launcher3/model/ModelDbController.java
@@ -19,6 +19,7 @@
import static android.util.Base64.NO_WRAP;
import static com.android.launcher3.DefaultLayoutParser.RES_PARTNER_DEFAULT_LAYOUT;
+import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE;
import static com.android.launcher3.LauncherSettings.Favorites.addTableToDb;
import static com.android.launcher3.LauncherSettings.Settings.LAYOUT_DIGEST_KEY;
import static com.android.launcher3.LauncherSettings.Settings.LAYOUT_DIGEST_LABEL;
@@ -48,6 +49,7 @@
import android.util.Log;
import android.util.Xml;
+import androidx.annotation.Nullable;
import androidx.annotation.WorkerThread;
import com.android.launcher3.AutoInstallsLayout;
@@ -62,6 +64,7 @@
import com.android.launcher3.LauncherSettings;
import com.android.launcher3.LauncherSettings.Favorites;
import com.android.launcher3.Utilities;
+import com.android.launcher3.backuprestore.LauncherRestoreEventLogger;
import com.android.launcher3.logging.FileLog;
import com.android.launcher3.pm.UserCache;
import com.android.launcher3.provider.LauncherDbUtils;
@@ -86,6 +89,7 @@
private static final String TAG = "LauncherProvider";
private static final String EMPTY_DATABASE_CREATED = "EMPTY_DATABASE_CREATED";
+ private static final String RESTORE_ERROR_GRID_MIGRATION_FAILURE = "grid_migration_failed";
public static final String EXTRA_DB_NAME = "db_name";
protected DatabaseHelper mOpenHelper;
@@ -261,8 +265,12 @@
/**
* Migrates the DB if needed. If the migration failed, it clears the DB.
*/
- public void tryMigrateDB() {
+ public void tryMigrateDB(@Nullable LauncherRestoreEventLogger restoreEventLogger) {
+
if (!migrateGridIfNeeded()) {
+ if (restoreEventLogger != null) {
+ sendMetricsForFailedMigration(restoreEventLogger, getDb());
+ }
FileLog.d(TAG, "Migration failed: resetting launcher database");
createEmptyDB();
LauncherPrefs.get(mContext).putSync(
@@ -313,6 +321,30 @@
}
/**
+ * In case of migration failure, report metrics for the count of each itemType in the DB.
+ * @param restoreEventLogger logger used to report Launcher restore metrics
+ */
+ private void sendMetricsForFailedMigration(LauncherRestoreEventLogger restoreEventLogger,
+ SQLiteDatabase db) {
+ try (Cursor cursor = db.rawQuery(
+ "SELECT itemType, COUNT(*) AS count FROM favorites GROUP BY itemType",
+ null
+ )) {
+ if (cursor.moveToFirst()) {
+ do {
+ restoreEventLogger.logFavoritesItemsRestoreFailed(
+ cursor.getInt(cursor.getColumnIndexOrThrow(ITEM_TYPE)),
+ cursor.getInt(cursor.getColumnIndexOrThrow("count")),
+ RESTORE_ERROR_GRID_MIGRATION_FAILURE
+ );
+ } while (cursor.moveToNext());
+ }
+ } catch (Exception e) {
+ FileLog.e(TAG, "sendMetricsForFailedDb: Error reading from database", e);
+ }
+ }
+
+ /**
* Returns the underlying model database
*/
public SQLiteDatabase getDb() {
diff --git a/src/com/android/launcher3/responsive/ResponsiveSpec.kt b/src/com/android/launcher3/responsive/ResponsiveSpec.kt
index b0e1b27..65e0b32 100644
--- a/src/com/android/launcher3/responsive/ResponsiveSpec.kt
+++ b/src/com/android/launcher3/responsive/ResponsiveSpec.kt
@@ -59,7 +59,7 @@
val cellSize: SizeSpec,
) : IResponsiveSpec {
init {
- check(isValid()) { "Invalid ResponsiveSpec found." }
+ check(isValid()) { "Invalid ResponsiveSpec found. $this" }
}
constructor(
@@ -106,7 +106,7 @@
}
if (!isValidRemainderSpace()) {
- logError("The total Remainder Space used must be lower or equal to 100%.")
+ logError("The total Remainder Space used must be equal to 0 or 1.")
return false
}
@@ -131,11 +131,12 @@
}
private fun isValidRemainderSpace(): Boolean {
- // TODO(b/313621277): This validation must be update do accept only 0 or 1 instead of <= 1f.
- return startPadding.ofRemainderSpace +
- endPadding.ofRemainderSpace +
- gutter.ofRemainderSpace +
- cellSize.ofRemainderSpace <= 1f
+ val remainderSpaceUsed =
+ startPadding.ofRemainderSpace +
+ endPadding.ofRemainderSpace +
+ gutter.ofRemainderSpace +
+ cellSize.ofRemainderSpace
+ return remainderSpaceUsed == 0f || remainderSpaceUsed == 1f
}
private fun isValidAvailableSpace(): Boolean {
@@ -254,8 +255,8 @@
startPaddingPx = spec.startPadding.getRemainderSpaceValue(remainderSpace, startPaddingPx)
endPaddingPx = spec.endPadding.getRemainderSpaceValue(remainderSpace, endPaddingPx)
- gutterPx = spec.gutter.getRemainderSpaceValue(remainderSpace, gutterPx)
- cellSizePx = spec.cellSize.getRemainderSpaceValue(remainderSpace, cellSizePx)
+ gutterPx = spec.gutter.getRemainderSpaceValue(remainderSpace, gutterPx, gutters)
+ cellSizePx = spec.cellSize.getRemainderSpaceValue(remainderSpace, cellSizePx, cells)
}
override fun hashCode(): Int {
diff --git a/src/com/android/launcher3/responsive/SizeSpec.kt b/src/com/android/launcher3/responsive/SizeSpec.kt
index d146898..41dcd5e 100644
--- a/src/com/android/launcher3/responsive/SizeSpec.kt
+++ b/src/com/android/launcher3/responsive/SizeSpec.kt
@@ -57,11 +57,16 @@
/**
* Calculates the [SizeSpec] value when remainder space value is defined. If no remainderSpace
* is 0, returns a default value.
+ *
+ * @param remainderSpace The remainder space to be used for the calculation
+ * @param defaultValue The default value to be returned when no ofRemainderSpace is defined
+ * @param factor A number to divide the remainder space. The default value is 1. This property
+ * is used to split equally the remainder space by the number of cells and gutters.
*/
- fun getRemainderSpaceValue(remainderSpace: Int, defaultValue: Int): Int {
+ fun getRemainderSpaceValue(remainderSpace: Int, defaultValue: Int, factor: Int = 1): Int {
val remainderSpaceValue =
if (ofRemainderSpace > 0) {
- (ofRemainderSpace * remainderSpace).roundToInt()
+ (ofRemainderSpace * remainderSpace / factor).roundToInt()
} else {
defaultValue
}
diff --git a/src/com/android/launcher3/testing/TestInformationHandler.java b/src/com/android/launcher3/testing/TestInformationHandler.java
index 2c834bd..7b192dc 100644
--- a/src/com/android/launcher3/testing/TestInformationHandler.java
+++ b/src/com/android/launcher3/testing/TestInformationHandler.java
@@ -330,6 +330,7 @@
return null;
}
T value = provider.apply(target);
+
Bundle response = new Bundle();
bundleSetter.set(response, TestProtocol.TEST_INFO_RESPONSE_FIELD, value);
return response;
diff --git a/src/com/android/launcher3/util/CellContentDimensions.kt b/src/com/android/launcher3/util/CellContentDimensions.kt
index 3c8e0c4..5059c2f 100644
--- a/src/com/android/launcher3/util/CellContentDimensions.kt
+++ b/src/com/android/launcher3/util/CellContentDimensions.kt
@@ -48,7 +48,10 @@
cellContentHeight = getCellContentHeight()
// Step 3. Decrease label size
- if (cellContentHeight > cellHeightPx) {
+ if (
+ cellContentHeight > cellHeightPx &&
+ iconTextSizePx > iconSizeSteps.minimumIconLabelSize
+ ) {
iconTextSizePx =
max(
iconSizeSteps.minimumIconLabelSize,
@@ -58,6 +61,17 @@
}
}
+ // For some cases, depending on the display size, the content might not fit inside the
+ // cell height after considering the minimum icon and label size allowed.
+ // For these extreme cases, we will allow the icon size to be smaller than
+ // [IconSizeSteps.minimumIconSize] to fit inside the cell height without cropping.
+ while (
+ cellContentHeight > cellHeightPx && iconSizePx > IconSizeSteps.ICON_SIZE_STEP_EXTRA
+ ) {
+ iconSizePx -= IconSizeSteps.ICON_SIZE_STEP_EXTRA
+ cellContentHeight = getCellContentHeight()
+ }
+
return cellContentHeight
}
diff --git a/src/com/android/launcher3/util/IconSizeSteps.kt b/src/com/android/launcher3/util/IconSizeSteps.kt
index 6128eb4..a207d5c 100644
--- a/src/com/android/launcher3/util/IconSizeSteps.kt
+++ b/src/com/android/launcher3/util/IconSizeSteps.kt
@@ -49,5 +49,9 @@
companion object {
internal const val TEXT_STEP = 1
+
+ // This icon extra step is used for stepping down logic in extreme cases when it's
+ // necessary to reduce the icon size below minimum size available in [icon_size_steps].
+ internal const val ICON_SIZE_STEP_EXTRA = 2
}
}
diff --git a/tests/AndroidManifest-common.xml b/tests/AndroidManifest-common.xml
index bd9da0a..e5e3354 100644
--- a/tests/AndroidManifest-common.xml
+++ b/tests/AndroidManifest-common.xml
@@ -149,7 +149,8 @@
android:name="com.android.launcher3.testcomponent.BaseTestingActivity"
android:label="LauncherTestApp"
android:exported="true"
- android:taskAffinity="com.android.launcher3.testcomponent.Affinity1">
+ android:taskAffinity="com.android.launcher3.testcomponent.Affinity1"
+ android:theme="@style/Theme.TestActivities">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
@@ -343,6 +344,24 @@
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity-alias>
+ <activity-alias android:name="AAAActivity"
+ android:label="AAA"
+ android:exported="true"
+ android:targetActivity="com.android.launcher3.testcomponent.BaseTestingActivity">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="android.intent.category.LAUNCHER"/>
+ </intent-filter>
+ </activity-alias>
+ <activity-alias android:name="ZZZActivity"
+ android:label="ZZZ"
+ android:exported="true"
+ android:targetActivity="com.android.launcher3.testcomponent.BaseTestingActivity">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="android.intent.category.LAUNCHER"/>
+ </intent-filter>
+ </activity-alias>
<!-- [b/197780098] Disable eager initialization of Jetpack libraries. -->
<provider
diff --git a/tests/res/values/styles.xml b/tests/res/values/styles.xml
new file mode 100644
index 0000000..1e1a2cd
--- /dev/null
+++ b/tests/res/values/styles.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+ ~ Copyright (C) 2024 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<resources>
+ <style name="Theme.TestActivities" parent="@android:style/Theme.DeviceDefault.DayNight">
+ <!-- Hardcoded ActionBar height to avoid changes while emulating -->
+ <!-- (56dp - default for handheld) -->
+ <item name="android:actionBarSize">168px</item>
+ </style>
+</resources>
\ No newline at end of file
diff --git a/tests/res/xml/invalid_responsive_spec_1.xml b/tests/res/xml/invalid_responsive_spec_1.xml
index d1bcf65..7845d1e 100644
--- a/tests/res/xml/invalid_responsive_spec_1.xml
+++ b/tests/res/xml/invalid_responsive_spec_1.xml
@@ -27,7 +27,7 @@
<workspaceSpec
launcher:maxAvailableSize="9999dp"
launcher:dimensionType="width">
- <cellSize launcher:ofRemainderSpace="0.25" />
+ <cellSize launcher:ofRemainderSpace="1" />
<endPadding launcher:fixedSize="22dp" />
<gutter launcher:fixedSize="16dp" />
<startPadding launcher:fixedSize="22dp" />
diff --git a/tests/res/xml/invalid_responsive_spec_2.xml b/tests/res/xml/invalid_responsive_spec_2.xml
index 49e1f93..ae30bb9 100644
--- a/tests/res/xml/invalid_responsive_spec_2.xml
+++ b/tests/res/xml/invalid_responsive_spec_2.xml
@@ -28,7 +28,7 @@
<workspaceSpec
launcher:maxAvailableSize="9999dp"
launcher:dimensionType="width">
- <cellSize launcher:ofRemainderSpace="0.25" />
+ <cellSize launcher:ofRemainderSpace="1" />
<endPadding launcher:fixedSize="22dp" />
<gutter launcher:fixedSize="16dp" />
<startPadding launcher:fixedSize="22dp" />
@@ -38,7 +38,7 @@
<workspaceSpec
launcher:maxAvailableSize="9999dp"
launcher:dimensionType="width">
- <cellSize launcher:ofRemainderSpace="0.25" />
+ <cellSize launcher:ofRemainderSpace="1" />
<endPadding launcher:fixedSize="22dp" />
<gutter launcher:fixedSize="16dp" />
<startPadding launcher:fixedSize="22dp" />
diff --git a/tests/res/xml/valid_responsive_spec_unsorted.xml b/tests/res/xml/valid_responsive_spec_unsorted.xml
index 9a463d5..8676f48 100644
--- a/tests/res/xml/valid_responsive_spec_unsorted.xml
+++ b/tests/res/xml/valid_responsive_spec_unsorted.xml
@@ -22,7 +22,7 @@
<startPadding launcher:fixedSize="0dp" />
<endPadding launcher:fixedSize="34dp" />
<gutter launcher:fixedSize="12dp" />
- <cellSize launcher:ofRemainderSpace="0.25" />
+ <cellSize launcher:ofRemainderSpace="1" />
</workspaceSpec>
<!-- Height spec -->
@@ -32,7 +32,7 @@
<startPadding launcher:fixedSize="0dp" />
<endPadding launcher:fixedSize="24dp" />
<gutter launcher:fixedSize="12dp" />
- <cellSize launcher:ofRemainderSpace="0.25" />
+ <cellSize launcher:ofRemainderSpace="1" />
</workspaceSpec>
<!-- Width spec -->
@@ -42,7 +42,7 @@
<startPadding launcher:fixedSize="16dp" />
<endPadding launcher:fixedSize="64dp" />
<gutter launcher:fixedSize="12dp" />
- <cellSize launcher:ofRemainderSpace="0.25" />
+ <cellSize launcher:ofRemainderSpace="1" />
</workspaceSpec>
<workspaceSpec
launcher:dimensionType="width"
@@ -50,7 +50,7 @@
<startPadding launcher:fixedSize="36dp" />
<endPadding launcher:fixedSize="80dp" />
<gutter launcher:fixedSize="12dp" />
- <cellSize launcher:ofRemainderSpace="0.25" />
+ <cellSize launcher:ofRemainderSpace="1" />
</workspaceSpec>
<workspaceSpec
launcher:dimensionType="width"
@@ -58,7 +58,7 @@
<startPadding launcher:fixedSize="0dp" />
<endPadding launcher:fixedSize="36dp" />
<gutter launcher:fixedSize="12dp" />
- <cellSize launcher:ofRemainderSpace="0.25" />
+ <cellSize launcher:ofRemainderSpace="1" />
</workspaceSpec>
</specs>
@@ -71,7 +71,7 @@
<startPadding launcher:fixedSize="2dp" />
<endPadding launcher:fixedSize="2dp" />
<gutter launcher:fixedSize="8dp" />
- <cellSize launcher:ofRemainderSpace="0.25" />
+ <cellSize launcher:ofRemainderSpace="1" />
</workspaceSpec>
<!-- Width spec -->
@@ -81,7 +81,7 @@
<startPadding launcher:fixedSize="1dp" />
<endPadding launcher:fixedSize="1dp" />
<gutter launcher:fixedSize="8dp" />
- <cellSize launcher:ofRemainderSpace="0.25" />
+ <cellSize launcher:ofRemainderSpace="1" />
</workspaceSpec>
</specs>
@@ -122,7 +122,7 @@
<startPadding launcher:fixedSize="22dp" />
<endPadding launcher:fixedSize="22dp" />
<gutter launcher:fixedSize="16dp" />
- <cellSize launcher:ofRemainderSpace="0.25" />
+ <cellSize launcher:ofRemainderSpace="1" />
</workspaceSpec>
</specs>
</workspaceSpecs>
diff --git a/tests/res/xml/valid_workspace_file.xml b/tests/res/xml/valid_workspace_file.xml
index 9c44502..dc9963a 100644
--- a/tests/res/xml/valid_workspace_file.xml
+++ b/tests/res/xml/valid_workspace_file.xml
@@ -54,7 +54,7 @@
<startPadding launcher:fixedSize="22dp" />
<endPadding launcher:fixedSize="22dp" />
<gutter launcher:fixedSize="16dp" />
- <cellSize launcher:ofRemainderSpace="0.25" />
+ <cellSize launcher:ofRemainderSpace="1" />
</workspaceSpec>
</specs>
@@ -67,7 +67,7 @@
<startPadding launcher:fixedSize="0dp" />
<endPadding launcher:fixedSize="24dp" />
<gutter launcher:fixedSize="12dp" />
- <cellSize launcher:ofRemainderSpace="0.25" />
+ <cellSize launcher:ofRemainderSpace="1" />
</workspaceSpec>
<workspaceSpec
launcher:dimensionType="height"
@@ -75,7 +75,7 @@
<startPadding launcher:fixedSize="0dp" />
<endPadding launcher:fixedSize="34dp" />
<gutter launcher:fixedSize="12dp" />
- <cellSize launcher:ofRemainderSpace="0.25" />
+ <cellSize launcher:ofRemainderSpace="1" />
</workspaceSpec>
<!-- Width spec -->
@@ -85,7 +85,7 @@
<startPadding launcher:fixedSize="0dp" />
<endPadding launcher:fixedSize="36dp" />
<gutter launcher:fixedSize="12dp" />
- <cellSize launcher:ofRemainderSpace="0.25" />
+ <cellSize launcher:ofRemainderSpace="1" />
</workspaceSpec>
<workspaceSpec
launcher:dimensionType="width"
@@ -93,7 +93,7 @@
<startPadding launcher:fixedSize="16dp" />
<endPadding launcher:fixedSize="64dp" />
<gutter launcher:fixedSize="12dp" />
- <cellSize launcher:ofRemainderSpace="0.25" />
+ <cellSize launcher:ofRemainderSpace="1" />
</workspaceSpec>
<workspaceSpec
launcher:dimensionType="width"
@@ -101,7 +101,7 @@
<startPadding launcher:fixedSize="36dp" />
<endPadding launcher:fixedSize="80dp" />
<gutter launcher:fixedSize="12dp" />
- <cellSize launcher:ofRemainderSpace="0.25" />
+ <cellSize launcher:ofRemainderSpace="1" />
</workspaceSpec>
</specs>
</workspaceSpecs>
diff --git a/tests/res/xml/valid_workspace_unsorted_file.xml b/tests/res/xml/valid_workspace_unsorted_file.xml
index 6bf7c78..f783e9f 100644
--- a/tests/res/xml/valid_workspace_unsorted_file.xml
+++ b/tests/res/xml/valid_workspace_unsorted_file.xml
@@ -52,7 +52,7 @@
<startPadding launcher:fixedSize="22dp" />
<endPadding launcher:fixedSize="22dp" />
<gutter launcher:fixedSize="16dp" />
- <cellSize launcher:ofRemainderSpace="0.25" />
+ <cellSize launcher:ofRemainderSpace="1" />
</workspaceSpec>
</specs>
</workspaceSpecs>
diff --git a/tests/shared/com/android/launcher3/testing/shared/TestProtocol.java b/tests/shared/com/android/launcher3/testing/shared/TestProtocol.java
index fcb5158..ccbe382 100644
--- a/tests/shared/com/android/launcher3/testing/shared/TestProtocol.java
+++ b/tests/shared/com/android/launcher3/testing/shared/TestProtocol.java
@@ -147,6 +147,8 @@
public static final String REQUEST_GET_GRID_TASK_SIZE_RECT_FOR_TABLET =
"get-grid-task-size-rect-for-tablet";
public static final String REQUEST_GET_OVERVIEW_PAGE_SPACING = "get-overview-page-spacing";
+ public static final String REQUEST_GET_OVERVIEW_CURRENT_PAGE_INDEX =
+ "get-overview-current-page-index";
public static final String REQUEST_ENABLE_ROTATION = "enable_rotation";
public static final String REQUEST_ENABLE_SUGGESTION = "enable-suggestion";
public static final String REQUEST_MODEL_QUEUE_CLEARED = "model-queue-cleared";
@@ -172,6 +174,9 @@
public static final String REQUEST_FLAG_ENABLE_GRID_ONLY_OVERVIEW = "enable-grid-only-overview";
+ public static final String REQUEST_UNSTASH_BUBBLE_BAR_IF_STASHED =
+ "unstash-bubble-bar-if-stashed";
+
/** Logs {@link Log#d(String, String)} if {@link #sDebugTracing} is true. */
public static void testLogD(String tag, String message) {
if (!sDebugTracing) {
diff --git a/tests/src/com/android/launcher3/allapps/AlphabeticalAppsListTest.java b/tests/src/com/android/launcher3/allapps/AlphabeticalAppsListTest.java
index 259f519..3068785 100644
--- a/tests/src/com/android/launcher3/allapps/AlphabeticalAppsListTest.java
+++ b/tests/src/com/android/launcher3/allapps/AlphabeticalAppsListTest.java
@@ -19,6 +19,9 @@
import static androidx.test.core.app.ApplicationProvider.getApplicationContext;
import static com.android.launcher3.allapps.BaseAllAppsAdapter.VIEW_TYPE_PRIVATE_SPACE_HEADER;
+import static com.android.launcher3.allapps.SectionDecorationInfo.ROUND_BOTTOM_LEFT;
+import static com.android.launcher3.allapps.SectionDecorationInfo.ROUND_BOTTOM_RIGHT;
+import static com.android.launcher3.allapps.SectionDecorationInfo.ROUND_NOTHING;
import static com.android.launcher3.allapps.UserProfileManager.STATE_DISABLED;
import static com.android.launcher3.allapps.UserProfileManager.STATE_ENABLED;
import static com.android.launcher3.allapps.UserProfileManager.STATE_TRANSITION;
@@ -61,6 +64,8 @@
private static final int PRIVATE_SPACE_HEADER_ITEM_COUNT = 1;
private static final int MAIN_USER_APP_COUNT = 2;
private static final int PRIVATE_USER_APP_COUNT = 1;
+ private static final int NUM_APP_COLS = 4;
+ private static final int NUM_APP_ROWS = 3;
private AlphabeticalAppsList<?> mAlphabeticalAppsList;
@Mock
@@ -81,6 +86,7 @@
info != null && info.user.equals(PRIVATE_HANDLE));
mAlphabeticalAppsList = new AlphabeticalAppsList<>(mContext, mAllAppsStore,
null, mPrivateProfileManager);
+ mAlphabeticalAppsList.setNumAppsPerRowAllApps(NUM_APP_COLS);
}
@Test
@@ -182,6 +188,94 @@
.toList().size());
}
+ @Test
+ public void getRoundRegions_whenIndexIsMiddleOfLastRow_roundNothing() {
+ int index = 3;
+
+ int roundRegions = mAlphabeticalAppsList.getRoundRegions(index,
+ NUM_APP_COLS * NUM_APP_ROWS);
+
+ assertEquals(ROUND_NOTHING, roundRegions);
+ }
+
+ @Test
+ public void getRoundRegions_whenIndexIsInEndOfLastRow_roundBottomRight() {
+ int index = 11;
+
+ int roundRegions = mAlphabeticalAppsList.getRoundRegions(index,
+ NUM_APP_COLS * NUM_APP_ROWS);
+
+ assertEquals(ROUND_BOTTOM_RIGHT, roundRegions);
+ }
+
+ @Test
+ public void getRoundRegions_whenIndexIsInBeginningOfLastRow_roundBottomLeft() {
+ int index = 8;
+
+ int roundRegions = mAlphabeticalAppsList.getRoundRegions(index,
+ NUM_APP_COLS * NUM_APP_ROWS);
+
+ assertEquals(ROUND_BOTTOM_LEFT, roundRegions);
+ }
+
+ @Test
+ public void getRoundRegions_whenIndexIsInMiddleOfLastRow_roundNothing() {
+ int index = 9;
+
+ int roundRegions = mAlphabeticalAppsList.getRoundRegions(index,
+ NUM_APP_COLS * NUM_APP_ROWS);
+
+ assertEquals(ROUND_NOTHING, roundRegions);
+ }
+
+ @Test
+ public void getRoundRegions_whenIndexIsInMiddleRow_roundNothing() {
+ int index = 5;
+
+ int roundRegions = mAlphabeticalAppsList.getRoundRegions(index,
+ NUM_APP_COLS * NUM_APP_ROWS);
+
+ assertEquals(ROUND_NOTHING, roundRegions);
+ }
+
+ @Test
+ public void getRoundRegions_whenIndexIsInBeginningOfTopRow_roundNothing() {
+ int index = 0;
+
+ int roundRegions = mAlphabeticalAppsList.getRoundRegions(index,
+ NUM_APP_COLS * NUM_APP_ROWS);
+
+ assertEquals(ROUND_NOTHING, roundRegions);
+ }
+
+ @Test
+ public void getRoundRegions_whenIndexIsInLastOfTopRow_roundNothing() {
+ int index = 3;
+
+ int roundRegions = mAlphabeticalAppsList.getRoundRegions(index,
+ NUM_APP_COLS * NUM_APP_ROWS);
+
+ assertEquals(ROUND_NOTHING, roundRegions);
+ }
+
+ @Test
+ public void getRoundRegions_whenIndexIsInMiddleOfLastRowLastItem_roundBottomRight() {
+ int index = 9;
+
+ int roundRegions = mAlphabeticalAppsList.getRoundRegions(index, index+1);
+
+ assertEquals(ROUND_BOTTOM_RIGHT, roundRegions);
+ }
+
+ @Test
+ public void getRoundRegions_whenIndexIsInBeginningOfLastRowLastItem_roundBottomRight() {
+ int index = 8;
+
+ int roundRegions = mAlphabeticalAppsList.getRoundRegions(index, index+1);
+
+ assertEquals(ROUND_BOTTOM_RIGHT | ROUND_BOTTOM_LEFT, roundRegions);
+ }
+
private int addPrivateSpaceHeader(List<BaseAllAppsAdapter.AdapterItem> adapterItemList) {
adapterItemList.add(new BaseAllAppsAdapter.AdapterItem(VIEW_TYPE_PRIVATE_SPACE_HEADER));
return adapterItemList.size();
diff --git a/tests/src/com/android/launcher3/allapps/TaplOpenCloseAllAppsTest.java b/tests/src/com/android/launcher3/allapps/TaplOpenCloseAllAppsTest.java
index 92ff355..bc4c16e 100644
--- a/tests/src/com/android/launcher3/allapps/TaplOpenCloseAllAppsTest.java
+++ b/tests/src/com/android/launcher3/allapps/TaplOpenCloseAllAppsTest.java
@@ -181,10 +181,10 @@
executeOnLauncher(launcher -> assertTrue("flingBackward() didn't scroll App Apps",
flingBackwardY < flingForwardY));
- // Test scrolling down to YouTube.
- assertNotNull("All apps: can't find YouTube", allApps.getAppIcon("YouTube"));
- // Test scrolling up to Camera.
- assertNotNull("All apps: can't find Camera", allApps.getAppIcon("Camera"));
+ // Test scrolling down to the end of the app list.
+ assertNotNull("All apps: can't find YouTube", allApps.getAppIcon("ZZZ"));
+ // Test scrolling up to the beginning oof the app list.
+ assertNotNull("All apps: can't find Camera", allApps.getAppIcon("AAA"));
// Test failing to find a non-existing app.
final AllApps allAppsFinal = allApps;
expectFail("All apps: could find a non-existing app",
diff --git a/tests/src/com/android/launcher3/celllayout/FavoriteItemsTransaction.java b/tests/src/com/android/launcher3/celllayout/FavoriteItemsTransaction.java
index fb364ad..dbb2715 100644
--- a/tests/src/com/android/launcher3/celllayout/FavoriteItemsTransaction.java
+++ b/tests/src/com/android/launcher3/celllayout/FavoriteItemsTransaction.java
@@ -64,7 +64,7 @@
runOnExecutorSync(MODEL_EXECUTOR, () -> {
ModelDbController controller = model.getModelDbController();
// Migrate any previous data so that the DB state is correct
- controller.tryMigrateDB();
+ controller.tryMigrateDB(null /* restoreEventLogger */);
// Create DB again to load fresh data
controller.createEmptyDB();
diff --git a/tests/src/com/android/launcher3/compat/TaplPromiseIconUiTest.java b/tests/src/com/android/launcher3/compat/TaplPromiseIconUiTest.java
index 2dc1cb2..bfa0d34 100644
--- a/tests/src/com/android/launcher3/compat/TaplPromiseIconUiTest.java
+++ b/tests/src/com/android/launcher3/compat/TaplPromiseIconUiTest.java
@@ -33,7 +33,6 @@
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import com.android.compatibility.common.util.SystemUtil;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.ui.AbstractLauncherUiTest;
@@ -141,10 +140,8 @@
@RequiresFlagsEnabled(FLAG_ENABLE_SUPPORT_FOR_ARCHIVING)
public void testPromiseIcon_addedArchivedApp() throws Throwable {
installDummyAppAndWaitForUIUpdate();
- assertThat(
- SystemUtil.runShellCommand(
- String.format("pm archive %s", DUMMY_PACKAGE))).isEqualTo(
- "Success\n");
+ assertThat(mDevice.executeShellCommand(String.format("pm archive %s", DUMMY_PACKAGE)))
+ .isEqualTo("Success\n");
final ItemOperator findPromiseApp = (info, view) ->
info != null && TextUtils.equals(info.title, DUMMY_LABEL);
diff --git a/tests/src/com/android/launcher3/responsive/ResponsiveSpecsProviderTest.kt b/tests/src/com/android/launcher3/responsive/ResponsiveSpecsProviderTest.kt
index 9681ca8..54a1dc5 100644
--- a/tests/src/com/android/launcher3/responsive/ResponsiveSpecsProviderTest.kt
+++ b/tests/src/com/android/launcher3/responsive/ResponsiveSpecsProviderTest.kt
@@ -84,7 +84,7 @@
startPadding = SizeSpec(1f.dpToPx()),
endPadding = SizeSpec(1f.dpToPx()),
gutter = SizeSpec(8f.dpToPx()),
- cellSize = SizeSpec(ofRemainderSpace = .25f)
+ cellSize = SizeSpec(ofRemainderSpace = 1f)
)
)
@@ -97,7 +97,7 @@
startPadding = SizeSpec(2f.dpToPx()),
endPadding = SizeSpec(2f.dpToPx()),
gutter = SizeSpec(8f.dpToPx()),
- cellSize = SizeSpec(ofRemainderSpace = .25f)
+ cellSize = SizeSpec(ofRemainderSpace = 1f)
),
)
@@ -182,7 +182,7 @@
startPadding = SizeSpec(22f.dpToPx()),
endPadding = SizeSpec(22f.dpToPx()),
gutter = sizeSpec16,
- cellSize = SizeSpec(ofRemainderSpace = .25f)
+ cellSize = SizeSpec(ofRemainderSpace = 1f)
)
)
@@ -231,7 +231,7 @@
startPadding = SizeSpec(0f.dpToPx()),
endPadding = SizeSpec(36f.dpToPx()),
gutter = sizeSpec12,
- cellSize = SizeSpec(ofRemainderSpace = .25f)
+ cellSize = SizeSpec(ofRemainderSpace = 1f)
),
ResponsiveSpec(
maxAvailableSize = 716.dpToPx(),
@@ -240,7 +240,7 @@
startPadding = SizeSpec(16f.dpToPx()),
endPadding = SizeSpec(64f.dpToPx()),
gutter = sizeSpec12,
- cellSize = SizeSpec(ofRemainderSpace = .25f)
+ cellSize = SizeSpec(ofRemainderSpace = 1f)
),
ResponsiveSpec(
maxAvailableSize = 9999.dpToPx(),
@@ -249,7 +249,7 @@
startPadding = SizeSpec(36f.dpToPx()),
endPadding = SizeSpec(80f.dpToPx()),
gutter = sizeSpec12,
- cellSize = SizeSpec(ofRemainderSpace = .25f)
+ cellSize = SizeSpec(ofRemainderSpace = 1f)
)
)
@@ -262,7 +262,7 @@
startPadding = SizeSpec(0f),
endPadding = SizeSpec(24f.dpToPx()),
gutter = sizeSpec12,
- cellSize = SizeSpec(ofRemainderSpace = .25f)
+ cellSize = SizeSpec(ofRemainderSpace = 1f)
),
ResponsiveSpec(
maxAvailableSize = 9999.dpToPx(),
@@ -271,7 +271,7 @@
startPadding = SizeSpec(0f),
endPadding = SizeSpec(34f.dpToPx()),
gutter = sizeSpec12,
- cellSize = SizeSpec(ofRemainderSpace = .25f)
+ cellSize = SizeSpec(ofRemainderSpace = 1f)
),
)
diff --git a/tests/src/com/android/launcher3/responsive/WorkspaceSpecsTest.kt b/tests/src/com/android/launcher3/responsive/WorkspaceSpecsTest.kt
index 9781645..17b0ee4 100644
--- a/tests/src/com/android/launcher3/responsive/WorkspaceSpecsTest.kt
+++ b/tests/src/com/android/launcher3/responsive/WorkspaceSpecsTest.kt
@@ -159,7 +159,7 @@
"maxSize=2147483647), " +
"cellSize=SizeSpec(fixedSize=0.0, " +
"ofAvailableSpace=0.0, " +
- "ofRemainderSpace=0.25, " +
+ "ofRemainderSpace=1.0, " +
"matchWorkspace=false, " +
"maxSize=2147483647)" +
")"
diff --git a/tests/src/com/android/launcher3/ui/widget/TaplAddWidgetTest.java b/tests/src/com/android/launcher3/ui/widget/TaplAddWidgetTest.java
index d75b387..db38c68 100644
--- a/tests/src/com/android/launcher3/ui/widget/TaplAddWidgetTest.java
+++ b/tests/src/com/android/launcher3/ui/widget/TaplAddWidgetTest.java
@@ -18,7 +18,6 @@
import static org.junit.Assert.assertNotNull;
import android.platform.test.annotations.PlatinumTest;
-import android.platform.test.rule.ScreenRecordRule;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.LargeTest;
@@ -29,9 +28,11 @@
import com.android.launcher3.ui.AbstractLauncherUiTest;
import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape;
import com.android.launcher3.ui.TestViewHelpers;
+import com.android.launcher3.util.rule.ScreenRecordRule.ScreenRecord;
import com.android.launcher3.util.rule.ShellCommandRule;
import com.android.launcher3.widget.LauncherAppWidgetProviderInfo;
+import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
@@ -47,9 +48,16 @@
@Rule
public ShellCommandRule mGrantWidgetRule = ShellCommandRule.grantWidgetBind();
+ @Override
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ AbstractLauncherUiTest.initialize(this);
+ }
+
@Test
@PortraitLandscape
- @ScreenRecordRule.ScreenRecord // b/289161193
+ @ScreenRecord // b/316910614
public void testDragIcon() throws Throwable {
mLauncher.enableDebugTracing(); // b/289161193
new FavoriteItemsTransaction(mTargetContext).commitAndLoadHome(mLauncher);
@@ -99,6 +107,7 @@
*/
@PlatinumTest(focusArea = "launcher")
@Test
+ @ScreenRecord // b/316910614
public void testResizeWidget() throws Throwable {
new FavoriteItemsTransaction(mTargetContext).commitAndLoadHome(mLauncher);
diff --git a/tests/src/com/android/launcher3/util/ModelTestExtensions.kt b/tests/src/com/android/launcher3/util/ModelTestExtensions.kt
index 9d9bd517..6bd182b 100644
--- a/tests/src/com/android/launcher3/util/ModelTestExtensions.kt
+++ b/tests/src/com/android/launcher3/util/ModelTestExtensions.kt
@@ -30,7 +30,7 @@
loadModelSync()
TestUtil.runOnExecutorSync(Executors.MODEL_EXECUTOR) {
modelDbController.run {
- tryMigrateDB()
+ tryMigrateDB(null /* restoreEventLogger */)
createEmptyDB()
clearEmptyDbFlag()
}
@@ -72,7 +72,7 @@
loadModelSync()
TestUtil.runOnExecutorSync(Executors.MODEL_EXECUTOR) {
val controller: ModelDbController = modelDbController
- controller.tryMigrateDB()
+ controller.tryMigrateDB(null /* restoreEventLogger */)
modelDbController.newTransaction().use { transaction ->
val values =
ContentValues().apply {
diff --git a/tests/tapl/com/android/launcher3/tapl/AllApps.java b/tests/tapl/com/android/launcher3/tapl/AllApps.java
index 0e78565..3cbc2c2 100644
--- a/tests/tapl/com/android/launcher3/tapl/AllApps.java
+++ b/tests/tapl/com/android/launcher3/tapl/AllApps.java
@@ -375,7 +375,7 @@
? mLauncher.waitForLauncherObject(FAST_SCROLLER_RES_ID) :
mLauncher.waitForLauncherObject(BOTTOM_SHEET_RES_ID);
- mLauncher.touchOutsideContainer(container, tapRight, false);
+ touchOutside(tapRight, container);
try (LauncherInstrumentation.Closable tapped = mLauncher.addContextLayer(
"tapped outside AllApps bottom sheet")) {
verifyVisibleContainerOnDismiss();
@@ -383,6 +383,10 @@
}
}
+ protected void touchOutside(boolean tapRight, UiObject2 container) {
+ mLauncher.touchOutsideContainer(container, tapRight, false);
+ }
+
/** Presses the meta keyboard shortcut to dismiss AllApps. */
public void dismissByKeyboardShortcut() {
try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck()) {
diff --git a/tests/tapl/com/android/launcher3/tapl/HomeAllApps.java b/tests/tapl/com/android/launcher3/tapl/HomeAllApps.java
index 9ca2dc8..11a0cfb 100644
--- a/tests/tapl/com/android/launcher3/tapl/HomeAllApps.java
+++ b/tests/tapl/com/android/launcher3/tapl/HomeAllApps.java
@@ -131,4 +131,12 @@
return new Workspace(mLauncher);
}
}
+
+ @Override
+ protected void touchOutside(boolean tapRight, UiObject2 container) {
+ mLauncher.runToState(
+ () -> super.touchOutside(tapRight, container),
+ NORMAL_STATE_ORDINAL,
+ "touching outside");
+ }
}
diff --git a/tests/tapl/com/android/launcher3/tapl/HomeQsb.java b/tests/tapl/com/android/launcher3/tapl/HomeQsb.java
index 5385c65..c1fc45f 100644
--- a/tests/tapl/com/android/launcher3/tapl/HomeQsb.java
+++ b/tests/tapl/com/android/launcher3/tapl/HomeQsb.java
@@ -15,6 +15,8 @@
*/
package com.android.launcher3.tapl;
+import static com.android.launcher3.testing.shared.TestProtocol.ALL_APPS_STATE_ORDINAL;
+
import androidx.test.uiautomator.UiObject2;
/**
@@ -25,4 +27,13 @@
HomeQsb(LauncherInstrumentation launcher, UiObject2 hotseat) {
super(launcher, hotseat, "search_container_hotseat");
}
+
+ @Override
+ protected void clickQsb() {
+ // Clicking Qsb will switch to All Apps state.
+ mLauncher.runToState(
+ () -> super.clickQsb(),
+ ALL_APPS_STATE_ORDINAL,
+ "Clicking Qsb");
+ }
}
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index 508f39b..d17f034 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -420,6 +420,11 @@
.getInt(TestProtocol.TEST_INFO_RESPONSE_FIELD);
}
+ public int getOverviewCurrentPageIndex() {
+ return getTestInfo(TestProtocol.REQUEST_GET_OVERVIEW_CURRENT_PAGE_INDEX)
+ .getInt(TestProtocol.TEST_INFO_RESPONSE_FIELD);
+ }
+
float getExactScreenCenterX() {
return getRealDisplaySize().x / 2f;
}
@@ -2155,6 +2160,11 @@
getTestInfo(TestProtocol.REQUEST_UNSTASH_TASKBAR_IF_STASHED);
}
+ /** Shows the bubble bar if it is stashed, otherwise this does nothing. */
+ public void showBubbleBarIfHidden() {
+ getTestInfo(TestProtocol.REQUEST_UNSTASH_BUBBLE_BAR_IF_STASHED);
+ }
+
/** Blocks the taskbar from automatically stashing based on time. */
public void enableBlockTimeout(boolean enable) {
getTestInfo(enable
diff --git a/tests/tapl/com/android/launcher3/tapl/Qsb.java b/tests/tapl/com/android/launcher3/tapl/Qsb.java
index fe2a63d..d67b8a3 100644
--- a/tests/tapl/com/android/launcher3/tapl/Qsb.java
+++ b/tests/tapl/com/android/launcher3/tapl/Qsb.java
@@ -118,9 +118,7 @@
try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
"want to open search result page");
LauncherInstrumentation.Closable e = mLauncher.eventsCheck()) {
- mLauncher.clickLauncherObject(waitForQsbObject());
- // wait for the result rendering to complete
- mLauncher.waitForIdle();
+ clickQsb();
try (LauncherInstrumentation.Closable c2 = mLauncher.addContextLayer(
"clicked qsb to open search result page")) {
return createSearchResult();
@@ -128,6 +126,10 @@
}
}
+ protected void clickQsb() {
+ mLauncher.clickLauncherObject(waitForQsbObject());
+ }
+
@Override
public LauncherInstrumentation getLauncher() {
return mLauncher;
diff --git a/tests/tapl/com/android/launcher3/tapl/Workspace.java b/tests/tapl/com/android/launcher3/tapl/Workspace.java
index ada0a7f..a911de4 100644
--- a/tests/tapl/com/android/launcher3/tapl/Workspace.java
+++ b/tests/tapl/com/android/launcher3/tapl/Workspace.java
@@ -121,7 +121,10 @@
LauncherInstrumentation.Closable c =
mLauncher.addContextLayer("want to open all apps search")) {
verifyActiveContainer();
- mLauncher.getDevice().pressKeyCode(KEYCODE_META_RIGHT);
+ mLauncher.runToState(
+ () -> mLauncher.getDevice().pressKeyCode(KEYCODE_META_RIGHT),
+ ALL_APPS_STATE_ORDINAL,
+ "pressing keyboard shortcut");
try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer(
"pressed meta key")) {
return new HomeAllApps(mLauncher);