import com.google.android.collect.Sets;
This is a class which delegates to the given context, but performs database
and file operations with a renamed database/file name (prefixes default
names with a given prefix).
boolean allowAccessToExistingFilesAndDbs)
Class<T> mProviderClass = contentProvider;
if (allowAccessToExistingFilesAndDbs) { Makes accessible all files and databases whose names match the filePrefix that was passed to
the constructor. Normally only files and databases that were created through this context are
accessible.
for (String diskName : databaseList) { for (String diskName : fileList) { Returns if the given diskName starts with the given prefix or not.
- Parameters:
diskName name of the database/file.
Returns the public name (everything following the prefix) of the given diskName.
- Parameters:
diskName name of the database/file.
- Parameters:
context : the context that will be delagated.filePrefix : a prefix with which database and file names will be
prefixed.
- Parameters:
context : the context that will be delagated.fileContext : the context that file and db methods will be delgated tofilePrefix : a prefix with which database and file names will be
prefixed.
In order to support calls to getCacheDir(), we create a temp cache dir (inside the real
one) and return it instead. This code is basically getCacheDir(), except it uses the real
cache dir as the parent directory and creates a test cache dir inside that.
Log.w("RenamingDelegatingContext", "Unable to create cache directory");