Skip to content

Commit bb69bde

Browse files
Tsu Chiang ChuangAndroid Git Automerger
authored andcommitted
am 3e70127: Merge "extend timeout to allow for more time for the device to connect." into ics-mr1
* commit '3e70127021f5d5940edfdefd7e33fd65d4ec0449': extend timeout to allow for more time for the device to connect.
2 parents d70eaff + 3e70127 commit bb69bde

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

core/tests/bandwidthtests/src/com/android/bandwidthtest/util/ConnectionUtil.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public class ConnectionUtil {
5959
private static final int WAIT_FOR_SCAN_RESULT = 10 * 1000; // 10 seconds
6060
private static final int WIFI_SCAN_TIMEOUT = 50 * 1000;
6161
public static final int SHORT_TIMEOUT = 5 * 1000;
62-
public static final int LONG_TIMEOUT = 120 * 1000; // 2 minutes
62+
public static final int LONG_TIMEOUT = 5 * 60 * 1000; // 5 minutes
6363
private ConnectivityReceiver mConnectivityReceiver = null;
6464
private WifiReceiver mWifiReceiver = null;
6565
private DownloadReceiver mDownloadReceiver = null;
@@ -458,7 +458,13 @@ public boolean waitForNetworkState(int networkType, State expectedState, long ti
458458
if (mNetworkInfo == null) {
459459
Log.v(LOG_TAG, "Do not have networkInfo! Force fetch of network info.");
460460
mNetworkInfo = mCM.getActiveNetworkInfo();
461-
Assert.assertNotNull(mNetworkInfo);
461+
}
462+
// Still null after force fetch? Maybe the network did not have time to be brought
463+
// up yet.
464+
if (mNetworkInfo == null) {
465+
Log.v(LOG_TAG, "Failed to force fetch networkInfo. " +
466+
"The network is still not ready. Wait for the next broadcast");
467+
continue;
462468
}
463469
if ((mNetworkInfo.getType() != networkType) ||
464470
(mNetworkInfo.getState() != expectedState)) {

0 commit comments

Comments
 (0)