am 981a72a1: Merge "[don\'t auto-merge] Don\'t re-read SharedPreferences unnecessarily." into gingerbread
* commit '981a72a1506f7e6e42747b9aa0be2001795c6619': [don't auto-merge] Don't re-read SharedPreferences unnecessarily.
This commit is contained in:
@@ -364,7 +364,8 @@ class ContextImpl extends Context {
|
||||
}
|
||||
|
||||
Map map = null;
|
||||
if (prefsFile.exists() && prefsFile.canRead()) {
|
||||
FileStatus stat = new FileStatus();
|
||||
if (FileUtils.getFileStatus(prefsFile.getPath(), stat) && prefsFile.canRead()) {
|
||||
try {
|
||||
FileInputStream str = new FileInputStream(prefsFile);
|
||||
map = XmlUtils.readMapXml(str);
|
||||
@@ -377,7 +378,7 @@ class ContextImpl extends Context {
|
||||
Log.w(TAG, "getSharedPreferences", e);
|
||||
}
|
||||
}
|
||||
sp.replace(map);
|
||||
sp.replace(map, stat);
|
||||
}
|
||||
return sp;
|
||||
}
|
||||
@@ -2766,12 +2767,16 @@ class ContextImpl extends Context {
|
||||
}
|
||||
}
|
||||
|
||||
public void replace(Map newContents) {
|
||||
/* package */ void replace(Map newContents, FileStatus stat) {
|
||||
synchronized (this) {
|
||||
mLoaded = true;
|
||||
if (newContents != null) {
|
||||
mMap = newContents;
|
||||
}
|
||||
if (stat != null) {
|
||||
mStatTimestamp = stat.mtime;
|
||||
mStatSize = stat.size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user