aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--OpenPGP-Keychain/res/values/arrays.xml4
-rw-r--r--OpenPGP-Keychain/res/values/strings.xml3
-rw-r--r--OpenPGP-Keychain/src/org/sufficientlysecure/keychain/service/PassphraseCacheService.java12
3 files changed, 12 insertions, 7 deletions
diff --git a/OpenPGP-Keychain/res/values/arrays.xml b/OpenPGP-Keychain/res/values/arrays.xml
index 0c1684919..974239110 100644
--- a/OpenPGP-Keychain/res/values/arrays.xml
+++ b/OpenPGP-Keychain/res/values/arrays.xml
@@ -13,6 +13,7 @@
<item>@string/choice_2hours</item>
<item>@string/choice_4hours</item>
<item>@string/choice_8hours</item>
+ <item>@string/choice_forever</item>
</string-array>
<string-array name="pass_phrase_cache_ttl_values" translatable="false">
<item>15</item>
@@ -26,6 +27,7 @@
<item>7200</item>
<item>14400</item>
<item>28800</item>
+ <item>-1</item>
</string-array>
<string-array name="key_size_spinner_values" translatable="false">
<item>@string/key_size_512</item>
@@ -41,4 +43,4 @@
<item>@string/menu_import_from_nfc</item>
</string-array>
-</resources> \ No newline at end of file
+</resources>
diff --git a/OpenPGP-Keychain/res/values/strings.xml b/OpenPGP-Keychain/res/values/strings.xml
index 6f637cdc0..8e555df5a 100644
--- a/OpenPGP-Keychain/res/values/strings.xml
+++ b/OpenPGP-Keychain/res/values/strings.xml
@@ -166,6 +166,7 @@
<string name="choice_2hours">2 hours</string>
<string name="choice_4hours">4 hours</string>
<string name="choice_8hours">8 hours</string>
+ <string name="choice_forever">forever</string>
<string name="dsa">DSA</string>
<string name="elgamal">ElGamal</string>
<string name="rsa">RSA</string>
@@ -415,4 +416,4 @@
<string name="drawer_open">Open navigation drawer</string>
<string name="drawer_close">Close navigation drawer</string>
-</resources> \ No newline at end of file
+</resources>
diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/service/PassphraseCacheService.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/service/PassphraseCacheService.java
index f447b6d4f..08b9c26e6 100644
--- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/service/PassphraseCacheService.java
+++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/service/PassphraseCacheService.java
@@ -291,10 +291,12 @@ public class PassphraseCacheService extends Service {
// add keyId and passphrase to memory
mPassphraseCache.put(keyId, passphrase);
- // register new alarm with keyId for this passphrase
- long triggerTime = new Date().getTime() + (ttl * 1000);
- AlarmManager am = (AlarmManager) this.getSystemService(Context.ALARM_SERVICE);
- am.set(AlarmManager.RTC_WAKEUP, triggerTime, buildIntent(this, keyId));
+ if (ttl > 0) {
+ // register new alarm with keyId for this passphrase
+ long triggerTime = new Date().getTime() + (ttl * 1000);
+ AlarmManager am = (AlarmManager) this.getSystemService(Context.ALARM_SERVICE);
+ am.set(AlarmManager.RTC_WAKEUP, triggerTime, buildIntent(this, keyId));
+ }
} else if (ACTION_PASSPHRASE_CACHE_GET.equals(intent.getAction())) {
long keyId = intent.getLongExtra(EXTRA_KEY_ID, -1);
Messenger messenger = intent.getParcelableExtra(EXTRA_MESSENGER);
@@ -365,4 +367,4 @@ public class PassphraseCacheService extends Service {
private final IBinder mBinder = new PassphraseCacheBinder();
-} \ No newline at end of file
+}