Merge "Remove manual call to stash takbar from within onTaskbarIconLaunched." into main
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java
index d529f8d..43960a1 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java
@@ -225,7 +225,7 @@
}
recentsView.getSplitSelectController().findLastActiveTasksAndRunCallback(
- Collections.singletonList(splitSelectSource.itemInfo.getComponentKey()),
+ Collections.singletonList(splitSelectSource.getItemInfo().getComponentKey()),
false /* findExactPairMatch */,
foundTasks -> {
@Nullable Task foundTask = foundTasks[0];
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java
index ffab936..1f0851f 100644
--- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java
+++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java
@@ -1320,7 +1320,7 @@
}
/** Returns the child count excluding the overflow if it's present. */
- private int getBubbleChildCount() {
+ int getBubbleChildCount() {
return hasOverflow() ? getChildCount() - 1 : getChildCount();
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java
index 4fe4ace..cd0bca6 100644
--- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java
@@ -583,9 +583,8 @@
public void animateBubbleNotification(BubbleBarBubble bubble, boolean isExpanding,
boolean isUpdate) {
boolean isInApp = mTaskbarStashController.isInApp();
- // if this is the first bubble, animate to the initial state. one bubble is the overflow
- // so check for at most 2 children.
- if (mBarView.getChildCount() <= 2 && !isUpdate) {
+ // if this is the first bubble, animate to the initial state.
+ if (mBarView.getBubbleChildCount() == 1 && !isUpdate) {
mBubbleBarViewAnimator.animateToInitialState(bubble, isInApp, isExpanding);
return;
}
diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
index bb33c18..17735e1 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
@@ -729,7 +729,7 @@
// Check if there is already an instance of this app running, if so, initiate the split
// using that.
mSplitSelectStateController.findLastActiveTasksAndRunCallback(
- Collections.singletonList(splitSelectSource.itemInfo.getComponentKey()),
+ Collections.singletonList(splitSelectSource.getItemInfo().getComponentKey()),
false /* findExactPairMatch */,
foundTasks -> {
@Nullable Task foundTask = foundTasks[0];
@@ -756,7 +756,7 @@
Rect tempRect = new Rect();
mSplitSelectStateController.setInitialTaskSelect(source.intent,
- source.position.stagePosition, source.itemInfo, source.splitEvent,
+ source.position.stagePosition, source.getItemInfo(), source.splitEvent,
source.alreadyRunningTaskId);
RecentsView recentsView = getOverviewPanel();
@@ -774,6 +774,8 @@
floatingTaskView.setOnClickListener(view ->
mSplitSelectStateController.getSplitAnimationController().
playAnimPlaceholderToFullscreen(this, view, Optional.empty()));
+ floatingTaskView.setContentDescription(source.getItemInfo().contentDescription);
+
mSplitSelectStateController.setFirstFloatingTaskView(floatingTaskView);
anim.addListener(new AnimatorListenerAdapter() {
@Override
diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
index 6109fd8..5392b70 100644
--- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
+++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
@@ -53,6 +53,7 @@
import static com.android.quickstep.GestureState.STATE_END_TARGET_ANIMATION_FINISHED;
import static com.android.quickstep.GestureState.STATE_END_TARGET_SET;
import static com.android.quickstep.GestureState.STATE_RECENTS_ANIMATION_CANCELED;
+import static com.android.quickstep.GestureState.STATE_RECENTS_ANIMATION_STARTED;
import static com.android.quickstep.GestureState.STATE_RECENTS_SCROLLING_FINISHED;
import static com.android.quickstep.MultiStateCallback.DEBUG_STATES;
import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.CANCEL_RECENTS_ANIMATION;
@@ -468,6 +469,8 @@
mGestureState.runOnceAtState(STATE_END_TARGET_ANIMATION_FINISHED
| STATE_RECENTS_SCROLLING_FINISHED,
this::onSettledOnEndTarget);
+ mGestureState.runOnceAtState(STATE_END_TARGET_SET | STATE_RECENTS_ANIMATION_STARTED,
+ this::onCalculateEndTarget);
mStateCallback.runOnceAtState(STATE_HANDLER_INVALIDATED, this::invalidateHandler);
mStateCallback.runOnceAtState(STATE_LAUNCHER_PRESENT | STATE_HANDLER_INVALIDATED,
@@ -1152,6 +1155,22 @@
}
}
+ /**
+ * Called if the end target has been set and the recents animation is started.
+ */
+ private void onCalculateEndTarget() {
+ final GestureEndTarget endTarget = mGestureState.getEndTarget();
+
+ switch (endTarget) {
+ case HOME:
+ // Early detach the nav bar if endTarget is determined as HOME
+ if (mRecentsAnimationController != null) {
+ mRecentsAnimationController.detachNavigationBarFromApp(true);
+ }
+ break;
+ }
+ }
+
private void onSettledOnEndTarget() {
// Fast-finish the attaching animation if it's still running.
maybeUpdateRecentsAttachedState(false);
@@ -1406,10 +1425,6 @@
duration = mContainer != null && mContainer.getDeviceProfile().isTaskbarPresent
? StaggeredWorkspaceAnim.DURATION_TASKBAR_MS
: StaggeredWorkspaceAnim.DURATION_MS;
- // Early detach the nav bar once the endTarget is determined as HOME
- if (mRecentsAnimationController != null) {
- mRecentsAnimationController.detachNavigationBarFromApp(true);
- }
ContextualEduStatsManager.INSTANCE.get(mContext).updateEduStats(
mGestureState.isTrackpadGesture(), GestureType.HOME);
} else if (endTarget == RECENTS) {
diff --git a/quickstep/src/com/android/quickstep/OverviewComponentObserver.java b/quickstep/src/com/android/quickstep/OverviewComponentObserver.java
index d82426f..ca19480 100644
--- a/quickstep/src/com/android/quickstep/OverviewComponentObserver.java
+++ b/quickstep/src/com/android/quickstep/OverviewComponentObserver.java
@@ -274,6 +274,15 @@
return mActivityInterface;
}
+ /**
+ * Get the current container control helper for managing interactions to the overview activity.
+ *
+ * @return the current container control helper
+ */
+ public BaseContainerInterface<?, ?> getContainerInterface() {
+ return mActivityInterface;
+ }
+
public void dump(PrintWriter pw) {
pw.println("OverviewComponentObserver:");
pw.println(" isDefaultHome=" + mIsDefaultHome);
diff --git a/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java b/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java
index b4b8c5b..b290f83 100644
--- a/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java
+++ b/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java
@@ -1,13 +1,16 @@
package com.android.quickstep;
import static com.android.launcher3.taskbar.TaskbarThresholdUtils.getFromNavThreshold;
+import static com.android.launcher3.testing.shared.TestProtocol.OVERVIEW_FOCUS_TASK_HEIGHT_MISMATCH;
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
+import android.graphics.PointF;
import android.graphics.Rect;
import android.os.Bundle;
+import android.util.Log;
import androidx.annotation.Nullable;
@@ -20,6 +23,7 @@
import com.android.quickstep.util.LayoutUtils;
import com.android.quickstep.util.TISBindHelper;
import com.android.quickstep.views.RecentsView;
+import com.android.quickstep.views.RecentsViewContainer;
import java.util.ArrayList;
import java.util.concurrent.CountDownLatch;
@@ -77,26 +81,39 @@
return response;
}
- case TestProtocol.REQUEST_GET_FOCUSED_TASK_HEIGHT_FOR_TABLET: {
- if (!mDeviceProfile.isTablet) {
- return null;
- }
- Rect focusedTaskRect = new Rect();
+ case TestProtocol.REQUEST_GET_OVERVIEW_TASK_SIZE: {
+ Log.d(OVERVIEW_FOCUS_TASK_HEIGHT_MISMATCH, "== REQUEST_GET_OVERVIEW_TASK_SIZE ==");
+ Rect gridSize = new Rect();
+ LauncherActivityInterface.INSTANCE.calculateGridSize(mDeviceProfile, mContext,
+ gridSize);
+ Log.d(OVERVIEW_FOCUS_TASK_HEIGHT_MISMATCH, "gridSize: " + gridSize);
+ PointF taskDimension = new PointF();
+ LauncherActivityInterface.getTaskDimension(mContext, mDeviceProfile, taskDimension);
+ Log.d(OVERVIEW_FOCUS_TASK_HEIGHT_MISMATCH,
+ "taskbarHeight: " + mDeviceProfile.taskbarHeight);
+ Log.d(OVERVIEW_FOCUS_TASK_HEIGHT_MISMATCH, "taskDimension: " + taskDimension);
+ Rect taskSize = new Rect();
LauncherActivityInterface.INSTANCE.calculateTaskSize(mContext, mDeviceProfile,
- focusedTaskRect, RecentsPagedOrientationHandler.PORTRAIT);
- response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD, focusedTaskRect.height());
- return response;
+ taskSize, RecentsPagedOrientationHandler.PORTRAIT);
+ Log.d(OVERVIEW_FOCUS_TASK_HEIGHT_MISMATCH, "calculateTaskSize: " + taskSize);
+ return getUIProperty(Bundle::putParcelable,
+ recentsViewContainer -> {
+ Rect lastComputedTaskSize =
+ recentsViewContainer.<RecentsView<?, ?>>getOverviewPanel()
+ .getLastComputedTaskSize();
+ Log.d(OVERVIEW_FOCUS_TASK_HEIGHT_MISMATCH,
+ "lastComputedTaskSize: " + lastComputedTaskSize);
+ return lastComputedTaskSize;
+ },
+ this::getRecentsViewContainer);
}
- case TestProtocol.REQUEST_GET_GRID_TASK_SIZE_RECT_FOR_TABLET: {
- if (!mDeviceProfile.isTablet) {
- return null;
- }
- Rect gridTaskRect = new Rect();
- LauncherActivityInterface.INSTANCE.calculateGridTaskSize(mContext, mDeviceProfile,
- gridTaskRect, RecentsPagedOrientationHandler.PORTRAIT);
- response.putParcelable(TestProtocol.TEST_INFO_RESPONSE_FIELD, gridTaskRect);
- return response;
+ case TestProtocol.REQUEST_GET_OVERVIEW_GRID_TASK_SIZE: {
+ return getUIProperty(Bundle::putParcelable,
+ recentsViewContainer ->
+ recentsViewContainer.<RecentsView<?, ?>>getOverviewPanel()
+ .getLastComputedGridTaskSize(),
+ this::getRecentsViewContainer);
}
case TestProtocol.REQUEST_GET_OVERVIEW_PAGE_SPACING: {
@@ -221,6 +238,17 @@
}
}
+ private RecentsViewContainer getRecentsViewContainer() {
+ RecentsAnimationDeviceState rads = new RecentsAnimationDeviceState(mContext);
+ OverviewComponentObserver observer = new OverviewComponentObserver(mContext, rads);
+ try {
+ return observer.getContainerInterface().getCreatedContainer();
+ } finally {
+ observer.onDestroy();
+ rads.destroy();
+ }
+ }
+
@Override
protected boolean isLauncherInitialized() {
return super.isLauncherInitialized() && TouchInteractionService.isInitialized();
diff --git a/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt b/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt
index 0335fa1..fa5a67a 100644
--- a/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt
+++ b/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt
@@ -91,7 +91,8 @@
val iconDrawable: Drawable,
val fadeWithThumbnail: Boolean,
val isStagedTask: Boolean,
- val iconView: View?
+ val iconView: View?,
+ val contentDescription: CharSequence?
)
}
@@ -112,7 +113,8 @@
splitSelectSource.drawable,
fadeWithThumbnail = false,
isStagedTask = true,
- iconView = null
+ iconView = null,
+ splitSelectSource.itemInfo.contentDescription
)
} else if (splitSelectStateController.isDismissingFromSplitPair) {
// Initiating split from overview, but on a split pair
@@ -126,7 +128,8 @@
drawable,
fadeWithThumbnail = true,
isStagedTask = true,
- iconView = container.iconView.asView()
+ iconView = container.iconView.asView(),
+ container.task.titleDescription
)
}
}
@@ -145,7 +148,8 @@
drawable,
fadeWithThumbnail = true,
isStagedTask = true,
- iconView = it.iconView.asView()
+ iconView = it.iconView.asView(),
+ it.task.titleDescription
)
}
}
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index 53e6e72..bb2a12f 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -3450,6 +3450,7 @@
mSplitSelectStateController.getSplitAnimationController().
playAnimPlaceholderToFullscreen(mContainer, view,
Optional.of(() -> resetFromSplitSelectionState())));
+ firstFloatingTaskView.setContentDescription(splitAnimInitProps.getContentDescription());
// SplitInstructionsView: animate in
safeRemoveDragLayerView(mSplitSelectStateController.getSplitInstructionsView());
@@ -4883,7 +4884,7 @@
mSplitSelectStateController.setDismissingFromSplitPair(mSplitHiddenTaskView != null
&& mSplitHiddenTaskView instanceof GroupedTaskView);
mSplitSelectStateController.setInitialTaskSelect(splitSelectSource.intent,
- splitSelectSource.position.stagePosition, splitSelectSource.itemInfo,
+ splitSelectSource.position.stagePosition, splitSelectSource.getItemInfo(),
splitSelectSource.splitEvent, splitSelectSource.alreadyRunningTaskId);
updateDesktopTaskVisibility(false /* visible */);
}
diff --git a/quickstep/tests/multivalentScreenshotTests/src/com/android/launcher3/taskbar/bubbles/BubbleViewScreenshotTest.kt b/quickstep/tests/multivalentScreenshotTests/src/com/android/launcher3/taskbar/bubbles/BubbleViewScreenshotTest.kt
index 3e0d6b5..d77ac5c 100644
--- a/quickstep/tests/multivalentScreenshotTests/src/com/android/launcher3/taskbar/bubbles/BubbleViewScreenshotTest.kt
+++ b/quickstep/tests/multivalentScreenshotTests/src/com/android/launcher3/taskbar/bubbles/BubbleViewScreenshotTest.kt
@@ -15,6 +15,7 @@
*/
package com.android.launcher3.taskbar.bubbles
+import android.app.Notification
import android.content.Context
import android.graphics.Bitmap
import android.graphics.Canvas
@@ -72,7 +73,7 @@
fun bubbleView_seen() {
screenshotRule.screenshotTest("bubbleView_seen") { activity ->
activity.actionBar?.hide()
- setupBubbleView().apply { markSeen() }
+ setupBubbleView(suppressNotification = true)
}
}
@@ -84,7 +85,7 @@
}
}
- private fun setupBubbleView(): BubbleView {
+ private fun setupBubbleView(suppressNotification: Boolean = false): BubbleView {
val inflater = LayoutInflater.from(context)
val iconSize = 100
@@ -95,7 +96,10 @@
val icon = createCircleBitmap(radius = iconSize / 2, color = Color.LTGRAY)
val badge = createCircleBitmap(radius = badgeRadius.toInt(), color = Color.RED)
- val bubbleInfo = BubbleInfo("key", 0, null, null, 0, context.packageName, null, null, false)
+ val flags =
+ if (suppressNotification) Notification.BubbleMetadata.FLAG_SUPPRESS_NOTIFICATION else 0
+ val bubbleInfo =
+ BubbleInfo("key", flags, null, null, 0, context.packageName, null, null, false)
val bubbleView = inflater.inflate(R.layout.bubblebar_item_view, null) as BubbleView
val dotPath =
PathParser.createPathFromPathData(
diff --git a/quickstep/tests/multivalentTests/src/com/android/quickstep/util/SplitAnimationControllerTest.kt b/quickstep/tests/multivalentTests/src/com/android/quickstep/util/SplitAnimationControllerTest.kt
index f3cde52..5051251 100644
--- a/quickstep/tests/multivalentTests/src/com/android/quickstep/util/SplitAnimationControllerTest.kt
+++ b/quickstep/tests/multivalentTests/src/com/android/quickstep/util/SplitAnimationControllerTest.kt
@@ -27,6 +27,7 @@
import android.window.TransitionInfo
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.android.launcher3.apppairs.AppPairIcon
+import com.android.launcher3.model.data.ItemInfo
import com.android.launcher3.statehandlers.DepthController
import com.android.launcher3.statemanager.StateManager
import com.android.launcher3.taskbar.TaskbarActivityContext
@@ -76,6 +77,7 @@
private val splitSelectSource: SplitConfigurationOptions.SplitSelectSource = mock()
private val mockSplitSourceDrawable: Drawable = mock()
private val mockSplitSourceView: View = mock()
+ private val mockItemInfo: ItemInfo = mock()
private val stateManager: StateManager<*, *> = mock()
private val depthController: DepthController = mock()
@@ -89,11 +91,13 @@
whenever(mockTaskContainer.snapshotView).thenReturn(mockSnapshotView)
whenever(mockTaskContainer.splitAnimationThumbnail).thenReturn(mockBitmap)
whenever(mockTaskContainer.iconView).thenReturn(mockIconView)
+ whenever(mockTaskContainer.task).thenReturn(mockTask)
whenever(mockIconView.drawable).thenReturn(mockTaskViewDrawable)
whenever(mockTaskView.taskContainers).thenReturn(List(1) { mockTaskContainer })
whenever(splitSelectSource.drawable).thenReturn(mockSplitSourceDrawable)
whenever(splitSelectSource.view).thenReturn(mockSplitSourceView)
+ whenever(splitSelectSource.itemInfo).thenReturn(mockItemInfo)
splitAnimationController = SplitAnimationController(mockSplitSelectStateController)
}
diff --git a/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java b/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java
index 2858929..2e456a7 100644
--- a/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java
+++ b/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java
@@ -248,6 +248,7 @@
}
@Test
+ @ScreenRecordRule.ScreenRecord // b/355042336
public void testOverview() throws IOException {
startAppFast(getAppPackageName());
startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR));
diff --git a/src/com/android/launcher3/testing/TestInformationHandler.java b/src/com/android/launcher3/testing/TestInformationHandler.java
index db2a6e0..6d9b891 100644
--- a/src/com/android/launcher3/testing/TestInformationHandler.java
+++ b/src/com/android/launcher3/testing/TestInformationHandler.java
@@ -501,7 +501,7 @@
/**
* Returns the result by getting a generic property on UI thread
*/
- private static <S, T> Bundle getUIProperty(
+ protected static <S, T> Bundle getUIProperty(
BundleSetter<T> bundleSetter, Function<S, T> provider, Supplier<S> targetSupplier) {
return getFromExecutorSync(MAIN_EXECUTOR, () -> {
S target = targetSupplier.get();
diff --git a/src/com/android/launcher3/util/SplitConfigurationOptions.java b/src/com/android/launcher3/util/SplitConfigurationOptions.java
index 837d7bc..f457e4e 100644
--- a/src/com/android/launcher3/util/SplitConfigurationOptions.java
+++ b/src/com/android/launcher3/util/SplitConfigurationOptions.java
@@ -211,7 +211,7 @@
private Drawable drawable;
public final Intent intent;
public final SplitPositionOption position;
- public final ItemInfo itemInfo;
+ private ItemInfo itemInfo;
public final StatsLogManager.EventEnum splitEvent;
/** Represents the taskId of the first app to start in split screen */
public int alreadyRunningTaskId = INVALID_TASK_ID;
@@ -239,5 +239,9 @@
public View getView() {
return view;
}
+
+ public ItemInfo getItemInfo() {
+ return itemInfo;
+ }
}
}
diff --git a/tests/multivalentTests/shared/com/android/launcher3/testing/shared/TestProtocol.java b/tests/multivalentTests/shared/com/android/launcher3/testing/shared/TestProtocol.java
index 3f4a73a..a20b0f1 100644
--- a/tests/multivalentTests/shared/com/android/launcher3/testing/shared/TestProtocol.java
+++ b/tests/multivalentTests/shared/com/android/launcher3/testing/shared/TestProtocol.java
@@ -148,10 +148,8 @@
public static final String REQUEST_HOTSEAT_CELL_CENTER = "hotseat-cell-center";
- public static final String REQUEST_GET_FOCUSED_TASK_HEIGHT_FOR_TABLET =
- "get-focused-task-height-for-tablet";
- 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_TASK_SIZE = "get-overivew-task-size";
+ public static final String REQUEST_GET_OVERVIEW_GRID_TASK_SIZE = "get-overivew-grid-task-size";
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";
@@ -173,6 +171,7 @@
public static final String TEST_DRAG_APP_ICON_TO_MULTIPLE_WORKSPACES_FAILURE = "b/326908466";
public static final String WIDGET_CONFIG_NULL_EXTRA_INTENT = "b/324419890";
public static final String OVERVIEW_SELECT_TOOLTIP_MISALIGNED = "b/332485341";
+ public static final String OVERVIEW_FOCUS_TASK_HEIGHT_MISMATCH = "b/336660988";
public static final String REQUEST_FLAG_ENABLE_GRID_ONLY_OVERVIEW = "enable-grid-only-overview";
public static final String REQUEST_FLAG_ENABLE_APP_PAIRS = "enable-app-pairs";
diff --git a/tests/tapl/com/android/launcher3/tapl/BaseOverview.java b/tests/tapl/com/android/launcher3/tapl/BaseOverview.java
index e71b49f..ac145b7 100644
--- a/tests/tapl/com/android/launcher3/tapl/BaseOverview.java
+++ b/tests/tapl/com/android/launcher3/tapl/BaseOverview.java
@@ -23,6 +23,8 @@
import static com.android.launcher3.tapl.OverviewTask.TASK_START_EVENT;
import static com.android.launcher3.tapl.TestHelpers.getOverviewPackageName;
import static com.android.launcher3.testing.shared.TestProtocol.NORMAL_STATE_ORDINAL;
+import static com.android.launcher3.testing.shared.TestProtocol.OVERVIEW_FOCUS_TASK_HEIGHT_MISMATCH;
+import static com.android.launcher3.testing.shared.TestProtocol.testLogD;
import android.graphics.Rect;
import android.util.Log;
@@ -278,7 +280,7 @@
if (mLauncher.isTablet()) {
mLauncher.assertTrue("current task is not grid height",
getCurrentTask().getVisibleHeight() == mLauncher
- .getGridTaskRectForTablet().height());
+ .getOverviewGridTaskSize().height());
}
mLauncher.assertTrue("Current task not scrolled off screen",
!getCurrentTask().equals(task));
@@ -354,7 +356,7 @@
final List<UiObject2> taskViews = getTasks();
mLauncher.assertNotEquals("Unable to find a task", 0, taskViews.size());
- final int gridTaskWidth = mLauncher.getGridTaskRectForTablet().width();
+ final int gridTaskWidth = mLauncher.getOverviewGridTaskSize().width();
return taskViews.stream().filter(t -> t.getVisibleBounds().width() == gridTaskWidth).map(
t -> new OverviewTask(mLauncher, t, this)).collect(Collectors.toList());
@@ -529,13 +531,17 @@
throw new IllegalStateException("Must be run on tablet device.");
}
final List<UiObject2> taskViews = getTasks();
- if (taskViews.size() == 0) {
+ if (taskViews.isEmpty()) {
return null;
}
- int focusedTaskHeight = mLauncher.getFocusedTaskHeightForTablet();
+ Rect focusTaskSize = mLauncher.getOverviewTaskSize();
+ testLogD(OVERVIEW_FOCUS_TASK_HEIGHT_MISMATCH, "focusTaskSize: " + focusTaskSize);
+ int focusedTaskHeight = focusTaskSize.height();
for (UiObject2 task : taskViews) {
OverviewTask overviewTask = new OverviewTask(mLauncher, task, this);
+ testLogD(OVERVIEW_FOCUS_TASK_HEIGHT_MISMATCH,
+ "overviewTask.getVisibleHeight(): " + overviewTask.getVisibleHeight());
if (overviewTask.getVisibleHeight() == focusedTaskHeight) {
return overviewTask;
}
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index a874062..d3c423e 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -428,14 +428,14 @@
.getInt(TestProtocol.TEST_INFO_RESPONSE_FIELD);
}
- int getFocusedTaskHeightForTablet() {
- return getTestInfo(TestProtocol.REQUEST_GET_FOCUSED_TASK_HEIGHT_FOR_TABLET).getInt(
- TestProtocol.TEST_INFO_RESPONSE_FIELD);
+ Rect getOverviewTaskSize() {
+ return getTestInfo(TestProtocol.REQUEST_GET_OVERVIEW_TASK_SIZE)
+ .getParcelable(TestProtocol.TEST_INFO_RESPONSE_FIELD, Rect.class);
}
- Rect getGridTaskRectForTablet() {
- return ((Rect) getTestInfo(TestProtocol.REQUEST_GET_GRID_TASK_SIZE_RECT_FOR_TABLET)
- .getParcelable(TestProtocol.TEST_INFO_RESPONSE_FIELD));
+ Rect getOverviewGridTaskSize() {
+ return getTestInfo(TestProtocol.REQUEST_GET_OVERVIEW_GRID_TASK_SIZE)
+ .getParcelable(TestProtocol.TEST_INFO_RESPONSE_FIELD, Rect.class);
}
int getOverviewPageSpacing() {
diff --git a/tests/tapl/com/android/launcher3/tapl/OverviewTask.java b/tests/tapl/com/android/launcher3/tapl/OverviewTask.java
index 7a8ab49..ab48a21 100644
--- a/tests/tapl/com/android/launcher3/tapl/OverviewTask.java
+++ b/tests/tapl/com/android/launcher3/tapl/OverviewTask.java
@@ -156,8 +156,8 @@
return;
}
- boolean taskWasFocused = mLauncher.isTablet() && getVisibleHeight() == mLauncher
- .getFocusedTaskHeightForTablet();
+ boolean taskWasFocused = mLauncher.isTablet()
+ && getVisibleHeight() == mLauncher.getOverviewTaskSize().height();
List<Integer> originalTasksCenterX =
getCurrentTasksCenterXList().stream().sorted().toList();
boolean isClearAllVisibleBeforeDismiss = mOverview.isClearAllVisible();