Merge "Use Duration instead of TimeUnit for waiting on windows" into aosp-main-future
diff --git a/services/tests/wmtests/src/com/android/server/wm/ScreenshotTests.java b/services/tests/wmtests/src/com/android/server/wm/ScreenshotTests.java
index 280fe4c..34f7ebb 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ScreenshotTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ScreenshotTests.java
@@ -66,6 +66,7 @@
import org.junit.Test;
import org.junit.rules.TestName;
+import java.time.Duration;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@@ -131,7 +132,7 @@
assertTrue("Failed to wait for transaction to get committed",
countDownLatch.await(WAIT_TIME_S, TimeUnit.SECONDS));
assertTrue("Failed to wait for stable geometry",
- waitForStableWindowGeometry(WAIT_TIME_S, TimeUnit.SECONDS));
+ waitForStableWindowGeometry(Duration.ofSeconds(WAIT_TIME_S)));
ScreenCapture.LayerCaptureArgs args = new ScreenCapture.LayerCaptureArgs.Builder(secureSC)
.setCaptureSecureLayers(true)
@@ -212,7 +213,7 @@
assertTrue("Failed to wait for transaction to get committed",
countDownLatch.await(WAIT_TIME_S, TimeUnit.SECONDS));
assertTrue("Failed to wait for stable geometry",
- waitForStableWindowGeometry(WAIT_TIME_S, TimeUnit.SECONDS));
+ waitForStableWindowGeometry(Duration.ofSeconds(WAIT_TIME_S)));
ScreenshotHardwareBuffer[] screenCapture = new ScreenshotHardwareBuffer[1];
Bitmap screenshot = null;
diff --git a/services/tests/wmtests/src/com/android/server/wm/TrustedOverlayTests.java b/services/tests/wmtests/src/com/android/server/wm/TrustedOverlayTests.java
index f1d84cf..529e9b7 100644
--- a/services/tests/wmtests/src/com/android/server/wm/TrustedOverlayTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/TrustedOverlayTests.java
@@ -49,6 +49,7 @@
import org.junit.Test;
import org.junit.rules.TestName;
+import java.time.Duration;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@@ -144,7 +145,7 @@
}
}
return false;
- }, TIMEOUT_S, TimeUnit.SECONDS);
+ }, Duration.ofSeconds(TIMEOUT_S));
assertAndDumpWindowState(TAG, "Failed to find window or was not marked trusted",
foundTrusted[0]);
@@ -209,7 +210,7 @@
}
}
return foundTrusted[0] && foundTrusted[1];
- }, TIMEOUT_S, TimeUnit.SECONDS);
+ }, Duration.ofSeconds(TIMEOUT_S));
if (!foundTrusted[0] || !foundTrusted[1]) {
CtsWindowInfoUtils.dumpWindowsOnScreen(TAG, mName.getMethodName());
diff --git a/tests/Input/src/com/android/test/input/AnrTest.kt b/tests/Input/src/com/android/test/input/AnrTest.kt
index 8d1fc50..d32cedb 100644
--- a/tests/Input/src/com/android/test/input/AnrTest.kt
+++ b/tests/Input/src/com/android/test/input/AnrTest.kt
@@ -40,7 +40,7 @@
import com.android.cts.input.DebugInputRule
import com.android.cts.input.UinputTouchScreen
-import java.util.concurrent.TimeUnit
+import java.time.Duration
import org.junit.After
import org.junit.Assert.assertEquals
@@ -193,6 +193,6 @@
val flags = " -W -n "
val startCmd = "am start $flags $PACKAGE_NAME/.UnresponsiveGestureMonitorActivity"
instrumentation.uiAutomation.executeShellCommand(startCmd)
- waitForStableWindowGeometry(5L, TimeUnit.SECONDS)
+ waitForStableWindowGeometry(Duration.ofSeconds(5))
}
}