summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/java/com/android/server/EntropyService.java4
-rw-r--r--services/java/com/android/server/RandomBlock.java4
2 files changed, 4 insertions, 4 deletions
diff --git a/services/java/com/android/server/EntropyService.java b/services/java/com/android/server/EntropyService.java
index 0f1fc7876a59..788a2f53bbdf 100644
--- a/services/java/com/android/server/EntropyService.java
+++ b/services/java/com/android/server/EntropyService.java
@@ -96,7 +96,7 @@ public class EntropyService extends Binder {
private void loadInitialEntropy() {
try {
- RandomBlock.fromFile(entropyFile).toFile(randomDevice);
+ RandomBlock.fromFile(entropyFile).toFile(randomDevice, false);
} catch (IOException e) {
Slog.w(TAG, "unable to load initial entropy (first boot?)", e);
}
@@ -104,7 +104,7 @@ public class EntropyService extends Binder {
private void writeEntropy() {
try {
- RandomBlock.fromFile(randomDevice).toFile(entropyFile);
+ RandomBlock.fromFile(randomDevice).toFile(entropyFile, true);
} catch (IOException e) {
Slog.w(TAG, "unable to write entropy", e);
}
diff --git a/services/java/com/android/server/RandomBlock.java b/services/java/com/android/server/RandomBlock.java
index cc22bd9b00cb..e5d73015cdfc 100644
--- a/services/java/com/android/server/RandomBlock.java
+++ b/services/java/com/android/server/RandomBlock.java
@@ -62,11 +62,11 @@ class RandomBlock {
return retval;
}
- void toFile(String filename) throws IOException {
+ void toFile(String filename, boolean sync) throws IOException {
if (DEBUG) Slog.v(TAG, "writing to file " + filename);
RandomAccessFile out = null;
try {
- out = new RandomAccessFile(filename, "rws");
+ out = new RandomAccessFile(filename, sync ? "rws" : "rw");
toDataOut(out);
truncateIfPossible(out);
} finally {