Merge "Getting starting point of swipe from overview to all apps via protocol" into ub-launcher3-qt-r1-dev

This commit is contained in:
TreeHugger Robot
2019-07-17 00:24:55 +00:00
committed by Android (Google) Code Review
4 changed files with 25 additions and 8 deletions
@@ -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 {
@@ -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;
}
}
@@ -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";
@@ -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")) {