Revert "Change TAPL to swipe to stash taskbar (instead of deprec..."
Revert submission 25532044-tapl-transient-taskbar-default
Reason for revert: <test revert (b/314873201)>
Reverted changes: /q/submissionid:25532044-tapl-transient-taskbar-default
Change-Id: I51e78699f588a8fe8506c96398de921448e0ab6a
diff --git a/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java b/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java
index f801b3b..221ce48 100644
--- a/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java
+++ b/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java
@@ -106,10 +106,10 @@
});
return response;
- case TestProtocol.REQUEST_TASKBAR_FROM_NAV_THRESHOLD: {
+ case TestProtocol.REQUEST_STASHED_TASKBAR_HEIGHT: {
final Resources resources = mContext.getResources();
response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD,
- resources.getDimensionPixelSize(R.dimen.taskbar_from_nav_threshold));
+ resources.getDimensionPixelSize(R.dimen.taskbar_stashed_size));
return response;
}
diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsPersistentTaskbar.java b/quickstep/tests/src/com/android/quickstep/TaplTestsPersistentTaskbar.java
index c9e536a..9a2826d 100644
--- a/quickstep/tests/src/com/android/quickstep/TaplTestsPersistentTaskbar.java
+++ b/quickstep/tests/src/com/android/quickstep/TaplTestsPersistentTaskbar.java
@@ -20,10 +20,9 @@
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape;
-import com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch;
import com.android.quickstep.TaskbarModeSwitchRule.TaskbarModeSwitch;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -33,10 +32,17 @@
@Test
@TaskbarModeSwitch(mode = PERSISTENT)
- @PortraitLandscape
- @NavigationModeSwitch
- public void testTaskbarFillsWidth() {
- // Width check is performed inside TAPL whenever getTaskbar() is called.
- getTaskbar();
+ public void testHideShowTaskbar() {
+ getTaskbar().hide();
+ mLauncher.getLaunchedAppState().showTaskbar();
+ }
+
+ @Test
+ @TaskbarModeSwitch(mode = PERSISTENT)
+ @Ignore // b/301575789
+ public void testHideTaskbarPersistsOnRecreate() {
+ getTaskbar().hide();
+ mLauncher.recreateTaskbar();
+ mLauncher.getLaunchedAppState().assertTaskbarHidden();
}
}
diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
index a0651d0..8e142c3 100644
--- a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
+++ b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
@@ -18,6 +18,7 @@
import static com.android.launcher3.util.rule.TestStabilityRule.LOCAL;
import static com.android.launcher3.util.rule.TestStabilityRule.PLATFORM_POSTSUBMIT;
+import static com.android.quickstep.TaskbarModeSwitchRule.Mode.PERSISTENT;
import static com.android.quickstep.TaskbarModeSwitchRule.Mode.TRANSIENT;
import static org.junit.Assert.assertEquals;
@@ -294,7 +295,7 @@
}
@Test
- @TaskbarModeSwitch
+ @TaskbarModeSwitch(mode = PERSISTENT)
public void testQuickSwitchToPreviousAppForTablet() throws Exception {
assumeTrue(mLauncher.isTablet());
startTestActivity(2);
@@ -303,33 +304,22 @@
// Set ignoreTaskbarVisibility to true to verify the task bar visibility explicitly.
mLauncher.setIgnoreTaskbarVisibility(true);
-
- try {
- boolean isTransientTaskbar = mLauncher.isTransientTaskbar();
- // Expect task bar invisible when the launched app was the IME activity.
- LaunchedAppState launchedAppState = getAndAssertLaunchedApp();
- if (!isTransientTaskbar && isHardwareKeyboard()) {
- launchedAppState.assertTaskbarVisible();
- } else {
- launchedAppState.assertTaskbarHidden();
- }
-
- // Quick-switch to the test app with swiping to right.
- quickSwitchToPreviousAppAndAssert(true /* toRight */);
-
- assertTestActivityIsRunning(2,
- "The first app we should have quick switched to is not running");
- launchedAppState = getAndAssertLaunchedApp();
- if (isTransientTaskbar) {
- launchedAppState.assertTaskbarHidden();
- } else {
- // Expect taskbar visible when the launched app was the test activity.
- launchedAppState.assertTaskbarVisible();
- }
- } finally {
- // Reset ignoreTaskbarVisibility to ensure other tests still verify it.
- mLauncher.setIgnoreTaskbarVisibility(false);
+ // Expect task bar invisible when the launched app was the IME activity.
+ LaunchedAppState launchedAppState = getAndAssertLaunchedApp();
+ if (isHardwareKeyboard()) {
+ launchedAppState.assertTaskbarVisible();
+ } else {
+ launchedAppState.assertTaskbarHidden();
}
+
+ // Quick-switch to the test app with swiping to right.
+ quickSwitchToPreviousAppAndAssert(true /* toRight */);
+
+ assertTestActivityIsRunning(2,
+ "The first app we should have quick switched to is not running");
+ // Expect task bar visible when the launched app was the test activity.
+ launchedAppState = getAndAssertLaunchedApp();
+ launchedAppState.assertTaskbarVisible();
}
private boolean isHardwareKeyboard() {
@@ -368,7 +358,7 @@
@Test
@PortraitLandscape
- @TaskbarModeSwitch()
+ @TaskbarModeSwitch(mode = PERSISTENT)
@PlatinumTest(focusArea = "launcher")
@TestStabilityRule.Stability(flavors = LOCAL | PLATFORM_POSTSUBMIT) // b/309820115
@ScreenRecord // b/309820115
@@ -464,7 +454,6 @@
@Test
@PortraitLandscape
- @TaskbarModeSwitch
public void testTaskbarDeadzonesForTablet() throws Exception {
assumeTrue(mLauncher.isTablet());
@@ -477,29 +466,15 @@
launcher -> assertTrue("Should have at least 3 tasks",
getTaskCount(launcher) >= 3));
- if (mLauncher.isTransientTaskbar()) {
- // On transient taskbar, it should dismiss when tapping outside taskbar bounds.
- overview.touchTaskbarBottomCorner(/* tapRight= */ false);
- assertTrue("Launcher internal state should be Normal",
- isInState(() -> LauncherState.NORMAL));
+ // On persistent taskbar, it should not dismiss when tapping the taskbar
+ overview.touchTaskbarBottomCorner(/* tapRight= */ false);
+ assertTrue("Launcher internal state should be Overview",
+ isInState(() -> LauncherState.OVERVIEW));
- overview = mLauncher.getWorkspace().switchToOverview();
-
- // On transient taskbar, it should dismiss when tapping outside taskbar bounds.
- overview.touchTaskbarBottomCorner(/* tapRight= */ true);
- assertTrue("Launcher internal state should be Normal",
- isInState(() -> LauncherState.NORMAL));
- } else {
- // On persistent taskbar, it should not dismiss when tapping the taskbar
- overview.touchTaskbarBottomCorner(/* tapRight= */ false);
- assertTrue("Launcher internal state should be Overview",
- isInState(() -> LauncherState.OVERVIEW));
-
- // On persistent taskbar, it should not dismiss when tapping the taskbar
- overview.touchTaskbarBottomCorner(/* tapRight= */ true);
- assertTrue("Launcher internal state should be Overview",
- isInState(() -> LauncherState.OVERVIEW));
- }
+ // On persistent taskbar, it should not dismiss when tapping the taskbar
+ overview.touchTaskbarBottomCorner(/* tapRight= */ true);
+ assertTrue("Launcher internal state should be Overview",
+ isInState(() -> LauncherState.OVERVIEW));
}
@Test
diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsTransientTaskbar.java b/quickstep/tests/src/com/android/quickstep/TaplTestsTransientTaskbar.java
index 7109bbf..db23cc0 100644
--- a/quickstep/tests/src/com/android/quickstep/TaplTestsTransientTaskbar.java
+++ b/quickstep/tests/src/com/android/quickstep/TaplTestsTransientTaskbar.java
@@ -24,7 +24,6 @@
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape;
import com.android.quickstep.TaskbarModeSwitchRule.TaskbarModeSwitch;
import org.junit.Test;
@@ -65,12 +64,4 @@
getTaskbar().getAppIcon(TEST_APP_NAME).launch(TEST_APP_PACKAGE);
mLauncher.getLaunchedAppState().clickStashedTaskbarToGoHome();
}
-
- @Test
- @TaskbarModeSwitch(mode = TRANSIENT)
- @PortraitLandscape
- public void testSwipeToStashAndUnstash() {
- getTaskbar().swipeDownToStash();
- mLauncher.getLaunchedAppState().swipeUpToUnstashTaskbar();
- }
}
diff --git a/src/com/android/launcher3/testing/TestInformationHandler.java b/src/com/android/launcher3/testing/TestInformationHandler.java
index d9641ad..0438e57 100644
--- a/src/com/android/launcher3/testing/TestInformationHandler.java
+++ b/src/com/android/launcher3/testing/TestInformationHandler.java
@@ -47,7 +47,6 @@
import com.android.launcher3.testing.shared.HotseatCellCenterRequest;
import com.android.launcher3.testing.shared.TestProtocol;
import com.android.launcher3.testing.shared.WorkspaceCellCenterRequest;
-import com.android.launcher3.util.DisplayController;
import com.android.launcher3.util.ResourceBasedOverride;
import com.android.launcher3.widget.picker.WidgetsFullSheet;
@@ -171,11 +170,6 @@
mDeviceProfile.numShownAllAppsColumns);
return response;
- case TestProtocol.REQUEST_IS_TRANSIENT_TASKBAR:
- response.putBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD,
- DisplayController.isTransientTaskbar(mContext));
- return response;
-
case TestProtocol.REQUEST_IS_TWO_PANELS:
response.putBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD,
FOLDABLE_SINGLE_PAGE.get() ? false : mDeviceProfile.isTwoPanels);
diff --git a/src/com/android/launcher3/util/DisplayController.java b/src/com/android/launcher3/util/DisplayController.java
index 045ca79..4c83668 100644
--- a/src/com/android/launcher3/util/DisplayController.java
+++ b/src/com/android/launcher3/util/DisplayController.java
@@ -71,7 +71,7 @@
private static final String TAG = "DisplayController";
private static final boolean DEBUG = false;
- private static boolean sTransientTaskbarStatusForTests = true;
+ private static boolean sTransientTaskbarStatusForTests;
// TODO(b/254119092) remove all logs with this tag
public static final String TASKBAR_NOT_DESTROYED_TAG = "b/254119092";
diff --git a/src/com/android/launcher3/views/BaseDragLayer.java b/src/com/android/launcher3/views/BaseDragLayer.java
index a1cd697..e4df413 100644
--- a/src/com/android/launcher3/views/BaseDragLayer.java
+++ b/src/com/android/launcher3/views/BaseDragLayer.java
@@ -41,7 +41,6 @@
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.InsettableFrameLayout;
import com.android.launcher3.Utilities;
-import com.android.launcher3.testing.shared.ResourceUtils;
import com.android.launcher3.util.MultiPropertyFactory.MultiProperty;
import com.android.launcher3.util.MultiValueAlpha;
import com.android.launcher3.util.TouchController;
@@ -560,8 +559,7 @@
DeviceProfile dp = mActivity.getDeviceProfile();
if (dp.isTaskbarPresent) {
// Ignore taskbar gesture insets to avoid interfering with TouchControllers.
- gestureInsetBottom = ResourceUtils.getNavbarSize(
- ResourceUtils.NAVBAR_BOTTOM_GESTURE_SIZE, getResources());
+ gestureInsetBottom = Math.max(0, gestureInsetBottom - dp.taskbarHeight);
}
mSystemGestureRegion.set(
Math.max(gestureInsets.left, imeInset.left),
diff --git a/tests/shared/com/android/launcher3/testing/shared/TestProtocol.java b/tests/shared/com/android/launcher3/testing/shared/TestProtocol.java
index 26169b8..e1b06a8 100644
--- a/tests/shared/com/android/launcher3/testing/shared/TestProtocol.java
+++ b/tests/shared/com/android/launcher3/testing/shared/TestProtocol.java
@@ -93,9 +93,8 @@
public static final String REQUEST_DISABLE_BLOCK_TIMEOUT = "disable-block-timeout";
public static final String REQUEST_ENABLE_TRANSIENT_TASKBAR = "enable-transient-taskbar";
public static final String REQUEST_DISABLE_TRANSIENT_TASKBAR = "disable-transient-taskbar";
- public static final String REQUEST_IS_TRANSIENT_TASKBAR = "is-transient-taskbar";
public static final String REQUEST_UNSTASH_TASKBAR_IF_STASHED = "unstash-taskbar-if-stashed";
- public static final String REQUEST_TASKBAR_FROM_NAV_THRESHOLD = "taskbar-from-nav-threshold";
+ public static final String REQUEST_STASHED_TASKBAR_HEIGHT = "stashed-taskbar-height";
public static final String REQUEST_STASHED_TASKBAR_SCALE = "taskbar-stash-handle-scale";
public static final String REQUEST_RECREATE_TASKBAR = "recreate-taskbar";
public static final String REQUEST_APP_LIST_FREEZE_FLAGS = "app-list-freeze-flags";
diff --git a/tests/tapl/com/android/launcher3/tapl/BaseOverview.java b/tests/tapl/com/android/launcher3/tapl/BaseOverview.java
index b6b4a47..44869be 100644
--- a/tests/tapl/com/android/launcher3/tapl/BaseOverview.java
+++ b/tests/tapl/com/android/launcher3/tapl/BaseOverview.java
@@ -186,14 +186,7 @@
try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck()) {
Taskbar taskbar = new Taskbar(mLauncher);
taskbar.touchBottomCorner(tapRight);
- if (mLauncher.isTransientTaskbar()) {
- // Tapping outside Transient Taskbar returns to Workspace, wait for that state.
- new Workspace(mLauncher);
- } else {
- // Should stay in Overview.
- verifyActiveContainer();
- verifyActionsViewVisibility();
- }
+ verifyActiveContainer();
}
}
diff --git a/tests/tapl/com/android/launcher3/tapl/LaunchedAppState.java b/tests/tapl/com/android/launcher3/tapl/LaunchedAppState.java
index 6d58a35..efeb5f6 100644
--- a/tests/tapl/com/android/launcher3/tapl/LaunchedAppState.java
+++ b/tests/tapl/com/android/launcher3/tapl/LaunchedAppState.java
@@ -20,11 +20,12 @@
import static com.android.launcher3.tapl.LauncherInstrumentation.TASKBAR_RES_ID;
import static com.android.launcher3.tapl.LauncherInstrumentation.WAIT_TIME_MS;
import static com.android.launcher3.testing.shared.TestProtocol.REQUEST_DISABLE_BLOCK_TIMEOUT;
+import static com.android.launcher3.testing.shared.TestProtocol.REQUEST_DISABLE_MANUAL_TASKBAR_STASHING;
import static com.android.launcher3.testing.shared.TestProtocol.REQUEST_ENABLE_BLOCK_TIMEOUT;
+import static com.android.launcher3.testing.shared.TestProtocol.REQUEST_ENABLE_MANUAL_TASKBAR_STASHING;
import static com.android.launcher3.testing.shared.TestProtocol.REQUEST_SHELL_DRAG_READY;
+import static com.android.launcher3.testing.shared.TestProtocol.REQUEST_STASHED_TASKBAR_HEIGHT;
import static com.android.launcher3.testing.shared.TestProtocol.REQUEST_STASHED_TASKBAR_SCALE;
-import static com.android.launcher3.testing.shared.TestProtocol.REQUEST_TASKBAR_FROM_NAV_THRESHOLD;
-import static com.android.launcher3.testing.shared.TestProtocol.TEST_INFO_RESPONSE_FIELD;
import android.graphics.Point;
import android.graphics.Rect;
@@ -83,6 +84,8 @@
public Taskbar getTaskbar() {
try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
"want to get the taskbar")) {
+ mLauncher.waitForSystemLauncherObject(TASKBAR_RES_ID);
+
return new Taskbar(mLauncher);
}
}
@@ -110,32 +113,37 @@
/**
* Returns the Taskbar in a visible state.
*
- * The taskbar must already be hidden and in transient mode when calling this method.
+ * The taskbar must already be hidden when calling this method.
*/
- public Taskbar swipeUpToUnstashTaskbar() {
- mLauncher.assertTrue("Taskbar is not transient, swipe up not supported",
- mLauncher.isTransientTaskbar());
-
+ public Taskbar showTaskbar() {
+ mLauncher.getTestInfo(REQUEST_ENABLE_MANUAL_TASKBAR_STASHING);
mLauncher.getTestInfo(REQUEST_ENABLE_BLOCK_TIMEOUT);
try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck();
LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer(
- "want to swipe up to unstash the taskbar")) {
+ "want to show the taskbar")) {
mLauncher.waitUntilSystemLauncherObjectGone(TASKBAR_RES_ID);
- int taskbarFromNavThreshold = mLauncher.getTestInfo(REQUEST_TASKBAR_FROM_NAV_THRESHOLD)
- .getInt(TEST_INFO_RESPONSE_FIELD);
- int startX = mLauncher.getRealDisplaySize().x / 2;
- int startY = mLauncher.getRealDisplaySize().y - 1;
- int endX = startX;
- int endY = startY - taskbarFromNavThreshold;
+ final long downTime = SystemClock.uptimeMillis();
+ final int unstashTargetY = mLauncher.getRealDisplaySize().y
+ - (mLauncher.getTestInfo(REQUEST_STASHED_TASKBAR_HEIGHT)
+ .getInt(TestProtocol.TEST_INFO_RESPONSE_FIELD) / 2);
+ final Point unstashTarget = new Point(
+ mLauncher.getRealDisplaySize().x / 2, unstashTargetY);
- mLauncher.linearGesture(startX, startY, endX, endY, 10, /* slowDown= */ true,
+ mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_DOWN, unstashTarget,
LauncherInstrumentation.GestureScope.EXPECT_PILFER);
- LauncherInstrumentation.log("swipeUpToUnstashTaskbar: sent linear swipe up gesture");
+ LauncherInstrumentation.log("showTaskbar: sent down");
- return new Taskbar(mLauncher);
+ try (LauncherInstrumentation.Closable c2 = mLauncher.addContextLayer("pressed down")) {
+ mLauncher.waitForSystemLauncherObject(TASKBAR_RES_ID);
+ mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_UP, unstashTarget,
+ LauncherInstrumentation.GestureScope.EXPECT_PILFER);
+
+ return new Taskbar(mLauncher);
+ }
} finally {
+ mLauncher.getTestInfo(REQUEST_DISABLE_MANUAL_TASKBAR_STASHING);
mLauncher.getTestInfo(REQUEST_DISABLE_BLOCK_TIMEOUT);
}
}
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index 682a36d..720c8e5 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -825,7 +825,12 @@
waitUntilSystemLauncherObjectGone(OVERVIEW_RES_ID);
waitUntilSystemLauncherObjectGone(SPLIT_PLACEHOLDER_RES_ID);
waitUntilLauncherObjectGone(KEYBOARD_QUICK_SWITCH_RES_ID);
- waitUntilSystemLauncherObjectGone(TASKBAR_RES_ID);
+
+ if (is3PLauncher() && isTablet()) {
+ waitForSystemLauncherObject(TASKBAR_RES_ID);
+ } else {
+ waitUntilSystemLauncherObjectGone(TASKBAR_RES_ID);
+ }
return waitForLauncherObject(WORKSPACE_RES_ID);
}
@@ -835,7 +840,12 @@
waitUntilSystemLauncherObjectGone(OVERVIEW_RES_ID);
waitUntilSystemLauncherObjectGone(SPLIT_PLACEHOLDER_RES_ID);
waitUntilLauncherObjectGone(KEYBOARD_QUICK_SWITCH_RES_ID);
- waitUntilSystemLauncherObjectGone(TASKBAR_RES_ID);
+
+ if (is3PLauncher() && isTablet()) {
+ waitForSystemLauncherObject(TASKBAR_RES_ID);
+ } else {
+ waitUntilSystemLauncherObjectGone(TASKBAR_RES_ID);
+ }
return waitForLauncherObject(WIDGETS_RES_ID);
}
@@ -856,7 +866,7 @@
waitUntilSystemLauncherObjectGone(SPLIT_PLACEHOLDER_RES_ID);
waitUntilLauncherObjectGone(KEYBOARD_QUICK_SWITCH_RES_ID);
- if (is3PLauncher() && isTablet() && !isTransientTaskbar()) {
+ if (is3PLauncher() && isTablet()) {
waitForSystemLauncherObject(TASKBAR_RES_ID);
} else {
waitUntilSystemLauncherObjectGone(TASKBAR_RES_ID);
@@ -869,7 +879,7 @@
waitUntilLauncherObjectGone(APPS_RES_ID);
waitUntilLauncherObjectGone(WORKSPACE_RES_ID);
waitUntilLauncherObjectGone(WIDGETS_RES_ID);
- if (isTablet() && !is3PLauncher()) {
+ if (isTablet()) {
waitForSystemLauncherObject(TASKBAR_RES_ID);
} else {
waitUntilSystemLauncherObjectGone(TASKBAR_RES_ID);
@@ -906,11 +916,7 @@
}
if (isTablet()) {
- // Only check that Persistent Taskbar is visible, since Transient Taskbar
- // may or may not be visible by design.
- if (!isTransientTaskbar()) {
- waitForSystemLauncherObject(TASKBAR_RES_ID);
- }
+ waitForSystemLauncherObject(TASKBAR_RES_ID);
} else {
waitUntilSystemLauncherObjectGone(TASKBAR_RES_ID);
}
@@ -984,7 +990,7 @@
/**
* Using swiping up gesture to dismiss closable floating views, such as Menu or Folder Content.
*/
- private void swipeUpToCloseFloatingView() {
+ private void swipeUpToCloseFloatingView(boolean gestureStartFromLauncher) {
final Point displaySize = getRealDisplaySize();
final Optional<String> floatingRes = getFloatingResId();
@@ -993,11 +999,16 @@
return;
}
+ GestureScope gestureScope = gestureStartFromLauncher
+ // Without the navigation bar layer, the gesture scope on tablets remains inside the
+ // launcher process.
+ ? (isTablet() ? GestureScope.DONT_EXPECT_PILFER : GestureScope.EXPECT_PILFER)
+ : GestureScope.EXPECT_PILFER;
linearGesture(
displaySize.x / 2, displaySize.y - 1,
displaySize.x / 2, 0,
ZERO_BUTTON_STEPS_FROM_BACKGROUND_TO_HOME,
- false, GestureScope.EXPECT_PILFER);
+ false, gestureScope);
try (LauncherInstrumentation.Closable c1 = addContextLayer(
String.format("Swiped up from floating view %s to home", floatingRes.get()))) {
@@ -1065,8 +1076,11 @@
final Point displaySize = getRealDisplaySize();
+ boolean gestureStartFromLauncher =
+ isTablet() ? !isLauncher3() : isLauncherVisible();
+
// CLose floating views before going back to home.
- swipeUpToCloseFloatingView();
+ swipeUpToCloseFloatingView(gestureStartFromLauncher);
if (hasLauncherObject(WORKSPACE_RES_ID)) {
log(action = "already at home");
@@ -2001,7 +2015,6 @@
}
}
- /** Returns the bounds of the display as a Point where x is width and y is height. */
Point getRealDisplaySize() {
final Rect displayBounds = getContext().getSystemService(WindowManager.class)
.getMaximumWindowMetrics()
@@ -2064,11 +2077,6 @@
: TestProtocol.REQUEST_DISABLE_BLOCK_TIMEOUT);
}
- public boolean isTransientTaskbar() {
- return getTestInfo(TestProtocol.REQUEST_IS_TRANSIENT_TASKBAR)
- .getBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD);
- }
-
/** Enables transient taskbar for testing purposes only. */
public void enableTransientTaskbar(boolean enable) {
getTestInfo(enable
diff --git a/tests/tapl/com/android/launcher3/tapl/Taskbar.java b/tests/tapl/com/android/launcher3/tapl/Taskbar.java
index a202c53..da26694 100644
--- a/tests/tapl/com/android/launcher3/tapl/Taskbar.java
+++ b/tests/tapl/com/android/launcher3/tapl/Taskbar.java
@@ -18,6 +18,8 @@
import static android.view.KeyEvent.KEYCODE_META_RIGHT;
import static com.android.launcher3.tapl.LauncherInstrumentation.TASKBAR_RES_ID;
+import static com.android.launcher3.testing.shared.TestProtocol.REQUEST_DISABLE_MANUAL_TASKBAR_STASHING;
+import static com.android.launcher3.testing.shared.TestProtocol.REQUEST_ENABLE_MANUAL_TASKBAR_STASHING;
import android.graphics.Point;
import android.graphics.Rect;
@@ -31,8 +33,6 @@
import androidx.test.uiautomator.BySelector;
import androidx.test.uiautomator.UiObject2;
-import org.junit.Assert;
-
import java.util.List;
import java.util.stream.Collectors;
@@ -45,15 +45,6 @@
Taskbar(LauncherInstrumentation launcher) {
mLauncher = launcher;
- try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
- "expect new taskbar to be visible")) {
- mLauncher.waitForSystemLauncherObject(TASKBAR_RES_ID);
- }
-
- if (!mLauncher.isTransientTaskbar()) {
- Assert.assertEquals("Persistent taskbar should fill screen width",
- getVisibleBounds().width(), mLauncher.getRealDisplaySize().x);
- }
}
/**
@@ -70,32 +61,33 @@
}
/**
- * Stashes this taskbar.
- * <p>
- * The taskbar must already be unstashed and in transient mode when calling this method.
+ * Hides this taskbar.
+ *
+ * The taskbar must already be visible when calling this method.
*/
- public void swipeDownToStash() {
- mLauncher.assertTrue("Taskbar is not transient, swipe down not supported",
- mLauncher.isTransientTaskbar());
+ public void hide() {
+ mLauncher.getTestInfo(REQUEST_ENABLE_MANUAL_TASKBAR_STASHING);
try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
"want to hide the taskbar");
LauncherInstrumentation.Closable e = mLauncher.eventsCheck()) {
mLauncher.waitForSystemLauncherObject(TASKBAR_RES_ID);
- Rect taskbarBounds = getVisibleBounds();
- int startX = taskbarBounds.centerX();
- int startY = taskbarBounds.centerY();
- int endX = startX;
- int endY = mLauncher.getRealDisplaySize().y - 1;
+ final long downTime = SystemClock.uptimeMillis();
+ Point stashTarget = new Point(
+ mLauncher.getRealDisplaySize().x - 1, mLauncher.getRealDisplaySize().y - 1);
- mLauncher.linearGesture(startX, startY, endX, endY, 10, false,
+ mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_DOWN, stashTarget,
LauncherInstrumentation.GestureScope.DONT_EXPECT_PILFER);
- LauncherInstrumentation.log("swipeDownToStash: sent linear swipe down gesture");
- try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer(
- "expect transient taskbar to be hidden after swipe down")) {
+ LauncherInstrumentation.log("hideTaskbar: sent down");
+
+ try (LauncherInstrumentation.Closable c2 = mLauncher.addContextLayer("pressed down")) {
mLauncher.waitUntilSystemLauncherObjectGone(TASKBAR_RES_ID);
+ mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_UP, stashTarget,
+ LauncherInstrumentation.GestureScope.DONT_EXPECT_PILFER);
}
+ } finally {
+ mLauncher.getTestInfo(REQUEST_DISABLE_MANUAL_TASKBAR_STASHING);
}
}