info.guardianproject.iocipher.VirtualFileSystem Java Examples

The following examples show how to use info.guardianproject.iocipher.VirtualFileSystem. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MainActivity.java    From zom-android-matrix with Apache License 2.0 5 votes vote down vote up
@Override
public void onResume() {
    super.onResume();

    /**
    if (getIntent() != null) {
        Uri uriRef = ActivityCompat.getReferrer(this);
        ComponentName aCalling = getCallingActivity();

        Log.d("Main", "Calling Referrer: " + uriRef);
        Log.d("Main", "Calling Activity: " + aCalling);

        StatusBarNotifier sb = new StatusBarNotifier(this);
        sb.notifyError("System", "calling: " + aCalling + " & " + uriRef);
    }**/

    applyStyleColors ();

    //if VFS is not mounted, then send to WelcomeActivity
    if (!VirtualFileSystem.get().isMounted()) {
        finish();
        startActivity(new Intent(this, RouterActivity.class));
    } else {
        ImApp app = (ImApp) getApplication();
        mApp.maybeInit(this);
        mApp.initAccountInfo();
    }


    handleIntent(getIntent());


}
 
Example #2
Source File: IOService.java    From CameraV with GNU General Public License v3.0 5 votes vote down vote up
public boolean initIOCipher(byte[] authToken) {
	try {
		java.io.File fileExternal = mContext.getExternalFilesDir(null);//Storage.ROOT);
		
		if (fileExternal == null)
		{
			fileExternal = mContext.getFilesDir();				
		}
		
		java.io.File storageRoot = new java.io.File(fileExternal, Storage.IOCIPHER);
		
		vfs = VirtualFileSystem.get();
		
		if (!storageRoot.exists())			
			vfs.createNewContainer(storageRoot.getAbsolutePath(), authToken);							
		
		if (!vfs.isMounted())
			vfs.mount(storageRoot.getAbsolutePath(),authToken);
		
		info.guardianproject.iocipher.File organizationRoot = new info.guardianproject.iocipher.File(Storage.ORGS_ROOT);
		if(!organizationRoot.exists()) {
			organizationRoot.mkdir();
		}
		
		info.guardianproject.iocipher.File formsRoot = new info.guardianproject.iocipher.File(Storage.FORM_ROOT);
		if(!formsRoot.exists()) {
			formsRoot.mkdir();
		}

		return true;
	} catch(IllegalArgumentException e) {
		Log.e(LOG, e.toString());
		e.printStackTrace();
	}

	return false;
}
 
Example #3
Source File: StorageManager.java    From CameraV with GNU General Public License v3.0 5 votes vote down vote up
public static boolean unmountStorage ()
{
	try
	{
		VirtualFileSystem.get().unmount();
		return true;
	}
	catch (IllegalStateException ise)
	{
		Log.d("IOCipher","error unmounting - still active?",ise);
		return false;
	}
}
 
Example #4
Source File: StorageManager.java    From CameraV with GNU General Public License v3.0 5 votes vote down vote up
public static boolean mountStorage (Context context, String storagePath, byte[] passphrase)
{
	File dbFile = null;
	
	if (storagePath == null)
	{
		dbFile = new java.io.File(context.getDir("vfs", Context.MODE_PRIVATE),DEFAULT_PATH);
	}
	else
	{
		dbFile = new java.io.File(storagePath);
	}
	dbFile.getParentFile().mkdirs();
	
	if (!dbFile.exists())
		VirtualFileSystem.get().createNewContainer(dbFile.getAbsolutePath(), passphrase);
	

	if (!VirtualFileSystem.get().isMounted())
	{
		// TODO don't use a hard-coded password! prompt for the password
		VirtualFileSystem.get().mount(dbFile.getAbsolutePath(),passphrase);
	}
	
	
	return true;
}
 
Example #5
Source File: MainActivity.java    From Zom-Android-XMPP with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onResume() {
    super.onResume();

    applyStyleColors ();

    //if VFS is not mounted, then send to WelcomeActivity
    if (!VirtualFileSystem.get().isMounted()) {
        finish();
        startActivity(new Intent(this, RouterActivity.class));

    } else {
        ImApp app = (ImApp) getApplication();
        mApp.maybeInit(this);
        mApp.initAccountInfo();
    }


    handleIntent(getIntent());

    if (mApp.getDefaultAccountId() == -1)
    {
        startActivity(new Intent(this,RouterActivity.class));
    }
    else {
        if (mConn == null) {
            mConn = mApp.getConnection(mApp.getDefaultProviderId(), mApp.getDefaultAccountId());
            if (mConn != null) {
                try {
                    mConn.registerConnectionListener(this);
                } catch (Exception e) {
                    Log.e(ImApp.LOG_TAG, "unable to register connection listener", e);
                }

            }
        }

        checkConnection();

    }

}
 
Example #6
Source File: SecureMediaStore.java    From Zom-Android-XMPP with GNU General Public License v3.0 4 votes vote down vote up
public static void unmount() {
    VirtualFileSystem.get().unmount();
}
 
Example #7
Source File: SecureMediaStore.java    From Zom-Android-XMPP with GNU General Public License v3.0 4 votes vote down vote up
public static boolean isMounted ()
{
    return VirtualFileSystem.get().isMounted();
}
 
Example #8
Source File: StorageManager.java    From CameraV with GNU General Public License v3.0 4 votes vote down vote up
public static boolean isStorageMounted ()
{
	return VirtualFileSystem.get().isMounted();
}