{
l -> findBtv(TEST_APP_NAME, l.getAppsView()));
TestUtil.runOnExecutorSync(MAIN_EXECUTOR, btv::performLongClick);
- BubbleTextView menuItem = getOnceNotNull("Popup menu not open", l ->
- (AbstractFloatingView.getOpenView(l, TYPE_ACTION_POPUP) instanceof ArrowPopup ap)
- ? findBtv(SHORTCUT_NAME, ap) : null);
+ BubbleTextView menuItem = getLauncherActivity().getOnceNotNull(
+ "Popup menu not open",
+ l -> (AbstractFloatingView.getOpenView(l, TYPE_ACTION_POPUP)
+ instanceof ArrowPopup ap)
+ ? findBtv(SHORTCUT_NAME, ap) : null
+ );
addToWorkspace(menuItem);
getLauncherActivity().executeOnLauncher(
l -> verifyIconTheme(SHORTCUT_NAME, l.getWorkspace(), true));
diff --git a/tests/tapl/com/android/launcher3/tapl/LaunchedAppState.java b/tests/tapl/com/android/launcher3/tapl/LaunchedAppState.java
index 3e4cf80941..f9ef1b8f3c 100644
--- a/tests/tapl/com/android/launcher3/tapl/LaunchedAppState.java
+++ b/tests/tapl/com/android/launcher3/tapl/LaunchedAppState.java
@@ -36,6 +36,7 @@ import android.view.ViewConfiguration;
import androidx.annotation.NonNull;
import androidx.test.uiautomator.Condition;
import androidx.test.uiautomator.UiDevice;
+import androidx.test.uiautomator.UiObject2;
import com.android.launcher3.tapl.Taskbar.TaskbarLocation;
import com.android.launcher3.testing.shared.ResourceUtils;
@@ -240,26 +241,56 @@ public final class LaunchedAppState extends Background {
* This unstashing occurs when not actively hovering the taskbar.
*/
public Taskbar hoverScreenBottomEdgeToUnstashTaskbar() {
+ return hoverScreenBottomEdgeToTryUnstashTaskbar(/* leftEdge= */
+ (mLauncher.getRealDisplaySize().x - mLauncher.getTaskbarUnstashInputArea()) / 2
+ - 1);
+ }
+
+ /**
+ * Emulate the cursor hovering the screen edge outside of action corner area to unstash the
+ * taskbar.
+ */
+ public Taskbar hoverScreenBottomEdgeOutsideActionCornerToUnstashTaskbar() {
+ return hoverScreenBottomEdgeToTryUnstashTaskbar(/* leftEdge= */
+ getLauncher().getActionCornerPadding());
+ }
+
+ /**
+ * Emulate the cursor hovering the screen edge in action corner padding to try unstashing the
+ * taskbar.
+ */
+ public Taskbar hoverScreenBottomCornerToTryUnstashTaskbar() {
+ // Add 1 pixel to avoid triggering action corner which will affect test result
+ return hoverScreenBottomEdgeToTryUnstashTaskbar(
+ mLauncher.getDisplayBottomCornerRadius() + 1);
+ }
+
+ private Taskbar hoverScreenBottomEdgeToTryUnstashTaskbar(int leftEdge) {
try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck();
LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
- "cursor hover entering screen edge to unstash taskbar")) {
+ "cursor hover entering screen edge to try unstashing taskbar")) {
mLauncher.getDevice().wait(mStashedTaskbarDefaultScaleCondition,
ViewConfiguration.DEFAULT_LONG_PRESS_TIMEOUT);
long downTime = SystemClock.uptimeMillis();
- int leftEdge = 10;
Point taskbarUnstashArea = new Point(leftEdge, mLauncher.getRealDisplaySize().y - 1);
mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_HOVER_ENTER,
new Point(taskbarUnstashArea.x, taskbarUnstashArea.y), null,
InputDevice.SOURCE_MOUSE);
- mLauncher.waitForSystemLauncherObject(TASKBAR_RES_ID);
+ UiObject2 taskbar = mLauncher.tryWaitForLauncherObject(
+ mLauncher.getLauncherObjectSelector(TASKBAR_RES_ID),
+ WAIT_TIME_MS);
mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_HOVER_EXIT,
new Point(taskbarUnstashArea.x, taskbarUnstashArea.y), null,
InputDevice.SOURCE_MOUSE);
- return new Taskbar(mLauncher, TaskbarLocation.LAUNCHED_APP);
+ if (taskbar == null) {
+ return null;
+ } else {
+ return new Taskbar(mLauncher, TaskbarLocation.LAUNCHED_APP);
+ }
}
}
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index 56a9a94d5a..b6377d6eb0 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -22,10 +22,12 @@ import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
import static android.content.pm.PackageManager.DONT_KILL_APP;
import static android.content.pm.PackageManager.MATCH_ALL;
import static android.content.pm.PackageManager.MATCH_DISABLED_COMPONENTS;
+import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.KeyEvent.ACTION_DOWN;
import static android.view.MotionEvent.ACTION_SCROLL;
import static android.view.MotionEvent.ACTION_UP;
import static android.view.MotionEvent.AXIS_GESTURE_SWIPE_FINGER_COUNT;
+import static android.view.RoundedCorner.POSITION_BOTTOM_LEFT;
import static android.view.Surface.ROTATION_90;
import static com.android.launcher3.tapl.Folder.FOLDER_CONTENT_RES_ID;
@@ -51,6 +53,7 @@ import android.content.res.Resources;
import android.graphics.Insets;
import android.graphics.Point;
import android.graphics.Rect;
+import android.hardware.display.DisplayManager;
import android.net.Uri;
import android.os.Bundle;
import android.os.DeadObjectException;
@@ -60,6 +63,7 @@ import android.os.SystemClock;
import android.os.Trace;
import android.text.TextUtils;
import android.util.Log;
+import android.view.Display;
import android.view.InputDevice;
import android.view.InputEvent;
import android.view.KeyCharacterMap;
@@ -95,6 +99,7 @@ import java.util.Arrays;
import java.util.Deque;
import java.util.LinkedList;
import java.util.List;
+import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.TimeoutException;
import java.util.function.BooleanSupplier;
@@ -2479,6 +2484,17 @@ public final class LauncherInstrumentation {
return new Point(displayBounds.width(), displayBounds.height());
}
+ int getActionCornerPadding() {
+ return getDisplayBottomCornerRadius() + getTaskbarActionCornerPadding();
+ }
+
+ int getDisplayBottomCornerRadius() {
+ final Display display = Objects.requireNonNull(
+ getContext().getSystemService(DisplayManager.class))
+ .getDisplay(DEFAULT_DISPLAY);
+ return display.getRoundedCorner(POSITION_BOTTOM_LEFT).getRadius();
+ }
+
public void enableDebugTracing() {
getTestInfo(TestProtocol.REQUEST_ENABLE_DEBUG_TRACING);
}
@@ -2811,4 +2827,16 @@ public final class LauncherInstrumentation {
return getTestInfo(TestProtocol.REQUEST_DISMISS_MAGNETIC_DETACH_THRESHOLD).getInt(
TestProtocol.TEST_INFO_RESPONSE_FIELD);
}
+
+ /** Returns the taskbar action corner padding. */
+ public int getTaskbarActionCornerPadding() {
+ return getTestInfo(TestProtocol.REQUEST_TASKBAR_ACTION_CORNER_PADDING).getInt(
+ TestProtocol.TEST_INFO_RESPONSE_FIELD);
+ }
+
+ /** Returns the taskbar unstash input area. */
+ public int getTaskbarUnstashInputArea() {
+ return getTestInfo(TestProtocol.REQUEST_TASKBAR_UNSTASHED_INPUT_AREA).getInt(
+ TestProtocol.TEST_INFO_RESPONSE_FIELD);
+ }
}