From 7977961f7386cb1157b8982895490b8e73b04e75 Mon Sep 17 00:00:00 2001 From: vadimt Date: Wed, 6 Mar 2019 16:34:08 -0800 Subject: [PATCH] Logging switching Quickstep on and off for tests Change-Id: I9ff70850a86542715b5ef88c1f2a492bd3797ab1 --- .../android/quickstep/QuickStepOnOffRule.java | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/quickstep/tests/src/com/android/quickstep/QuickStepOnOffRule.java b/quickstep/tests/src/com/android/quickstep/QuickStepOnOffRule.java index c5975a9590..f89842a394 100644 --- a/quickstep/tests/src/com/android/quickstep/QuickStepOnOffRule.java +++ b/quickstep/tests/src/com/android/quickstep/QuickStepOnOffRule.java @@ -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,32 +76,32 @@ public class QuickStepOnOffRule implements TestRule { return new Statement() { @Override public void evaluate() throws Throwable { - try { - if (SwipeUpSetting.isSwipeUpSettingAvailable()) { + if (SwipeUpSetting.isSwipeUpSettingAvailable()) { + try { if (mode == ON || mode == BOTH) { evaluateWithQuickstepOn(); } if (mode == OFF || mode == BOTH) { evaluateWithQuickstepOff(); } - } else { - // Execute without changing the setting, if the requested mode is - // compatible. - final boolean swipeUpEnabledDefaultValue = - SwipeUpSetting.isSwipeUpEnabledDefaultValue(); - if (mode == BOTH || - mode == ON && swipeUpEnabledDefaultValue || - mode == OFF && !swipeUpEnabledDefaultValue) { - evaluateWithoutChangingSetting(base); - } + } finally { + setSwipeUpSetting(null); + } + } else { + // Execute without changing the setting, if the requested mode is + // compatible. + final boolean swipeUpEnabledDefaultValue = + SwipeUpSetting.isSwipeUpEnabledDefaultValue(); + if (mode == BOTH || + mode == ON && swipeUpEnabledDefaultValue || + mode == OFF && !swipeUpEnabledDefaultValue) { + 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().