diff options
4 files changed, 25 insertions, 8 deletions
diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java index 6030cea93..109d751c4 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java @@ -51,7 +51,6 @@ import com.android.quickstep.OverviewInteractionState; import com.android.quickstep.RecentsModel; import com.android.quickstep.TouchInteractionService; import com.android.quickstep.util.LayoutUtils; -import com.android.systemui.shared.system.QuickStepContract; /** * Touch controller for handling various state transitions in portrait UI. @@ -296,9 +295,13 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr * @return true if the event is over the hotseat */ static boolean isTouchOverHotseat(Launcher launcher, MotionEvent ev) { + return (ev.getY() >= getHotseatTop(launcher)); + } + + public static int getHotseatTop(Launcher launcher) { DeviceProfile dp = launcher.getDeviceProfile(); int hotseatHeight = dp.hotseatBarSizePx + dp.getInsets().bottom; - return (ev.getY() >= (launcher.getDragLayer().getHeight() - hotseatHeight)); + return launcher.getDragLayer().getHeight() - hotseatHeight; } private static class InterpolatorWrapper implements Interpolator { diff --git a/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java b/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java index b59e13362..57ed244d2 100644 --- a/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java +++ b/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java @@ -6,6 +6,7 @@ import android.os.Bundle; import com.android.launcher3.testing.TestInformationHandler; import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.uioverrides.states.OverviewState; +import com.android.launcher3.uioverrides.touchcontrollers.PortraitStatesTouchController; import com.android.quickstep.util.LayoutUtils; public class QuickstepTestInformationHandler extends TestInformationHandler { @@ -34,7 +35,15 @@ public class QuickstepTestInformationHandler extends TestInformationHandler { case TestProtocol.REQUEST_IS_LAUNCHER_INITIALIZED: { response.putBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD, TouchInteractionService.isInputMonitorInitialized()); - break; + return response; + } + + case TestProtocol.REQUEST_HOTSEAT_TOP: { + if (mLauncher == null) return null; + + response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD, + PortraitStatesTouchController.getHotseatTop(mLauncher)); + return response; } } diff --git a/src/com/android/launcher3/testing/TestProtocol.java b/src/com/android/launcher3/testing/TestProtocol.java index e28eba809..f6a26925b 100644 --- a/src/com/android/launcher3/testing/TestProtocol.java +++ b/src/com/android/launcher3/testing/TestProtocol.java @@ -66,6 +66,7 @@ public final class TestProtocol { "all-apps-to-overview-swipe-height"; public static final String REQUEST_HOME_TO_ALL_APPS_SWIPE_HEIGHT = "home-to-all-apps-swipe-height"; + public static final String REQUEST_HOTSEAT_TOP = "hotseat-top"; public static final String REQUEST_IS_LAUNCHER_INITIALIZED = "is-launcher-initialized"; public static final String REQUEST_FREEZE_APP_LIST = "freeze-app-list"; public static final String REQUEST_UNFREEZE_APP_LIST = "unfreeze-app-list"; diff --git a/tests/tapl/com/android/launcher3/tapl/Overview.java b/tests/tapl/com/android/launcher3/tapl/Overview.java index 058831f18..da68da3ba 100644 --- a/tests/tapl/com/android/launcher3/tapl/Overview.java +++ b/tests/tapl/com/android/launcher3/tapl/Overview.java @@ -19,9 +19,9 @@ package com.android.launcher3.tapl; import static com.android.launcher3.testing.TestProtocol.ALL_APPS_STATE_ORDINAL; import androidx.annotation.NonNull; -import androidx.test.uiautomator.UiObject2; import com.android.launcher3.tapl.LauncherInstrumentation.ContainerType; +import com.android.launcher3.testing.TestProtocol; /** * Overview pane. @@ -51,11 +51,15 @@ public final class Overview extends BaseOverview { // Swipe from an app icon to the top. LauncherInstrumentation.log("Overview.switchToAllApps before swipe"); - final UiObject2 allApps = mLauncher.waitForLauncherObject("apps_view"); - mLauncher.swipeToState(mLauncher.getDevice().getDisplayWidth() / 2, - allApps.getVisibleBounds().top, + mLauncher.swipeToState( mLauncher.getDevice().getDisplayWidth() / 2, - 0, 50, ALL_APPS_STATE_ORDINAL); + mLauncher.getTestInfo( + TestProtocol.REQUEST_HOTSEAT_TOP). + getInt(TestProtocol.TEST_INFO_RESPONSE_FIELD), + mLauncher.getDevice().getDisplayWidth() / 2, + 0, + 50, + ALL_APPS_STATE_ORDINAL); try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer( "swiped all way up from overview")) { |