Support for running Overview tests with quickstep on and off

Bug: 110103162
Test: TaplTests suite
Change-Id: Ic479156f2973aeec5cc3d288e1c891b8086d9daa
This commit is contained in:
Vadim Tryshev 2018-08-08 16:50:43 -07:00
parent d6ba50412b
commit 3b5793fdf5
2 changed files with 14 additions and 5 deletions

View File

@ -185,14 +185,18 @@ public class OverviewInteractionState {
return mSwipeGestureInitializing;
}
public void notifySwipeUpSettingChanged(boolean swipeUpEnabled) {
mUiHandler.removeMessages(MSG_SET_SWIPE_UP_ENABLED);
mUiHandler.obtainMessage(MSG_SET_SWIPE_UP_ENABLED, swipeUpEnabled ? 1 : 0, 0).
sendToTarget();
}
private class SwipeUpGestureEnabledSettingObserver extends ContentObserver {
private Handler mHandler;
private ContentResolver mResolver;
private final int defaultValue;
SwipeUpGestureEnabledSettingObserver(Handler handler, ContentResolver resolver) {
super(handler);
mHandler = handler;
mResolver = resolver;
defaultValue = SwipeUpSetting.isSwipeUpEnabledDefaultValue() ? 1 : 0;
}
@ -207,8 +211,7 @@ public class OverviewInteractionState {
@Override
public void onChange(boolean selfChange) {
super.onChange(selfChange);
mHandler.removeMessages(MSG_SET_SWIPE_UP_ENABLED);
mHandler.obtainMessage(MSG_SET_SWIPE_UP_ENABLED, getValue() ? 1 : 0, 0).sendToTarget();
notifySwipeUpSettingChanged(getValue());
}
private boolean getValue() {

View File

@ -87,6 +87,7 @@ public final class LauncherInstrumentation {
private final UiDevice mDevice;
private final boolean mSwipeUpEnabled;
private Boolean mSwipeUpEnabledOverride = null;
/**
* Constructs the root of TAPL hierarchy. You get all other objects from it.
@ -103,12 +104,17 @@ public final class LauncherInstrumentation {
assertTrue("Device must run in a test harness", ActivityManager.isRunningInTestHarness());
}
// Used only by tests.
public void overrideSwipeUpEnabled(Boolean swipeUpEnabledOverride) {
mSwipeUpEnabledOverride = swipeUpEnabledOverride;
}
void setActiveContainer(VisibleContainer container) {
sActiveContainer = new WeakReference<>(container);
}
boolean isSwipeUpEnabled() {
return mSwipeUpEnabled;
return mSwipeUpEnabledOverride != null ? mSwipeUpEnabledOverride : mSwipeUpEnabled;
}
private UiObject2 verifyContainerType(ContainerType containerType) {