mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-18 18:28:20 +00:00
Add Tapl support for swiping from All Apps to Workspace. am: 55d828b6f5
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/20551691 Change-Id: I79eb5f5b0dfa0d551c91969f75388477e86bc8f9 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -193,6 +193,15 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest {
|
||||
isInState(() -> LauncherState.ALL_APPS));
|
||||
}
|
||||
|
||||
@Test
|
||||
@PortraitLandscape
|
||||
public void testAllAppsSwitchToWorkspace() {
|
||||
assertNotNull("switchToWorkspace() returned null",
|
||||
mLauncher.getWorkspace().switchToAllApps().switchToWorkspace());
|
||||
assertTrue("Launcher internal state is not Workspace",
|
||||
isInState(() -> LauncherState.NORMAL));
|
||||
}
|
||||
|
||||
@Test
|
||||
@PortraitLandscape
|
||||
public void testAllAppsDeadzoneForTablet() throws Exception {
|
||||
|
||||
@@ -244,7 +244,7 @@ public abstract class AllApps extends LauncherInstrumentation.VisibleContainer {
|
||||
return mLauncher.waitForObjectInContainer(allAppsContainer, "apps_list_view");
|
||||
}
|
||||
|
||||
private UiObject2 getSearchBox(UiObject2 allAppsContainer) {
|
||||
protected UiObject2 getSearchBox(UiObject2 allAppsContainer) {
|
||||
return mLauncher.waitForObjectInContainer(allAppsContainer, "search_container_all_apps");
|
||||
}
|
||||
|
||||
|
||||
@@ -15,11 +15,17 @@
|
||||
*/
|
||||
package com.android.launcher3.tapl;
|
||||
|
||||
import static com.android.launcher3.testing.shared.TestProtocol.NORMAL_STATE_ORDINAL;
|
||||
|
||||
import android.graphics.Rect;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.test.uiautomator.UiObject2;
|
||||
|
||||
import com.android.launcher3.testing.shared.TestProtocol;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class HomeAllApps extends AllApps {
|
||||
private static final String BOTTOM_SHEET_RES_ID = "bottom_sheet_background";
|
||||
|
||||
@@ -27,6 +33,42 @@ public class HomeAllApps extends AllApps {
|
||||
super(launcher);
|
||||
}
|
||||
|
||||
/**
|
||||
* Swipes down to Workspace.
|
||||
*
|
||||
* @return the Workspace object.
|
||||
*/
|
||||
@NonNull
|
||||
public Workspace switchToWorkspace() {
|
||||
try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck();
|
||||
LauncherInstrumentation.Closable c =
|
||||
mLauncher.addContextLayer("want to switch from all apps to workspace")) {
|
||||
UiObject2 allAppsContainer = verifyActiveContainer();
|
||||
|
||||
final Rect searchBoxBounds = Objects.requireNonNull(
|
||||
mLauncher.getVisibleBounds(getSearchBox(allAppsContainer)));
|
||||
final int startX = searchBoxBounds.centerX();
|
||||
final int startY = searchBoxBounds.bottom;
|
||||
final int endY = mLauncher.getDevice().getDisplayHeight();
|
||||
LauncherInstrumentation.log(
|
||||
"switchToWorkspace: startY = " + startY + ", endY = " + endY
|
||||
+ ", slop = " + mLauncher.getTouchSlop());
|
||||
|
||||
mLauncher.swipeToState(
|
||||
startX,
|
||||
startY,
|
||||
startX,
|
||||
endY,
|
||||
12 /* steps */,
|
||||
NORMAL_STATE_ORDINAL, LauncherInstrumentation.GestureScope.INSIDE);
|
||||
|
||||
try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer(
|
||||
"swiped to workspace")) {
|
||||
return mLauncher.getWorkspace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected LauncherInstrumentation.ContainerType getContainerType() {
|
||||
return LauncherInstrumentation.ContainerType.HOME_ALL_APPS;
|
||||
|
||||
Reference in New Issue
Block a user