Merge "Adding waitForKeyguardShowingAndNotOccluded on Keyguard tests." into oreo-cts-dev
diff --git a/hostsidetests/services/activityandwindowmanager/activitymanager/src/android/server/cts/KeyguardTransitionTests.java b/hostsidetests/services/activityandwindowmanager/activitymanager/src/android/server/cts/KeyguardTransitionTests.java
index 05065aa..4222159 100644
--- a/hostsidetests/services/activityandwindowmanager/activitymanager/src/android/server/cts/KeyguardTransitionTests.java
+++ b/hostsidetests/services/activityandwindowmanager/activitymanager/src/android/server/cts/KeyguardTransitionTests.java
@@ -83,8 +83,8 @@
         if (!isHandheld()) {
             return;
         }
-        launchActivity("ShowWhenLockedActivity");
         gotoKeyguard();
+        launchActivity("ShowWhenLockedActivity");
         launchActivity("TestActivity");
         mAmWmState.waitForKeyguardShowingAndNotOccluded(mDevice);
         mAmWmState.computeState(mDevice, null);
diff --git a/hostsidetests/services/activityandwindowmanager/util/src/android/server/cts/ActivityManagerTestBase.java b/hostsidetests/services/activityandwindowmanager/util/src/android/server/cts/ActivityManagerTestBase.java
index a6d4226..f732b05 100644
--- a/hostsidetests/services/activityandwindowmanager/util/src/android/server/cts/ActivityManagerTestBase.java
+++ b/hostsidetests/services/activityandwindowmanager/util/src/android/server/cts/ActivityManagerTestBase.java
@@ -663,9 +663,10 @@
         runCommandAndPrintOutput("input keyevent KEYCODE_ENTER");
     }
 
-    protected void gotoKeyguard() throws DeviceNotAvailableException {
+    protected void gotoKeyguard() throws Exception {
         sleepDevice();
         wakeUpDevice();
+        mAmWmState.waitForKeyguardShowingAndNotOccluded(mDevice);
     }
 
     protected void setLockCredential() throws DeviceNotAvailableException {