Merge "Optimization: reducing number of getNavigationModeMismatchError calls" into ub-launcher3-rvc-dev
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index debc736..d46845f 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -535,13 +535,14 @@
                 mExpectedRotation, mDevice.getDisplayRotation());
 
         // b/148422894
+        String error = null;
         for (int i = 0; i != 600; ++i) {
-            if (getNavigationModeMismatchError() == null) break;
+            error = getNavigationModeMismatchError();
+            if (error == null) break;
             sleep(100);
         }
-
-        final String error = getNavigationModeMismatchError();
         assertTrue(error, error == null);
+
         log("verifyContainerType: " + containerType);
 
         final UiObject2 container = verifyVisibleObjects(containerType);