RoutingTest: log warning when routing takes a while
Bug: 184565064
Test: atest android.media.cts.RoutingTest
Change-Id: Ic8f3c290a8ff1900f34ccdf77bcb5ebedf18b1ba
diff --git a/tests/tests/media/src/android/media/cts/RoutingTest.java b/tests/tests/media/src/android/media/cts/RoutingTest.java
index cd70a51..eb03d5e 100644
--- a/tests/tests/media/src/android/media/cts/RoutingTest.java
+++ b/tests/tests/media/src/android/media/cts/RoutingTest.java
@@ -494,11 +494,16 @@
private void assertHasNonNullRoutedDevice(AudioRouting router) throws Exception {
AudioDeviceInfo routedDevice = null;
// Give a chance for playback or recording to start so routing can be established
- final long timeouts[] = { 100, 200, 500, 500, 1000};
+ final long timeouts[] = { 100, 200, 300, 500, 1000};
int attempt = 0;
+ long totalWait = 0;
do {
+ totalWait += timeouts[attempt];
try { Thread.sleep(timeouts[attempt++]); } catch (InterruptedException ex) {}
routedDevice = router.getRoutedDevice();
+ if (routedDevice == null && (attempt > 2 || totalWait >= 1000)) {
+ Log.w(TAG, "Routing still not reported after " + totalWait + "ms");
+ }
} while (routedDevice == null && attempt < timeouts.length);
assertNotNull(routedDevice); // we probably can't say anything more than this
}