mirror of
https://github.com/moparisthebest/open-keychain
synced 2025-01-11 21:48:17 -05:00
Fixed issues discussed in #713
This commit is contained in:
parent
7a3fe61a1f
commit
079194abe5
@ -60,8 +60,8 @@ public class PassphraseCacheService extends Service {
|
|||||||
+ "PASSPHRASE_CACHE_ADD";
|
+ "PASSPHRASE_CACHE_ADD";
|
||||||
public static final String ACTION_PASSPHRASE_CACHE_GET = Constants.INTENT_PREFIX
|
public static final String ACTION_PASSPHRASE_CACHE_GET = Constants.INTENT_PREFIX
|
||||||
+ "PASSPHRASE_CACHE_GET";
|
+ "PASSPHRASE_CACHE_GET";
|
||||||
public static final String ACTION_PASSPHRASE_CACHE_PURGE = Constants.INTENT_PREFIX
|
public static final String ACTION_PASSPHRASE_CACHE_CLEAR = Constants.INTENT_PREFIX
|
||||||
+ "PASSPHRASE_CACHE_PURGE";
|
+ "PASSPHRASE_CACHE_CLEAR";
|
||||||
|
|
||||||
public static final String BROADCAST_ACTION_PASSPHRASE_CACHE_SERVICE = Constants.INTENT_PREFIX
|
public static final String BROADCAST_ACTION_PASSPHRASE_CACHE_SERVICE = Constants.INTENT_PREFIX
|
||||||
+ "PASSPHRASE_CACHE_BROADCAST";
|
+ "PASSPHRASE_CACHE_BROADCAST";
|
||||||
@ -177,7 +177,7 @@ public class PassphraseCacheService extends Service {
|
|||||||
if (cachedPassphrase == null) {
|
if (cachedPassphrase == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
addCachedPassphrase(this, Constants.key.symmetric, cachedPassphrase, "Password");
|
addCachedPassphrase(this, Constants.key.symmetric, cachedPassphrase, getString(R.string.passp_cache_notif_pwd));
|
||||||
return cachedPassphrase;
|
return cachedPassphrase;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -309,7 +309,7 @@ public class PassphraseCacheService extends Service {
|
|||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Log.e(Constants.TAG, "PassphraseCacheService Sending message failed", e);
|
Log.e(Constants.TAG, "PassphraseCacheService Sending message failed", e);
|
||||||
}
|
}
|
||||||
} else if (ACTION_PASSPHRASE_CACHE_PURGE.equals(intent.getAction())) {
|
} else if (ACTION_PASSPHRASE_CACHE_CLEAR.equals(intent.getAction())) {
|
||||||
AlarmManager am = (AlarmManager) this.getSystemService(Context.ALARM_SERVICE);
|
AlarmManager am = (AlarmManager) this.getSystemService(Context.ALARM_SERVICE);
|
||||||
|
|
||||||
// Stop all ttl alarms
|
// Stop all ttl alarms
|
||||||
@ -375,10 +375,10 @@ public class PassphraseCacheService extends Service {
|
|||||||
|
|
||||||
// Add purging action
|
// Add purging action
|
||||||
Intent intent = new Intent(getApplicationContext(), PassphraseCacheService.class);
|
Intent intent = new Intent(getApplicationContext(), PassphraseCacheService.class);
|
||||||
intent.setAction(ACTION_PASSPHRASE_CACHE_PURGE);
|
intent.setAction(ACTION_PASSPHRASE_CACHE_CLEAR);
|
||||||
builder.addAction(
|
builder.addAction(
|
||||||
R.drawable.abc_ic_clear_normal,
|
R.drawable.abc_ic_clear_normal,
|
||||||
getString(R.string.passp_cache_notif_purge),
|
getString(R.string.passp_cache_notif_clear),
|
||||||
PendingIntent.getService(
|
PendingIntent.getService(
|
||||||
getApplicationContext(),
|
getApplicationContext(),
|
||||||
0,
|
0,
|
||||||
@ -393,10 +393,10 @@ public class PassphraseCacheService extends Service {
|
|||||||
|
|
||||||
builder.setSmallIcon(R.drawable.ic_launcher)
|
builder.setSmallIcon(R.drawable.ic_launcher)
|
||||||
.setContentTitle(String.format(getString(R.string.passp_cache_notif_n_keys, mPassphraseCache.size())))
|
.setContentTitle(String.format(getString(R.string.passp_cache_notif_n_keys, mPassphraseCache.size())))
|
||||||
.setContentText(getString(R.string.passp_cache_notif_click_to_purge));
|
.setContentText(getString(R.string.passp_cache_notif_click_to_clear));
|
||||||
|
|
||||||
Intent intent = new Intent(getApplicationContext(), PassphraseCacheService.class);
|
Intent intent = new Intent(getApplicationContext(), PassphraseCacheService.class);
|
||||||
intent.setAction(ACTION_PASSPHRASE_CACHE_PURGE);
|
intent.setAction(ACTION_PASSPHRASE_CACHE_CLEAR);
|
||||||
|
|
||||||
builder.setContentIntent(
|
builder.setContentIntent(
|
||||||
PendingIntent.getService(
|
PendingIntent.getService(
|
||||||
@ -444,8 +444,8 @@ public class PassphraseCacheService extends Service {
|
|||||||
private final IBinder mBinder = new PassphraseCacheBinder();
|
private final IBinder mBinder = new PassphraseCacheBinder();
|
||||||
|
|
||||||
public class CachedPassphrase {
|
public class CachedPassphrase {
|
||||||
private String primaryUserID = "";
|
private String primaryUserID;
|
||||||
private String passphrase = "";
|
private String passphrase;
|
||||||
|
|
||||||
public CachedPassphrase(String passphrase, String primaryUserID) {
|
public CachedPassphrase(String passphrase, String primaryUserID) {
|
||||||
setPassphrase(passphrase);
|
setPassphrase(passphrase);
|
||||||
|
@ -190,7 +190,7 @@ public class PassphraseDialogFragment extends DialogFragment implements OnEditor
|
|||||||
// Early breakout if we are dealing with a symmetric key
|
// Early breakout if we are dealing with a symmetric key
|
||||||
if (secretRing == null) {
|
if (secretRing == null) {
|
||||||
PassphraseCacheService.addCachedPassphrase(activity, Constants.key.symmetric,
|
PassphraseCacheService.addCachedPassphrase(activity, Constants.key.symmetric,
|
||||||
passphrase, "Password");
|
passphrase, getString(R.string.passp_cache_notif_pwd));
|
||||||
// also return passphrase back to activity
|
// also return passphrase back to activity
|
||||||
Bundle data = new Bundle();
|
Bundle data = new Bundle();
|
||||||
data.putString(MESSAGE_DATA_PASSPHRASE, passphrase);
|
data.putString(MESSAGE_DATA_PASSPHRASE, passphrase);
|
||||||
@ -234,7 +234,7 @@ public class PassphraseDialogFragment extends DialogFragment implements OnEditor
|
|||||||
PassphraseCacheService.addCachedPassphrase(activity, masterKeyId, passphrase,
|
PassphraseCacheService.addCachedPassphrase(activity, masterKeyId, passphrase,
|
||||||
secretRing.getPrimaryUserId());
|
secretRing.getPrimaryUserId());
|
||||||
} catch(PgpGeneralException e) {
|
} catch(PgpGeneralException e) {
|
||||||
Log.e(Constants.TAG, e.getMessage());
|
Log.e(Constants.TAG, "adding of a passhrase failed", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unlockedSecretKey.getKeyId() != masterKeyId) {
|
if (unlockedSecretKey.getKeyId() != masterKeyId) {
|
||||||
|
@ -661,10 +661,11 @@
|
|||||||
<string name="msg_mf_unlock">Unlocking keyring</string>
|
<string name="msg_mf_unlock">Unlocking keyring</string>
|
||||||
|
|
||||||
<!-- PassphraseCache -->
|
<!-- PassphraseCache -->
|
||||||
<string name="passp_cache_notif_click_to_purge">Click to purge cached passphrases</string>
|
<string name="passp_cache_notif_click_to_clear">Click to clear cached passphrases</string>
|
||||||
<string name="passp_cache_notif_n_keys">OpenKeychain has cached %i keys</string>
|
<string name="passp_cache_notif_n_keys">OpenKeychain has cached %i keys</string>
|
||||||
<string name="passp_cache_notif_keys">Cached Keys:</string>
|
<string name="passp_cache_notif_keys">Cached Keys:</string>
|
||||||
<string name="passp_cache_notif_purge">Purge Cache</string>
|
<string name="passp_cache_notif_clear">Clear Cache</string>
|
||||||
|
<string name="passp_cache_notif_pwd">Password</string>
|
||||||
|
|
||||||
<!-- unsorted -->
|
<!-- unsorted -->
|
||||||
<string name="section_certifier_id">Certifier</string>
|
<string name="section_certifier_id">Certifier</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user