]> hydra-www.ietfng.org Git - android-vcpass-oisafe/commitdiff
OI Safe: cleaned up service timeout lock and got rid of singleTop in
authorrmceoin <rmceoin@72b678ce-9140-0410-bee8-679b907dd61a>
Wed, 9 Sep 2009 00:03:53 +0000 (00:03 +0000)
committerrmceoin <rmceoin@72b678ce-9140-0410-bee8-679b907dd61a>
Wed, 9 Sep 2009 00:03:53 +0000 (00:03 +0000)
various activities.

git-svn-id: http://openintents.googlecode.com/svn/trunk/Safe@2296 72b678ce-9140-0410-bee8-679b907dd61a

.classpath
AndroidManifest.xml
src/org/openintents/safe/PassView.java
src/org/openintents/safe/service/ServiceDispatchImpl.java

index 86a15c90b0c7ed8b5fae1cb04b6a4f574db0e7f0..6efcbb739a404c19ea33d343ff7c6c9514756163 100644 (file)
@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<classpath>\r
-       <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>\r
-       <classpathentry kind="src" path="src"/>\r
-       <classpathentry kind="src" path="gen"/>\r
-       <classpathentry kind="output" path="bin"/>\r
-</classpath>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+       <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
+       <classpathentry kind="src" path="src"/>
+       <classpathentry kind="src" path="gen"/>
+       <classpathentry kind="output" path="bin"/>
+</classpath>
index ac4b2de65c929992670607d4a267246830286472..5637d88bfaac7a46acfc9f7203b639c228c255ec 100644 (file)
@@ -37,7 +37,7 @@
                        android:value="@string/about_email" />\r
                    
         <activity class=".FrontDoor" android:name="FrontDoor" android:label="@string/app_name"\r
-                       android:theme="@android:style/Theme.Translucent.NoTitleBar" android:launchMode="singleTop">
+                       android:theme="@android:style/Theme.Translucent.NoTitleBar">
                <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                        <category android:name="android.intent.category.LAUNCHER" />\r
@@ -49,7 +49,7 @@
         </activity>
         
         <activity class=".IntentHandler" android:name="IntentHandler" android:label="@string/app_name"
-                  android:permission="org.openintents.safe.ACCESS_INTENTS" android:launchMode="singleTop">
+                  android:permission="org.openintents.safe.ACCESS_INTENTS">
             <intent-filter android:label="@string/intent_encrypt">
                 <action android:name="org.openintents.action.ENCRYPT" />
                 <category android:name="android.intent.category.DEFAULT" />
@@ -85,7 +85,7 @@
         <activity class=".PassEdit" android:name="PassEdit" android:label="@string/app_name" />
         <activity class=".CategoryList" android:name="CategoryList" android:label="@string/app_name" />
         <activity class=".Search" android:name="Search" android:label="@string/app_name" />
-        <activity class=".AskPassword" android:name="AskPassword" android:label="@string/app_name" android:launchMode="singleTop"/>\r
+        <activity class=".AskPassword" android:name="AskPassword" android:label="@string/app_name"/>\r
         <activity class=".Help" android:name="Help" android:label="@string/app_name" />
         <activity class=".ChangePass" android:name="ChangePass" android:label="@string/app_name" />
         <activity class=".Restore" android:name="Restore" android:label="@string/app_name" />
index 51e86c80b8ddf855012a1e7028ecda9a286ae1b1..0c75a0fba83cb1c813b38f58f996623b3be6179c 100644 (file)
@@ -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;
index 4bfa123342311290657dabb1a2e90a699f4e3410..8acac9418a1d73caa8eead86bdc9a2a33858f0f0 100644 (file)
@@ -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) {