mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 00:37:47 +00:00
Fix decryption corner case when passphrase is disabled.
This commit is contained in:
parent
5a3daf4846
commit
40629a3bcf
@ -215,6 +215,16 @@ public class SendReceiveService extends Service {
|
||||
CanonicalSessionMigrator.migrateSessions(this);
|
||||
}
|
||||
|
||||
private MasterSecret getPlaceholderSecret() {
|
||||
try {
|
||||
return MasterSecretUtil.getMasterSecret(SendReceiveService.this,
|
||||
MasterSecretUtil.UNENCRYPTED_PASSPHRASE);
|
||||
} catch (InvalidPassphraseException e) {
|
||||
Log.w("SendReceiveService", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private void scheduleIntent(int what, Intent intent) {
|
||||
Runnable work = new SendReceiveWorkItem(intent, what);
|
||||
|
||||
@ -228,6 +238,10 @@ public class SendReceiveService extends Service {
|
||||
Runnable work = new SendReceiveWorkItem(intent, what);
|
||||
|
||||
synchronized (workQueue) {
|
||||
if (!hasSecret && TextSecurePreferences.isPasswordDisabled(SendReceiveService.this)) {
|
||||
initializeWithMasterSecret(getPlaceholderSecret());
|
||||
}
|
||||
|
||||
if (hasSecret) {
|
||||
workQueue.add(work);
|
||||
workQueue.notifyAll();
|
||||
@ -266,16 +280,6 @@ public class SendReceiveService extends Service {
|
||||
case DOWNLOAD_AVATAR: avatarDownloader.process(masterSecret, intent); return;
|
||||
}
|
||||
}
|
||||
|
||||
private MasterSecret getPlaceholderSecret() {
|
||||
try {
|
||||
return MasterSecretUtil.getMasterSecret(SendReceiveService.this,
|
||||
MasterSecretUtil.UNENCRYPTED_PASSPHRASE);
|
||||
} catch (InvalidPassphraseException e) {
|
||||
Log.w("SendReceiveService", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class ToastHandler extends Handler {
|
||||
|
Loading…
x
Reference in New Issue
Block a user