Increase timeout limits for UI activities.
Unable to reproduce locally what is causing "Activity didn't receive
a Result in 30s", increase timeout limits in an attempt to fix this
flakiness.
Bug: 185083788
Bug: 185091237
Test: atest ExternalStorageHostTest
Change-Id: I9a4c62d2f5cac9f5a3fb580c9bd5bf9226d2812d
diff --git a/hostsidetests/appsecurity/test-apps/MediaStorageApp/src/com/android/cts/mediastorageapp/GetResultActivity.java b/hostsidetests/appsecurity/test-apps/MediaStorageApp/src/com/android/cts/mediastorageapp/GetResultActivity.java
index a4ea510..4d42a34 100644
--- a/hostsidetests/appsecurity/test-apps/MediaStorageApp/src/com/android/cts/mediastorageapp/GetResultActivity.java
+++ b/hostsidetests/appsecurity/test-apps/MediaStorageApp/src/com/android/cts/mediastorageapp/GetResultActivity.java
@@ -66,12 +66,12 @@
public Result getResult() {
final Result result;
try {
- result = sResult.poll(30, TimeUnit.SECONDS);
+ result = sResult.poll(40, TimeUnit.SECONDS);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
if (result == null) {
- throw new IllegalStateException("Activity didn't receive a Result in 30 seconds");
+ throw new IllegalStateException("Activity didn't receive a Result in 40 seconds");
}
return result;
}
diff --git a/hostsidetests/appsecurity/test-apps/MediaStorageApp/src/com/android/cts/mediastorageapp/MediaStorageTest.java b/hostsidetests/appsecurity/test-apps/MediaStorageApp/src/com/android/cts/mediastorageapp/MediaStorageTest.java
index 8c4f29c..c9bc9b4 100644
--- a/hostsidetests/appsecurity/test-apps/MediaStorageApp/src/com/android/cts/mediastorageapp/MediaStorageTest.java
+++ b/hostsidetests/appsecurity/test-apps/MediaStorageApp/src/com/android/cts/mediastorageapp/MediaStorageTest.java
@@ -582,8 +582,10 @@
device.executeShellCommand("wm dismiss-keyguard");
final GetResultActivity activity = (GetResultActivity) inst.startActivitySync(intent);
- device.waitForIdle();
+ // Wait for the UI Thread to become idle.
+ inst.waitForIdleSync();
activity.clearResult();
+ device.waitForIdle();
activity.startIntentSenderForResult(pi.getIntentSender(), 42, null, 0, 0, 0);
device.waitForIdle();
@@ -591,7 +593,7 @@
// Some dialogs may have granted access automatically, so we're willing
// to keep rolling forward if we can't find our grant button
final UiSelector grant = new UiSelector().textMatches("(?i)Allow");
- if (new UiObject(grant).waitForExists(2_000)) {
+ if (new UiObject(grant).waitForExists(5_000)) {
device.findObject(grant).click();
}