diff options
Diffstat (limited to 'services/java/com/android/server/DropBoxManagerService.java')
-rw-r--r-- | services/java/com/android/server/DropBoxManagerService.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/services/java/com/android/server/DropBoxManagerService.java b/services/java/com/android/server/DropBoxManagerService.java index 9829f9ab66b2..0e451459e0ec 100644 --- a/services/java/com/android/server/DropBoxManagerService.java +++ b/services/java/com/android/server/DropBoxManagerService.java @@ -26,6 +26,7 @@ import android.database.ContentObserver; import android.net.Uri; import android.os.Debug; import android.os.DropBoxManager; +import android.os.FileUtils; import android.os.Handler; import android.os.ParcelFileDescriptor; import android.os.StatFs; @@ -183,7 +184,8 @@ public final class DropBoxManagerService extends IDropBoxManagerService.Stub { int bufferSize = mBlockSize; if (bufferSize > 4096) bufferSize = 4096; if (bufferSize < 512) bufferSize = 512; - output = new BufferedOutputStream(new FileOutputStream(temp), bufferSize); + FileOutputStream foutput = new FileOutputStream(temp); + output = new BufferedOutputStream(foutput, bufferSize); if (read == buffer.length && ((flags & DropBoxManager.IS_GZIPPED) == 0)) { output = new GZIPOutputStream(output); flags = flags | DropBoxManager.IS_GZIPPED; @@ -200,6 +202,7 @@ public final class DropBoxManagerService extends IDropBoxManagerService.Stub { read = input.read(buffer); if (read <= 0) { + FileUtils.sync(foutput); output.close(); // Get a final size measurement output = null; } else { |