<action android:name="org.openintents.action.SET_PASSWORD" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
-
+ <intent-filter android:label="@string/intent_restart_timer">
+ <action android:name="org.openintents.action.RESTART_TIMER" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
</activity>
<activity class=".PassGen" android:name="PassGen" android:label="@string/app_name" />
<string name="intent_encrypt">Encrypt (OI Safe)</string>\r
<string name="intent_get_password">Get password (OI Safe)</string>\r
<string name="intent_set_password">Set password (OI Safe)</string>\r
+ <string name="intent_restart_timer">Restart timer (OI Safe)</string>\r
<string name="open_safe">Open OI Safe</string>\r
<string name="lock">Lock</string>\r
<string name="continue_text">Continue</string>\r
* <p>Constant Value: "org.openintents.action.SET_PASSWORD"</p>\r
*/\r
public static final String ACTION_SET_PASSWORD = "org.openintents.action.SET_PASSWORD";\r
+ \r
+ /**\r
+ * Activity Action: Restarts the timer for the Crypto intent service.\r
+ * The timer gets reset when using GET or set password anyway, but this is\r
+ * a way to reset the timer for other kinds of actions. Use sparingly since\r
+ * we do actually want the timer to time out eventually!\r
+ * \r
+ * <p>Constant Value: "org.openintents.action.RESTART_TIMER"</p>\r
+ */\r
+ public static final String ACTION_RESTART_TIMER = "org.openintents.action.RESTART_TIMER";\r
\r
/**\r
* Broadcast Action: Sent when the user got logged out of the\r
private static String masterKey;
private List<CategoryEntry> rows;
+ private Intent restartTimerIntent;
BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
if (debug) Log.d(TAG,"onCreate()");
+ restartTimerIntent = new Intent (CryptoIntents.ACTION_RESTART_TIMER);
+
if (!isSignedIn()) {
Intent frontdoor = new Intent(this, FrontDoor.class);
startActivity(frontdoor);
@Override
protected void onPause() {
super.onPause();
-
+
if (debug) Log.d(TAG,"onPause()");
if ((importThread != null) && (importThread.isAlive())) {
}
public boolean onOptionsItemSelected(MenuItem item) {
-
+ startActivity (restartTimerIntent);
+
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
int position=-1;
if (info==null) {
protected void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
-
+
+ startActivity (restartTimerIntent);
launchPassList(rows.get(position).id);
}
if (debug) Log.d(TAG,"addCategory("+name+")");
if ((name==null) || (name=="")) return -1;
CategoryEntry entry = new CategoryEntry();
-
+
+ startActivity (restartTimerIntent);
String namePlain = name;
try {
} else if (externalAccess){\r
\r
// which action?\r
- if (action.equals (CryptoIntents.ACTION_ENCRYPT)) {\r
+ if (action.equals (CryptoIntents.ACTION_RESTART_TIMER)) {\r
+ if (service != null) {\r
+ try {\r
+ service.restartTimer();\r
+ callbackResult = RESULT_OK;\r
+ } catch (RemoteException e) {\r
+ // TODO Auto-generated catch block\r
+ Log.e (TAG, "remoteException in Restart Timer");\r
+ }\r
+ }\r
+ } else if (action.equals (CryptoIntents.ACTION_ENCRYPT)) {\r
callbackResult = encryptIntent(thisIntent, callbackIntent);\r
} else if (action.equals (CryptoIntents.ACTION_DECRYPT)) {\r
callbackResult = decryptIntent(thisIntent, callbackIntent);\r
import java.util.List;
import java.util.Set;
+import org.openintents.intents.CryptoIntents;
+
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ListActivity;
private CryptoHelper ch;
private DBHelper dbHelper=null;
private static Long CategoryId=null;
+ private Intent restartTimerIntent;
private static String masterKey;
super.onCreate(icicle);
if (debug) Log.d(TAG,"onCreate()");
+ restartTimerIntent = new Intent (CryptoIntents.ACTION_RESTART_TIMER);
setContentView(R.layout.pass_list);
if (dbHelper==null) {
}
public boolean onOptionsItemSelected(MenuItem item) {
-
+ startActivity (restartTimerIntent);
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
int position=-1;
if (info==null) {
String encrypt (String clearText);\r
String decrypt (String cryptoText);\r
void setTimeoutMinutes(int timeoutMinutesIn);\r
+ void restartTimer();\r
}\r
Log.d(TAG, "Timer started with: " + timeoutUntilStop );
}
- private void restartTimer () {
- // must be started with startTimer first.
- if (t != null) {
- t.cancel();
- t.start();
- }
- }
/**
* The ServiceDispatch is defined through IDL
timeoutUntilStop = timeoutMinutes * 60000;
Log.d(TAG,"set timeout to "+timeoutMinutes);
}
+
+ public void restartTimer () {
+ // must be started with startTimer first.
+ if (t != null) {
+ t.cancel();
+ t.start();
+ }
+ }
};
}