summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Brett Chabot <brettchabot@google.com> 2018-07-11 16:26:55 -0700
committer Brett Chabot <brettchabot@google.com> 2018-07-12 10:33:43 -0700
commit968a5322b9d08b8e5060eaacd59f06c0b113cffc (patch)
tree52952ce68150159edd12e4f8223309020727ed00
parent71fa53f8a548993d30d91343caee0e6269e8c0c5 (diff)
Make ENABLE_COPY_OPTIMIZATIONS non final.
Test: make -j56 Run_robolectric_robolectric_tests Change-Id: I6ef235fef5a2daf55fab059b4d1b3a9afce09c8d
-rw-r--r--core/java/android/os/FileUtils.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/core/java/android/os/FileUtils.java b/core/java/android/os/FileUtils.java
index 9fccd1ec7b43..3a3d9ea0b44f 100644
--- a/core/java/android/os/FileUtils.java
+++ b/core/java/android/os/FileUtils.java
@@ -93,7 +93,8 @@ public class FileUtils {
private static final File[] EMPTY = new File[0];
- private static final boolean ENABLE_COPY_OPTIMIZATIONS = true;
+ // non-final so it can be toggled by Robolectric's ShadowFileUtils
+ private static boolean sEnableCopyOptimizations = true;
private static final long COPY_CHECKPOINT_BYTES = 524288;
@@ -338,7 +339,7 @@ public class FileUtils {
public static long copy(@NonNull InputStream in, @NonNull OutputStream out,
@Nullable CancellationSignal signal, @Nullable Executor executor,
@Nullable ProgressListener listener) throws IOException {
- if (ENABLE_COPY_OPTIMIZATIONS) {
+ if (sEnableCopyOptimizations) {
if (in instanceof FileInputStream && out instanceof FileOutputStream) {
return copy(((FileInputStream) in).getFD(), ((FileOutputStream) out).getFD(),
signal, executor, listener);
@@ -395,7 +396,7 @@ public class FileUtils {
public static long copy(@NonNull FileDescriptor in, @NonNull FileDescriptor out, long count,
@Nullable CancellationSignal signal, @Nullable Executor executor,
@Nullable ProgressListener listener) throws IOException {
- if (ENABLE_COPY_OPTIMIZATIONS) {
+ if (sEnableCopyOptimizations) {
try {
final StructStat st_in = Os.fstat(in);
final StructStat st_out = Os.fstat(out);