diff --git a/services/tests/shortcutmanagerutils/src/com/android/server/pm/shortcutmanagertest/ShortcutManagerTestUtils.java b/services/tests/shortcutmanagerutils/src/com/android/server/pm/shortcutmanagertest/ShortcutManagerTestUtils.java index e5c91aaacb5db..78f95c4d217e8 100644 --- a/services/tests/shortcutmanagerutils/src/com/android/server/pm/shortcutmanagertest/ShortcutManagerTestUtils.java +++ b/services/tests/shortcutmanagerutils/src/com/android/server/pm/shortcutmanagertest/ShortcutManagerTestUtils.java @@ -1055,6 +1055,9 @@ public class ShortcutManagerTestUtils { public static void retryUntil(BooleanSupplier checker, String message) { final long timeOut = System.currentTimeMillis() + 30 * 1000; // wait for 30 seconds. while (!checker.getAsBoolean()) { + if (System.currentTimeMillis() > timeOut) { + break; + } try { Thread.sleep(200); } catch (InterruptedException ignore) {