Merge "Fix the logical failure in the testOwnerChangedBroadcast test case." into marshmallow-cts-dev
am: 5557f20190
* commit '5557f20190106280c2994b18aa875f3952b636e3':
Fix the logical failure in the testOwnerChangedBroadcast test case.
Change-Id: I0a1837c3d49c3474c4ab552fdde072fb905fc4ec
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/CustomDeviceOwnerTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/CustomDeviceOwnerTest.java
index 8d22638..d2b13f6 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/CustomDeviceOwnerTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/CustomDeviceOwnerTest.java
@@ -58,6 +58,9 @@
private static final String PACKAGE_INSTALLER_CLEAR_DEVICE_OWNER_TEST_CLASS =
PACKAGE_INSTALLER_PKG + ".ClearDeviceOwnerTest";
+ // Dequeue time of PACKAGE_ADDED intent for two test packages.
+ private static final int BROADCAST_WAIT_TIME_MILLIS = 10000; // 10 seconds
+
@Override
public void tearDown() throws Exception {
if (mHasFeature) {
@@ -86,6 +89,9 @@
// Setting the device owner should send the owner changed broadcast.
assertTrue(setDeviceOwner(DEVICE_OWNER_ADMIN_COMPONENT));
+ // Waiting for the broadcast idle state.
+ Thread.sleep(BROADCAST_WAIT_TIME_MILLIS);
+
assertTrue(runDeviceTests(INTENT_RECEIVER_PKG, testClass,
"testOwnerChangedBroadcastReceived", 0));
} finally {