use of info.guardianproject.iocipher.VirtualFileSystem in project Zom-Android by zom.
the class SecureMediaStore method init.
/**
* Careful! All of the {@code File}s in this method are {@link java.io.File}
* not {@link info.guardianproject.iocipher.File}s
*
* @param context
* @param key
* @throws IllegalArgumentException
*/
public static void init(Context context, byte[] key) throws IllegalArgumentException {
// there is only one VFS, so if its already mounted, nothing to do
VirtualFileSystem vfs = VirtualFileSystem.get();
if (vfs.isMounted()) {
Log.w(TAG, "VFS " + vfs.getContainerPath() + " is already mounted, so unmount()");
try {
vfs.unmount();
} catch (Exception e) {
Log.w(TAG, "VFS " + vfs.getContainerPath() + " issues with unmounting: " + e.getMessage());
}
}
Log.w(TAG, "Mounting VFS: " + vfs.getContainerPath());
dbFilePath = getInternalDbFilePath(context);
if (!new java.io.File(dbFilePath).exists()) {
vfs.createNewContainer(dbFilePath, key);
}
try {
vfs.mount(dbFilePath, key);
// list("/");
} catch (Exception e) {
Log.w(TAG, "VFS " + vfs.getContainerPath() + " issues with mounting: " + e.getMessage());
}
}
Aggregations