mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 11:12:15 -05:00
prevent cancel dring consolidate, move logic into progressable
This commit is contained in:
parent
b8ed54bc69
commit
082722a3cf
@ -23,4 +23,6 @@ public interface Progressable {
|
|||||||
void setProgress(int resourceId, int current, int total);
|
void setProgress(int resourceId, int current, int total);
|
||||||
|
|
||||||
void setProgress(int current, int total);
|
void setProgress(int current, int total);
|
||||||
|
|
||||||
|
void setPreventCancel();
|
||||||
}
|
}
|
||||||
|
@ -938,6 +938,9 @@ public class ProviderHelper {
|
|||||||
|
|
||||||
progress.setProgress(R.string.progress_con_saving, 0, 100);
|
progress.setProgress(R.string.progress_con_saving, 0, 100);
|
||||||
|
|
||||||
|
// The consolidate operation can never be cancelled!
|
||||||
|
progress.setPreventCancel();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
log.add(LogType.MSG_CON_SAVE_SECRET, indent);
|
log.add(LogType.MSG_CON_SAVE_SECRET, indent);
|
||||||
|
@ -472,8 +472,7 @@ public class KeychainIntentService extends IntentService implements Progressable
|
|||||||
|
|
||||||
// Special: consolidate on secret key import (cannot be cancelled!)
|
// Special: consolidate on secret key import (cannot be cancelled!)
|
||||||
if (result.mSecret > 0) {
|
if (result.mSecret > 0) {
|
||||||
// cannot cancel from here on out!
|
// TODO move this into the import operation
|
||||||
sendMessageToHandler(KeychainIntentServiceHandler.MESSAGE_PREVENT_CANCEL);
|
|
||||||
providerHelper.consolidateDatabaseStep1(this);
|
providerHelper.consolidateDatabaseStep1(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -676,6 +675,11 @@ public class KeychainIntentService extends IntentService implements Progressable
|
|||||||
setProgress(null, progress, max);
|
setProgress(null, progress, max);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPreventCancel() {
|
||||||
|
sendMessageToHandler(KeychainIntentServiceHandler.MESSAGE_PREVENT_CANCEL);
|
||||||
|
}
|
||||||
|
|
||||||
private InputData createDecryptInputData(Bundle data) throws IOException, PgpGeneralException {
|
private InputData createDecryptInputData(Bundle data) throws IOException, PgpGeneralException {
|
||||||
return createCryptInputData(data, DECRYPT_CIPHERTEXT_BYTES);
|
return createCryptInputData(data, DECRYPT_CIPHERTEXT_BYTES);
|
||||||
}
|
}
|
||||||
|
@ -60,4 +60,10 @@ public class ProgressScaler implements Progressable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPreventCancel() {
|
||||||
|
if (mWrapped != null) {
|
||||||
|
mWrapped.setPreventCancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user