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:
@@ -254,11 +254,19 @@ public abstract class Context {
|
||||
* <p>Note: this is not generally useful for applications, since they should
|
||||
* not be directly accessing the file system.
|
||||
*
|
||||
*
|
||||
* @return String Path to the code and assets.
|
||||
*/
|
||||
public abstract String getPackageCodePath();
|
||||
|
||||
/**
|
||||
* {@hide}
|
||||
* Return the full path to the shared prefs file for the given prefs group name.
|
||||
*
|
||||
* <p>Note: this is not generally useful for applications, since they should
|
||||
* not be directly accessing the file system.
|
||||
*/
|
||||
public abstract File getSharedPrefsFile(String name);
|
||||
|
||||
/**
|
||||
* Retrieve and hold the contents of the preferences file 'name', returning
|
||||
* a SharedPreferences through which you can retrieve and modify its
|
||||
|
||||
@@ -129,6 +129,11 @@ public class ContextWrapper extends Context {
|
||||
return mBase.getPackageCodePath();
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getSharedPrefsFile(String name) {
|
||||
return mBase.getSharedPrefsFile(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SharedPreferences getSharedPreferences(String name, int mode) {
|
||||
return mBase.getSharedPreferences(name, mode);
|
||||
|
||||
Reference in New Issue
Block a user