]> hydra-www.ietfng.org Git - android-vcpass-oisafe/commitdiff
OI Safe: CryptoContentProvider launches frontdoor activity if currently
authorrmceoin <rmceoin@72b678ce-9140-0410-bee8-679b907dd61a>
Thu, 9 Apr 2009 03:12:35 +0000 (03:12 +0000)
committerrmceoin <rmceoin@72b678ce-9140-0410-bee8-679b907dd61a>
Thu, 9 Apr 2009 03:12:35 +0000 (03:12 +0000)
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

src/org/openintents/safe/CryptoContentProvider.java
src/org/openintents/safe/LogOffActivity.java
src/org/openintents/safe/service/ServiceDispatchImpl.java

index 51f997f616184c7fb9f89db0a8f654d1c6f46a9f..96a30fac64a81f23327f525919d47155fa9cc6c3 100644 (file)
@@ -23,6 +23,7 @@ import org.openintents.safe.service.ServiceDispatchImpl;
 \r
 import android.content.ContentProvider;\r
 import android.content.ContentValues;\r
+import android.content.Intent;\r
 import android.content.UriMatcher;\r
 import android.database.Cursor;\r
 import android.net.Uri;\r
@@ -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.\r
                                \r
                                Log.d(TAG, "Original file path: " + originalFile);\r
-                               \r
+                                       if (CategoryList.isSignedIn()==false) {\r
+                                               Intent frontdoor = new Intent(getContext(), FrontDoor.class);\r
+                                               frontdoor.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);\r
+                                               getContext().startActivity(frontdoor);          \r
+                                       throw new CryptoHelperException("Not logged in.");\r
+                               }\r
+\r
                                if (ch == null) {\r
                                        throw new CryptoHelperException("CryptoHelper not available. Are you logged in?");\r
                                }\r
@@ -171,7 +178,7 @@ public class CryptoContentProvider extends ContentProvider {
                } catch (IllegalArgumentException e) {\r
                        throw e;\r
                } catch (CryptoHelperException e) {\r
-                       if (debug) Log.d(TAG,"openFile: CryptoHelperException");\r
+                       if (debug) Log.d(TAG,"openFile: CryptoHelperException:"+e.getLocalizedMessage());\r
                        pfd = null;\r
                        //throw e;\r
                }\r
index 690d4e2de942e3572aee6767fb22432cbf1d31aa..e3868df22a9b85c691b3cfb737d925b46c9f3f2b 100644 (file)
@@ -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);
index 0cf338116cd98e1aa18af6d970e6411df8350248..70e3f0072cae0d17e1328186f12bea2bb51fb04a 100644 (file)
@@ -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" );
     }