Merge "Logging switching Quickstep on and off for tests" into ub-launcher3-master
This commit is contained in:
commit
b2b6fbbe66
|
@ -24,6 +24,7 @@ import static com.android.systemui.shared.system.SettingsCompat.SWIPE_UP_SETTING
|
|||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.test.InstrumentationRegistry;
|
||||
|
||||
|
@ -46,6 +47,8 @@ import java.util.concurrent.Executor;
|
|||
*/
|
||||
public class QuickStepOnOffRule implements TestRule {
|
||||
|
||||
static final String TAG = "QuickStepOnOffRule";
|
||||
|
||||
public enum Mode {
|
||||
ON, OFF, BOTH
|
||||
}
|
||||
|
@ -73,14 +76,17 @@ public class QuickStepOnOffRule implements TestRule {
|
|||
return new Statement() {
|
||||
@Override
|
||||
public void evaluate() throws Throwable {
|
||||
try {
|
||||
if (SwipeUpSetting.isSwipeUpSettingAvailable()) {
|
||||
try {
|
||||
if (mode == ON || mode == BOTH) {
|
||||
evaluateWithQuickstepOn();
|
||||
}
|
||||
if (mode == OFF || mode == BOTH) {
|
||||
evaluateWithQuickstepOff();
|
||||
}
|
||||
} finally {
|
||||
setSwipeUpSetting(null);
|
||||
}
|
||||
} else {
|
||||
// Execute without changing the setting, if the requested mode is
|
||||
// compatible.
|
||||
|
@ -92,13 +98,10 @@ public class QuickStepOnOffRule implements TestRule {
|
|||
evaluateWithoutChangingSetting(base);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
setSwipeUpSetting(null);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void setSwipeUpSetting(String value) {
|
||||
Log.d(TAG, "setSwipeUpSetting: " + value);
|
||||
assertTrue("Couldn't change Quickstep mode",
|
||||
Settings.Secure.putString(
|
||||
InstrumentationRegistry.getInstrumentation().getTargetContext().
|
||||
|
|
Loading…
Reference in New Issue