Reduce timeouts of RilE2eTests

- Don't wait much longer than 10 seconds for wifi to be disabled
- Reduce the test timeout from 60 to 10 seconds
Above changes effectively reduce the overall test timeout to ~20
  seconds.

Bug: 140576109
Test: locally
Change-Id: I545c83a1038a7fd48766834b1ce310da83c3a8cb
diff --git a/tests/ril/src/com/android/cuttlefish/ril/tests/RilE2eTests.java b/tests/ril/src/com/android/cuttlefish/ril/tests/RilE2eTests.java
index e46b901..e09895f 100644
--- a/tests/ril/src/com/android/cuttlefish/ril/tests/RilE2eTests.java
+++ b/tests/ril/src/com/android/cuttlefish/ril/tests/RilE2eTests.java
@@ -46,6 +46,7 @@
 @RunWith(JUnit4.class)
 public class RilE2eTests {
     private static final String TAG = "RilE2eTests";
+    private static final int MAX_POLL_DISABLED_WIFI_COUNT = 10;
     private Context mContext;
     private WifiManager mWifiManager;
     private ConnectivityManager mConnManager;
@@ -64,16 +65,21 @@
     }
 
 
-    private void disableWifi() {
+    private void disableWifi() throws Exception {
         Log.i(TAG, "Disabling WIFI...");
 
         mWifiManager.setWifiEnabled(false);
-        while (mWifiManager.isWifiEnabled()) {
+        int count = MAX_POLL_DISABLED_WIFI_COUNT;
+        while (mWifiManager.isWifiEnabled() && count-- > 0) {
             Log.i(TAG, "Waiting for WIFI to be disabled...");
             try {
                 Thread.sleep(1000);
             } catch (InterruptedException e) {}
         }
+        if (count < 0) {
+            Log.e(TAG, "Reached max number of polls while waiting to disable wifi");
+            throw new Exception("Timed out waiting for wifi to be disabled");
+        }
     }
 
 
@@ -81,7 +87,7 @@
      * Verify that RIL stack is able to get up and connect to network in
      * 60 seconds.
      */
-    @Test(timeout = 60 * 1000)
+    @Test(timeout = 10 * 1000)
     public void testRilConnects() throws Exception {
         while (true) {
             NetworkInfo net = mConnManager.getActiveNetworkInfo();