passphrasecache: update defaults, add "forever" setting
This commit is contained in:
parent
dfeb122378
commit
e66c27c081
|
@ -365,6 +365,8 @@ public class PassphraseCacheService extends Service {
|
|||
CachedPassphrase cachedPassphrase;
|
||||
if (timeoutTtl == 0L) {
|
||||
cachedPassphrase = CachedPassphrase.getPassphraseLock(passphrase, primaryUserID);
|
||||
} else if (timeoutTtl >= Integer.MAX_VALUE) {
|
||||
cachedPassphrase = CachedPassphrase.getPassphraseNoTimeout(passphrase, primaryUserID);
|
||||
} else {
|
||||
cachedPassphrase = CachedPassphrase.getPassphraseTtlTimeout(passphrase, primaryUserID, timeoutTtl);
|
||||
|
||||
|
@ -427,7 +429,10 @@ public class PassphraseCacheService extends Service {
|
|||
|
||||
// Stop all ttl alarms
|
||||
for (int i = 0; i < mPassphraseCache.size(); i++) {
|
||||
am.cancel(buildIntent(this, mPassphraseCache.keyAt(i)));
|
||||
CachedPassphrase cachedPassphrase = mPassphraseCache.valueAt(i);
|
||||
if (cachedPassphrase.mTimeoutMode == TimeoutMode.TTL) {
|
||||
am.cancel(buildIntent(this, mPassphraseCache.keyAt(i)));
|
||||
}
|
||||
}
|
||||
mPassphraseCache.clear();
|
||||
|
||||
|
|
|
@ -77,7 +77,6 @@ public class SettingsCacheTTLFragment extends Fragment {
|
|||
recyclerView.setAdapter(mAdapter);
|
||||
recyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST));
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void savePreference() {
|
||||
|
|
|
@ -322,11 +322,13 @@ public class Preferences {
|
|||
static {
|
||||
HashMap<Integer,Integer> cacheTtlNames = new HashMap<>();
|
||||
cacheTtlNames.put(0, R.string.cache_ttl_lock_screen);
|
||||
cacheTtlNames.put(60 * 5, R.string.cache_ttl_five_minutes);
|
||||
cacheTtlNames.put(60 * 10, R.string.cache_ttl_ten_minutes);
|
||||
cacheTtlNames.put(60 * 30, R.string.cache_ttl_thirty_minutes);
|
||||
cacheTtlNames.put(60 * 60, R.string.cache_ttl_one_hour);
|
||||
cacheTtlNames.put(60 * 60 * 3, R.string.cache_ttl_three_hours);
|
||||
cacheTtlNames.put(60 * 60 * 24, R.string.cache_ttl_one_day);
|
||||
cacheTtlNames.put(60 * 60 * 24 * 3, R.string.cache_ttl_three_days);
|
||||
cacheTtlNames.put(Integer.MAX_VALUE, R.string.cache_ttl_forever);
|
||||
CACHE_TTL_NAMES = Collections.unmodifiableMap(cacheTtlNames);
|
||||
|
||||
CACHE_TTLS = new ArrayList<>(CacheTTLPrefs.CACHE_TTL_NAMES.keySet());
|
||||
|
@ -352,7 +354,7 @@ public class Preferences {
|
|||
|
||||
public static CacheTTLPrefs getDefault() {
|
||||
ArrayList<String> ttlStrings = new ArrayList<>();
|
||||
ttlStrings.add(Integer.toString(60 * 5));
|
||||
ttlStrings.add(Integer.toString(0));
|
||||
ttlStrings.add(Integer.toString(60 * 60));
|
||||
ttlStrings.add(Integer.toString(60 * 60 * 24));
|
||||
return new CacheTTLPrefs(ttlStrings);
|
||||
|
|
|
@ -1709,11 +1709,13 @@
|
|||
<string name="title_edit_subkeys">"Edit Subkeys"</string>
|
||||
<string name="btn_search_for_query">"Search for\n'%s'"</string>
|
||||
<string name="cache_ttl_lock_screen">"until Screen Off"</string>
|
||||
<string name="cache_ttl_five_minutes">"for Five Minutes"</string>
|
||||
<string name="cache_ttl_ten_minutes">"for Ten Minutes"</string>
|
||||
<string name="cache_ttl_thirty_minutes">"for Thirty Minutes"</string>
|
||||
<string name="cache_ttl_one_hour">"for One Hour"</string>
|
||||
<string name="cache_ttl_three_hours">"for Three Hours"</string>
|
||||
<string name="cache_ttl_one_day">"for One Day"</string>
|
||||
<string name="cache_ttl_three_days">"for Three Days"</string>
|
||||
<string name="cache_ttl_forever">"forever"</string>
|
||||
<string name="settings_cache_select_three">"Pick up to three."</string>
|
||||
<string name="settings_cache_ttl_at_least_one">"At least one item must be selected!"</string>
|
||||
<string name="settings_cache_ttl_max_three">"Can\'t select more than three items!"</string>
|
||||
|
|
Loading…
Reference in a new issue