OSDN Git Service

Use AtomicFile APIs correctly when reading.
authorSvetoslav <svetoslavganov@google.com>
Fri, 29 May 2015 20:00:32 +0000 (13:00 -0700)
committerSvetoslav <svetoslavganov@google.com>
Fri, 29 May 2015 20:01:37 +0000 (13:01 -0700)
21280155

Change-Id: I354ebac8fc91d8f28eec6016474a9521ff2a490d

packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
services/core/java/com/android/server/pm/Settings.java

index 9209c26..a2adb15 100644 (file)
@@ -400,7 +400,7 @@ final class SettingsState {
             return;
         }
         try {
-            in = new FileInputStream(mStatePersistFile);
+            in = new AtomicFile(mStatePersistFile).openRead();
         } catch (FileNotFoundException fnfe) {
             Slog.i(LOG_TAG, "No settings state");
             return;
index d2a135c..8f2db30 100644 (file)
@@ -4386,7 +4386,7 @@ final class Settings {
 
             FileInputStream in;
             try {
-                in = new FileInputStream(permissionsFile);
+                in = new AtomicFile(permissionsFile).openRead();
             } catch (FileNotFoundException fnfe) {
                 Slog.i(PackageManagerService.TAG, "No permissions state");
                 return;