From: rmceoin Date: Wed, 9 Sep 2009 00:03:53 +0000 (+0000) Subject: OI Safe: cleaned up service timeout lock and got rid of singleTop in X-Git-Url: https://hydra-www.ietfng.org/gitweb/?a=commitdiff_plain;h=8787597d0a249642a1473ad5ba0e46cf05f850e1;p=android-vcpass-oisafe OI Safe: cleaned up service timeout lock and got rid of singleTop in various activities. git-svn-id: http://openintents.googlecode.com/svn/trunk/Safe@2296 72b678ce-9140-0410-bee8-679b907dd61a --- diff --git a/.classpath b/.classpath index 86a15c9..6efcbb7 100644 --- a/.classpath +++ b/.classpath @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff --git a/AndroidManifest.xml b/AndroidManifest.xml index ac4b2de..5637d88 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -37,7 +37,7 @@ android:value="@string/about_email" /> + android:theme="@android:style/Theme.Translucent.NoTitleBar"> @@ -49,7 +49,7 @@ + android:permission="org.openintents.safe.ACCESS_INTENTS"> @@ -85,7 +85,7 @@ - + diff --git a/src/org/openintents/safe/PassView.java b/src/org/openintents/safe/PassView.java index 51e86c8..0c75a0f 100644 --- a/src/org/openintents/safe/PassView.java +++ b/src/org/openintents/safe/PassView.java @@ -52,7 +52,7 @@ import android.widget.Toast; */ public class PassView extends Activity implements View.OnClickListener { - private static boolean debug = false; + private static boolean debug = true; private static String TAG = "PassView"; public static final int EDIT_PASSWORD_INDEX = Menu.FIRST; diff --git a/src/org/openintents/safe/service/ServiceDispatchImpl.java b/src/org/openintents/safe/service/ServiceDispatchImpl.java index 4bfa123..8acac94 100644 --- a/src/org/openintents/safe/service/ServiceDispatchImpl.java +++ b/src/org/openintents/safe/service/ServiceDispatchImpl.java @@ -46,6 +46,7 @@ public class ServiceDispatchImpl extends Service { private long timeoutUntilStop = timeoutMinutes * 60000; private BroadcastReceiver mIntentReceiver; private boolean lockOnScreenLock=true; + public static long timeRemaining=0; @Override public IBinder onBind(Intent intent) { @@ -85,35 +86,44 @@ public class ServiceDispatchImpl extends Service { super.onDestroy(); if (debug) Log.d( TAG,"onDestroy" ); + unregisterReceiver(mIntentReceiver); + if (masterKey!=null) { + lockOut(); + } + } + + private void lockOut() { masterKey = null; ch = null; - unregisterReceiver(mIntentReceiver); ServiceNotification.clearNotification(ServiceDispatchImpl.this); CategoryList.setSignedOut(); Intent intent = new Intent(CryptoIntents.ACTION_CRYPTO_LOGGED_OUT); sendBroadcast(intent); - } - + private void startTimer () { if (debug) Log.d(TAG,"startTimer with timeoutUntilStop="+timeoutUntilStop); t = new CountDownTimer(timeoutUntilStop, 10000) { public void onTick(long millisUntilFinished) { //doing nothing. if (debug) Log.d(TAG, "tick: " + millisUntilFinished ); + timeRemaining=millisUntilFinished; } public void onFinish() { if (debug) Log.d(TAG,"onFinish()"); + lockOut(); stopSelf(); // countdown is over, stop the service. + timeRemaining=0; } }; t.start(); + timeRemaining=timeoutUntilStop; if (debug) Log.d(TAG, "Timer started with: " + timeoutUntilStop ); } - public void restartTimer () { + private void restartTimer () { // must be started with startTimer first. if (debug) Log.d(TAG,"timer restarted"); if (t != null) {