Disable all networks during cache test.

We've seen random apps try downloading things while this test is
running, which causes disk space to fluxuate.

Bug: 63004065
Test: cts-tradefed run commandAndExit cts-dev --abi armeabi-v7a -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.StorageHostTest#testCache
Change-Id: I0203490153af5ebddb06a928727ec42e5ab85cf6
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/StorageHostTest.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/StorageHostTest.java
index 4a736b4..5cbe935 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/StorageHostTest.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/StorageHostTest.java
@@ -155,7 +155,10 @@
         // and low space reserved space.
         getDevice().executeShellCommand("settings put global sys_storage_threshold_max_bytes 0");
         getDevice().executeShellCommand("settings put global sys_storage_cache_max_bytes 0");
+        getDevice().executeShellCommand("svc data disable");
+        getDevice().executeShellCommand("svc wifi disable");
         try {
+            waitForIdle();
             for (int user : mUsers) {
                 // Clear all other cached data to give ourselves a clean slate
                 getDevice().executeShellCommand("pm trim-caches 4096G");
@@ -167,6 +170,8 @@
         } finally {
             getDevice().executeShellCommand("settings delete global sys_storage_threshold_max_bytes");
             getDevice().executeShellCommand("settings delete global sys_storage_cache_max_bytes");
+            getDevice().executeShellCommand("svc data enable");
+            getDevice().executeShellCommand("svc wifi enable");
         }
     }