From: rmceoin Date: Thu, 9 Apr 2009 03:12:35 +0000 (+0000) Subject: OI Safe: CryptoContentProvider launches frontdoor activity if currently X-Git-Url: https://hydra-www.ietfng.org/gitweb/?a=commitdiff_plain;h=9a212904b9ba74c7137f43d901782554eeacb687;p=android-vcpass-oisafe OI Safe: CryptoContentProvider launches frontdoor activity if currently locked. When you unlock, you get dropped into CategoryList. Need a way to simply exit. This way 3rd party apps would instead get focus again. Also cleaned up some of the locking. git-svn-id: http://openintents.googlecode.com/svn/trunk/Safe@2022 72b678ce-9140-0410-bee8-679b907dd61a --- diff --git a/src/org/openintents/safe/CryptoContentProvider.java b/src/org/openintents/safe/CryptoContentProvider.java index 51f997f..96a30fa 100644 --- a/src/org/openintents/safe/CryptoContentProvider.java +++ b/src/org/openintents/safe/CryptoContentProvider.java @@ -23,6 +23,7 @@ import org.openintents.safe.service.ServiceDispatchImpl; import android.content.ContentProvider; import android.content.ContentValues; +import android.content.Intent; import android.content.UriMatcher; import android.database.Cursor; import android.net.Uri; @@ -138,7 +139,13 @@ public class CryptoContentProvider extends ContentProvider { CryptoHelper ch = ServiceDispatchImpl.ch; // Use the global crypto helper that is connected to the single service we have. Log.d(TAG, "Original file path: " + originalFile); - + if (CategoryList.isSignedIn()==false) { + Intent frontdoor = new Intent(getContext(), FrontDoor.class); + frontdoor.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + getContext().startActivity(frontdoor); + throw new CryptoHelperException("Not logged in."); + } + if (ch == null) { throw new CryptoHelperException("CryptoHelper not available. Are you logged in?"); } @@ -171,7 +178,7 @@ public class CryptoContentProvider extends ContentProvider { } catch (IllegalArgumentException e) { throw e; } catch (CryptoHelperException e) { - if (debug) Log.d(TAG,"openFile: CryptoHelperException"); + if (debug) Log.d(TAG,"openFile: CryptoHelperException:"+e.getLocalizedMessage()); pfd = null; //throw e; } diff --git a/src/org/openintents/safe/LogOffActivity.java b/src/org/openintents/safe/LogOffActivity.java index 690d4e2..e3868df 100644 --- a/src/org/openintents/safe/LogOffActivity.java +++ b/src/org/openintents/safe/LogOffActivity.java @@ -33,6 +33,7 @@ public class LogOffActivity extends Activity { Intent serviceIntent = new Intent(); serviceIntent.setClass(LogOffActivity.this, ServiceDispatchImpl.class ); stopService(serviceIntent); + CategoryList.setSignedOut(); /* Intent intent = new Intent(LogOffActivity.this, FrontDoor.class); diff --git a/src/org/openintents/safe/service/ServiceDispatchImpl.java b/src/org/openintents/safe/service/ServiceDispatchImpl.java index 0cf3381..70e3f00 100644 --- a/src/org/openintents/safe/service/ServiceDispatchImpl.java +++ b/src/org/openintents/safe/service/ServiceDispatchImpl.java @@ -21,6 +21,7 @@ package org.openintents.safe.service; // if there are still clients attached. Should be fixed. import org.openintents.intents.CryptoIntents; +import org.openintents.safe.CategoryList; import org.openintents.safe.CryptoHelper; import org.openintents.safe.CryptoHelperException; @@ -86,6 +87,7 @@ public class ServiceDispatchImpl extends Service { Intent intent = new Intent(CryptoIntents.ACTION_CRYPTO_LOGGED_OUT); sendBroadcast(intent); + CategoryList.setSignedOut(); if (debug) Log.d( TAG,"onDestroy" ); }