Revert "Tweak NetworkWatchListTests."
This reverts commit 17b1001282e59fd770f211caa7faf5feb80afb13.
Reason for revert: I'll resubmit in AOSP, with the fix for the test included.
Change-Id: I5bd63a5341a9b67ce63ec34080de13ed9203eba6
diff --git a/tests/cts/net/src/android/net/cts/NetworkWatchlistTest.java b/tests/cts/net/src/android/net/cts/NetworkWatchlistTest.java
index 63b3f71..81a9e30 100644
--- a/tests/cts/net/src/android/net/cts/NetworkWatchlistTest.java
+++ b/tests/cts/net/src/android/net/cts/NetworkWatchlistTest.java
@@ -24,10 +24,9 @@
import android.content.Context;
import android.net.ConnectivityManager;
+import android.platform.test.annotations.AppModeFull;
import android.os.FileUtils;
import android.os.ParcelFileDescriptor;
-import android.platform.test.annotations.AppModeFull;
-import android.util.Log;
import androidx.test.InstrumentationRegistry;
import androidx.test.filters.SmallTest;
@@ -133,9 +132,14 @@
private void pipeResourceToFileDescriptor(String res, ParcelFileDescriptor pfd)
throws IOException {
- try (InputStream resStream = getClass().getClassLoader().getResourceAsStream(res);
- FileOutputStream fdStream = new ParcelFileDescriptor.AutoCloseOutputStream(pfd)) {
- FileUtils.copy(resStream, fdStream);
+ InputStream resStream = getClass().getClassLoader().getResourceAsStream(res);
+ FileOutputStream fdStream = new ParcelFileDescriptor.AutoCloseOutputStream(pfd);
+
+ FileUtils.copy(resStream, fdStream);
+
+ try {
+ fdStream.close();
+ } catch (IOException e) {
}
}
@@ -149,8 +153,6 @@
}
private void setWatchlistConfig(String watchlistConfigFile) throws Exception {
- Log.w("NetworkWatchlistTest", "Setting watchlist config " + watchlistConfigFile
- + " in " + Thread.currentThread().getName());
cleanup();
saveResourceToFile(watchlistConfigFile, TMP_CONFIG_PATH);
final String cmdResult = runCommand(