Fix SharedPrefsBackupHelper so it doesn't hard code the paths to the files.
This took quite a bit of refactoring.
This commit is contained in:
@@ -300,10 +300,14 @@ class ApplicationContext extends Context {
|
||||
return new File(prefsFile.getPath() + ".bak");
|
||||
}
|
||||
|
||||
public File getSharedPrefsFile(String name) {
|
||||
return makeFilename(getPreferencesDir(), name + ".xml");
|
||||
}
|
||||
|
||||
@Override
|
||||
public SharedPreferences getSharedPreferences(String name, int mode) {
|
||||
SharedPreferencesImpl sp;
|
||||
File f = makeFilename(getPreferencesDir(), name + ".xml");
|
||||
File f = getSharedPrefsFile(name);
|
||||
synchronized (sSharedPrefs) {
|
||||
sp = sSharedPrefs.get(f);
|
||||
if (sp != null && !sp.hasFileChanged()) {
|
||||
|
||||
Reference in New Issue
Block a user