From 9a35c697dc37b0823100d2fd1689b9af3d68c5f2 Mon Sep 17 00:00:00 2001 From: Alex Vakulenko Date: Wed, 10 Jan 2018 17:22:39 -0800 Subject: [PATCH] Add a delay before toggling WiFi to let listening activity to start up testConnectivityChanged_manifestRequestOnlyPreN_shouldReceiveIntent() starts up a helper activity that listens to network connection/disconnection notification. In many cases the test fails because the activity is just able to start up and initialize itself before the first toggle event arrives and in many cases it just misses by a matter of 100ms. Added a short sleep after we start the activity and before we start toggling WiFi to let the activity a chance to receive the first notification. Bug: 70988664 Change-Id: Ie122770fc8447a936d079fae7bdce61b10cf6dc2 --- tests/cts/net/src/android/net/cts/ConnectivityManagerTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/cts/net/src/android/net/cts/ConnectivityManagerTest.java b/tests/cts/net/src/android/net/cts/ConnectivityManagerTest.java index cd6dbb2441..9f54c8e803 100644 --- a/tests/cts/net/src/android/net/cts/ConnectivityManagerTest.java +++ b/tests/cts/net/src/android/net/cts/ConnectivityManagerTest.java @@ -502,6 +502,7 @@ public class ConnectivityManagerTest extends AndroidTestCase { startIntent.setComponent(new ComponentName("android.net.cts.appForApi23", "android.net.cts.appForApi23.ConnectivityListeningActivity")); mContext.startActivity(startIntent); + Thread.sleep(200); toggleWifi();