Fix scroll task off screen to support different screen dimensions.
This will fix the breaks on cuttlefish as seen in b/203781041. Test: TaplTestsQuickstep.java Bug: 197630182 Change-Id: I3b582a9df1790543c4e1521b45494fb462bb5c1c
This commit is contained in:
parent
8893098446
commit
1b5975c205
|
@ -43,7 +43,6 @@ import com.android.quickstep.views.RecentsView;
|
||||||
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Ignore;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
@ -289,7 +288,6 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@PortraitLandscape
|
@PortraitLandscape
|
||||||
@Ignore("b/203781041")
|
|
||||||
public void testOverviewForTablet() throws Exception {
|
public void testOverviewForTablet() throws Exception {
|
||||||
if (!mLauncher.isTablet()) {
|
if (!mLauncher.isTablet()) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -54,18 +54,14 @@ public class BaseOverview extends LauncherInstrumentation.VisibleContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void flingForwardImpl() {
|
private void flingForwardImpl() {
|
||||||
flingForwardImpl(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void flingForwardImpl(int rightMargin) {
|
|
||||||
try (LauncherInstrumentation.Closable c =
|
try (LauncherInstrumentation.Closable c =
|
||||||
mLauncher.addContextLayer("want to fling forward in overview")) {
|
mLauncher.addContextLayer("want to fling forward in overview")) {
|
||||||
LauncherInstrumentation.log("Overview.flingForward before fling");
|
LauncherInstrumentation.log("Overview.flingForward before fling");
|
||||||
final UiObject2 overview = verifyActiveContainer();
|
final UiObject2 overview = verifyActiveContainer();
|
||||||
final int leftMargin =
|
final int leftMargin =
|
||||||
mLauncher.getTargetInsets().left + mLauncher.getEdgeSensitivityWidth();
|
mLauncher.getTargetInsets().left + mLauncher.getEdgeSensitivityWidth();
|
||||||
mLauncher.scroll(overview, Direction.LEFT, new Rect(leftMargin + 1, 0, rightMargin, 0),
|
mLauncher.scroll(overview, Direction.LEFT, new Rect(leftMargin + 1, 0, 0, 0), 20,
|
||||||
20, false);
|
false);
|
||||||
try (LauncherInstrumentation.Closable c2 =
|
try (LauncherInstrumentation.Closable c2 =
|
||||||
mLauncher.addContextLayer("flung forwards")) {
|
mLauncher.addContextLayer("flung forwards")) {
|
||||||
verifyActiveContainer();
|
verifyActiveContainer();
|
||||||
|
@ -131,7 +127,7 @@ public class BaseOverview extends LauncherInstrumentation.VisibleContainer {
|
||||||
|
|
||||||
OverviewTask task = getCurrentTask();
|
OverviewTask task = getCurrentTask();
|
||||||
mLauncher.assertNotNull("current task is null", task);
|
mLauncher.assertNotNull("current task is null", task);
|
||||||
flingForwardImpl(task.getTaskCenterX());
|
mLauncher.scrollLeftByDistance(verifyActiveContainer(), task.getVisibleWidth());
|
||||||
|
|
||||||
try (LauncherInstrumentation.Closable c2 =
|
try (LauncherInstrumentation.Closable c2 =
|
||||||
mLauncher.addContextLayer("scrolled task off screen")) {
|
mLauncher.addContextLayer("scrolled task off screen")) {
|
||||||
|
|
|
@ -1190,10 +1190,19 @@ public final class LauncherInstrumentation {
|
||||||
return getVisibleBounds(container).bottom - bottomGestureStartOnScreen;
|
return getVisibleBounds(container).bottom - bottomGestureStartOnScreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getRightGestureMarginInContainer(UiObject2 container) {
|
||||||
|
final int rightGestureStartOnScreen = getRightGestureStartOnScreen();
|
||||||
|
return getVisibleBounds(container).right - rightGestureStartOnScreen;
|
||||||
|
}
|
||||||
|
|
||||||
int getBottomGestureStartOnScreen() {
|
int getBottomGestureStartOnScreen() {
|
||||||
return getRealDisplaySize().y - getBottomGestureSize();
|
return getRealDisplaySize().y - getBottomGestureSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getRightGestureStartOnScreen() {
|
||||||
|
return getRealDisplaySize().x - getWindowInsets().right;
|
||||||
|
}
|
||||||
|
|
||||||
void clickLauncherObject(UiObject2 object) {
|
void clickLauncherObject(UiObject2 object) {
|
||||||
waitForObjectEnabled(object, "clickLauncherObject");
|
waitForObjectEnabled(object, "clickLauncherObject");
|
||||||
expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_TOUCH_DOWN);
|
expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_TOUCH_DOWN);
|
||||||
|
@ -1235,6 +1244,21 @@ public final class LauncherInstrumentation {
|
||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void scrollLeftByDistance(UiObject2 container, int distance) {
|
||||||
|
final Rect containerRect = getVisibleBounds(container);
|
||||||
|
final int rightGestureMarginInContainer = getRightGestureMarginInContainer(container);
|
||||||
|
scroll(
|
||||||
|
container,
|
||||||
|
Direction.LEFT,
|
||||||
|
new Rect(
|
||||||
|
0,
|
||||||
|
containerRect.width() - distance - rightGestureMarginInContainer,
|
||||||
|
0,
|
||||||
|
rightGestureMarginInContainer),
|
||||||
|
10,
|
||||||
|
true);
|
||||||
|
}
|
||||||
|
|
||||||
void scroll(
|
void scroll(
|
||||||
UiObject2 container, Direction direction, Rect margins, int steps, boolean slowDown) {
|
UiObject2 container, Direction direction, Rect margins, int steps, boolean slowDown) {
|
||||||
final Rect rect = getVisibleBounds(container);
|
final Rect rect = getVisibleBounds(container);
|
||||||
|
|
|
@ -53,6 +53,10 @@ public final class OverviewTask {
|
||||||
return mTask.getVisibleBounds().height();
|
return mTask.getVisibleBounds().height();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getVisibleWidth() {
|
||||||
|
return mTask.getVisibleBounds().width();
|
||||||
|
}
|
||||||
|
|
||||||
int getTaskCenterX() {
|
int getTaskCenterX() {
|
||||||
return mTask.getVisibleCenter().x;
|
return mTask.getVisibleCenter().x;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue