Merge "Increase motion pause timeout for tests" into sc-v2-dev am: 974635127b
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/15455154 Change-Id: Ie601fcf2361a17a4e29c39f2a88b9f3d8dd6402b
This commit is contained in:
@@ -80,7 +80,7 @@ public class DebugTestInformationHandler extends TestInformationHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Bundle call(String method) {
|
||||
public Bundle call(String method, String arg) {
|
||||
final Bundle response = new Bundle();
|
||||
switch (method) {
|
||||
case TestProtocol.REQUEST_APP_LIST_FREEZE_FLAGS: {
|
||||
@@ -161,7 +161,7 @@ public class DebugTestInformationHandler extends TestInformationHandler {
|
||||
}
|
||||
|
||||
default:
|
||||
return super.call(method);
|
||||
return super.call(method, arg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ public class QuickstepTestInformationHandler extends TestInformationHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Bundle call(String method) {
|
||||
public Bundle call(String method, String arg) {
|
||||
final Bundle response = new Bundle();
|
||||
switch (method) {
|
||||
case TestProtocol.REQUEST_ALL_APPS_TO_OVERVIEW_SWIPE_HEIGHT: {
|
||||
@@ -66,7 +66,7 @@ public class QuickstepTestInformationHandler extends TestInformationHandler {
|
||||
}
|
||||
}
|
||||
|
||||
return super.call(method);
|
||||
return super.call(method, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,6 +23,7 @@ import android.view.VelocityTracker;
|
||||
import com.android.launcher3.Alarm;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.compat.AccessibilityManagerCompat;
|
||||
import com.android.launcher3.testing.TestProtocol;
|
||||
|
||||
/**
|
||||
* Given positions along x- or y-axis, tracks velocity and acceleration and determines when there is
|
||||
@@ -118,9 +119,9 @@ public class MotionPauseDetector {
|
||||
* @param pointerIndex Index for the pointer being tracked in the motion event
|
||||
*/
|
||||
public void addPosition(MotionEvent ev, int pointerIndex) {
|
||||
mForcePauseTimeout.setAlarm(mMakePauseHarderToTrigger
|
||||
? HARDER_TRIGGER_TIMEOUT
|
||||
: FORCE_PAUSE_TIMEOUT);
|
||||
mForcePauseTimeout.setAlarm(TestProtocol.sForcePauseTimeout != null
|
||||
? TestProtocol.sForcePauseTimeout
|
||||
: mMakePauseHarderToTrigger ? HARDER_TRIGGER_TIMEOUT : FORCE_PAUSE_TIMEOUT);
|
||||
float newVelocity = mVelocityProvider.addMotionEvent(ev, ev.getPointerId(pointerIndex));
|
||||
if (mPreviousVelocity != null) {
|
||||
checkMotionPaused(newVelocity, mPreviousVelocity, ev.getEventTime());
|
||||
|
||||
@@ -62,6 +62,10 @@ public class TestInformationHandler implements ResourceBasedOverride {
|
||||
}
|
||||
|
||||
public Bundle call(String method) {
|
||||
return call(method, /*arg=*/ null);
|
||||
}
|
||||
|
||||
public Bundle call(String method, String arg) {
|
||||
final Bundle response = new Bundle();
|
||||
switch (method) {
|
||||
case TestProtocol.REQUEST_HOME_TO_ALL_APPS_SWIPE_HEIGHT: {
|
||||
@@ -129,6 +133,10 @@ public class TestInformationHandler implements ResourceBasedOverride {
|
||||
mDeviceProfile.isTwoPanels);
|
||||
return response;
|
||||
|
||||
case TestProtocol.REQUEST_SET_FORCE_PAUSE_TIMEOUT:
|
||||
TestProtocol.sForcePauseTimeout = Long.parseLong(arg);
|
||||
return response;
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ public class TestInformationProvider extends ContentProvider {
|
||||
if (Utilities.IS_RUNNING_IN_TEST_HARNESS) {
|
||||
TestInformationHandler handler = TestInformationHandler.newInstance(getContext());
|
||||
handler.init(getContext());
|
||||
return handler.call(method);
|
||||
return handler.call(method, arg);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -98,6 +98,9 @@ public final class TestProtocol {
|
||||
public static final String REQUEST_IS_TABLET = "is-tablet";
|
||||
public static final String REQUEST_IS_TWO_PANELS = "is-two-panel";
|
||||
|
||||
public static Long sForcePauseTimeout;
|
||||
public static final String REQUEST_SET_FORCE_PAUSE_TIMEOUT = "set-force-pause-timeout";
|
||||
|
||||
public static boolean sDebugTracing = false;
|
||||
public static final String REQUEST_ENABLE_DEBUG_TRACING = "enable-debug-tracing";
|
||||
public static final String REQUEST_DISABLE_DEBUG_TRACING = "disable-debug-tracing";
|
||||
|
||||
@@ -96,6 +96,7 @@ public final class LauncherInstrumentation {
|
||||
private static final String TAG = "Tapl";
|
||||
private static final int ZERO_BUTTON_STEPS_FROM_BACKGROUND_TO_HOME = 20;
|
||||
private static final int GESTURE_STEP_MS = 16;
|
||||
private static final long FORCE_PAUSE_TIMEOUT_MS = 500;
|
||||
|
||||
static final Pattern EVENT_TOUCH_DOWN = getTouchEventPattern("ACTION_DOWN");
|
||||
static final Pattern EVENT_TOUCH_UP = getTouchEventPattern("ACTION_UP");
|
||||
@@ -105,6 +106,7 @@ public final class LauncherInstrumentation {
|
||||
|
||||
static final Pattern EVENT_TOUCH_DOWN_TIS = getTouchEventPatternTIS("ACTION_DOWN");
|
||||
static final Pattern EVENT_TOUCH_UP_TIS = getTouchEventPatternTIS("ACTION_UP");
|
||||
|
||||
private final String mLauncherPackage;
|
||||
private Boolean mIsLauncher3;
|
||||
private long mTestStartTime = -1;
|
||||
@@ -123,8 +125,6 @@ public final class LauncherInstrumentation {
|
||||
OUTSIDE_WITHOUT_PILFER, OUTSIDE_WITH_PILFER, INSIDE, INSIDE_TO_OUTSIDE
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
// Base class for launcher containers.
|
||||
static abstract class VisibleContainer {
|
||||
protected final LauncherInstrumentation mLauncher;
|
||||
@@ -272,9 +272,13 @@ public final class LauncherInstrumentation {
|
||||
}
|
||||
|
||||
Bundle getTestInfo(String request) {
|
||||
return getTestInfo(request, /*arg=*/ null);
|
||||
}
|
||||
|
||||
Bundle getTestInfo(String request, String arg) {
|
||||
try (ContentProviderClient client = getContext().getContentResolver()
|
||||
.acquireContentProviderClient(mTestProviderUri)) {
|
||||
return client.call(request, null, null);
|
||||
return client.call(request, arg, null);
|
||||
} catch (DeadObjectException e) {
|
||||
fail("Launcher crashed");
|
||||
return null;
|
||||
@@ -298,6 +302,10 @@ public final class LauncherInstrumentation {
|
||||
.getBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD);
|
||||
}
|
||||
|
||||
private void setForcePauseTimeout(long timeout) {
|
||||
getTestInfo(TestProtocol.REQUEST_SET_FORCE_PAUSE_TIMEOUT, Long.toString(timeout));
|
||||
}
|
||||
|
||||
void setActiveContainer(VisibleContainer container) {
|
||||
sActiveContainer = new WeakReference<>(container);
|
||||
}
|
||||
@@ -730,6 +738,7 @@ public final class LauncherInstrumentation {
|
||||
final String action;
|
||||
if (getNavigationModel() == NavigationModel.ZERO_BUTTON) {
|
||||
checkForAnomaly();
|
||||
setForcePauseTimeout(FORCE_PAUSE_TIMEOUT_MS);
|
||||
|
||||
final Point displaySize = getRealDisplaySize();
|
||||
boolean gestureStartFromLauncher = isTablet()
|
||||
|
||||
Reference in New Issue
Block a user