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