From 56f9faeca4898fff4e473b316546ceaaf7574ab1 Mon Sep 17 00:00:00 2001 From: Beth Thibodeau Date: Mon, 3 May 2021 21:23:04 -0400 Subject: [PATCH] Allow test to run on lockscreen Test failed when on lockscreen which could be caused by other tests not cleaning up properly or unrelated failures, so, add a flag to allow the test activity to display on lockscreen and ensure power menu will close afterwards (home key does not work on lockscreen) Not totally sure this will solve the flakes (although it passes locally when running with --rerun-until-failure), so also annotating for now Bug: 176891566 Test: atest; verified passes if run when device locked Change-Id: Ia4143d145c991edda481519be2d32afcab92dfd5 --- .../android/systemui/globalactions/GlobalActionsImeTest.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/SystemUI/tests/src/com/android/systemui/globalactions/GlobalActionsImeTest.java b/packages/SystemUI/tests/src/com/android/systemui/globalactions/GlobalActionsImeTest.java index bfc793516c8dc..d418836b57530 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/globalactions/GlobalActionsImeTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/globalactions/GlobalActionsImeTest.java @@ -37,6 +37,7 @@ import android.widget.EditText; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import androidx.test.filters.FlakyTest; import androidx.test.filters.LargeTest; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.rule.ActivityTestRule; @@ -52,6 +53,7 @@ import java.util.concurrent.TimeUnit; import java.util.function.BooleanSupplier; @LargeTest +@FlakyTest(bugId = 176891566) public class GlobalActionsImeTest extends SysuiTestCase { @Rule @@ -75,6 +77,8 @@ public class GlobalActionsImeTest extends SysuiTestCase { // To restore USER_SYSTEM settings, we have to use settings shell command. executeShellCommand("settings put secure " + SHOW_IME_WITH_HARD_KEYBOARD + " " + mOriginalShowImeWithHardKeyboard); + // Hide power menu and return to home screen + executeShellCommand("input keyevent --longpress POWER"); executeShellCommand("input keyevent HOME"); } @@ -178,6 +182,7 @@ public class GlobalActionsImeTest extends SysuiTestCase { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); + setShowWhenLocked(true); // Allow this test to work even if device got stuck on keyguard mEditText = new EditText(this); mEditText.setCursorVisible(false); // Otherwise, main thread doesn't go idle. setContentView(mEditText);