From: peli0101 Date: Wed, 8 Apr 2009 20:18:58 +0000 (+0000) Subject: OI Safe: Make crypto helper from ServiceDispatchImpl public static, instead of the... X-Git-Url: https://hydra-www.ietfng.org/gitweb/?a=commitdiff_plain;h=5d12d85f261589eff5c177d5a9a635d2561452c4;p=android-vcpass-oisafe OI Safe: Make crypto helper from ServiceDispatchImpl public static, instead of the one from IntentHandler. This way, crypto helper is set to null if service is locked. git-svn-id: http://openintents.googlecode.com/svn/trunk/Safe@2021 72b678ce-9140-0410-bee8-679b907dd61a --- diff --git a/src/org/openintents/safe/CryptoContentProvider.java b/src/org/openintents/safe/CryptoContentProvider.java index e9afe61..51f997f 100644 --- a/src/org/openintents/safe/CryptoContentProvider.java +++ b/src/org/openintents/safe/CryptoContentProvider.java @@ -19,6 +19,8 @@ package org.openintents.safe; import java.io.File; import java.io.FileNotFoundException; +import org.openintents.safe.service.ServiceDispatchImpl; + import android.content.ContentProvider; import android.content.ContentValues; import android.content.UriMatcher; @@ -133,7 +135,7 @@ public class CryptoContentProvider extends ContentProvider { // TODO: Check that sessionKey is valid. // Decrypt file - CryptoHelper ch = IntentHandler.ch; // Use the global crypto helper that is connected to the single service we have. + 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); diff --git a/src/org/openintents/safe/IntentHandler.java b/src/org/openintents/safe/IntentHandler.java index 0110db8..1f1caf4 100644 --- a/src/org/openintents/safe/IntentHandler.java +++ b/src/org/openintents/safe/IntentHandler.java @@ -57,8 +57,8 @@ public class IntentHandler extends Activity { private String salt; private String masterKey; - public static CryptoHelper ch; // TODO Peli: Could clean this up by moving it into a singleton? Or at least a separate static class? - + private CryptoHelper ch; + // service elements private ServiceDispatch service; private ServiceDispatchConnection conn; @@ -543,6 +543,7 @@ public class IntentHandler extends Activity { public void onServiceDisconnected(ComponentName className) { service = null; + if (debug) Log.d( TAG,"onServiceDisconnected" ); } }; diff --git a/src/org/openintents/safe/service/ServiceDispatchImpl.java b/src/org/openintents/safe/service/ServiceDispatchImpl.java index eccea2b..0cf3381 100644 --- a/src/org/openintents/safe/service/ServiceDispatchImpl.java +++ b/src/org/openintents/safe/service/ServiceDispatchImpl.java @@ -37,7 +37,7 @@ import android.os.CountDownTimer; public class ServiceDispatchImpl extends Service { private static boolean debug = false; private static String TAG = "ServiceDispatchIMPL"; - private CryptoHelper ch; + public static CryptoHelper ch; // TODO Peli: Could clean this up by moving it into a singleton? Or at least a separate static class? private String salt; private String masterKey; private CountDownTimer t;