mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-23 04:28:35 +00:00
Log backup verify failure independently from file not found.
This commit is contained in:
@@ -15,6 +15,7 @@ object BackupVerifier {
|
|||||||
private val TAG = Log.tag(BackupVerifier::class.java)
|
private val TAG = Log.tag(BackupVerifier::class.java)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
@Throws(IOException::class)
|
||||||
fun verifyFile(cipherStream: InputStream, passphrase: String, expectedCount: Long): Boolean {
|
fun verifyFile(cipherStream: InputStream, passphrase: String, expectedCount: Long): Boolean {
|
||||||
val inputStream = BackupRecordInputStream(cipherStream, passphrase)
|
val inputStream = BackupRecordInputStream(cipherStream, passphrase)
|
||||||
|
|
||||||
|
|||||||
@@ -197,7 +197,12 @@ public final class LocalBackupJobApi29 extends BaseJob {
|
|||||||
ThreadUtil.sleep(WAIT_FOR_SCOPED_STORAGE[attempts]);
|
ThreadUtil.sleep(WAIT_FOR_SCOPED_STORAGE[attempts]);
|
||||||
|
|
||||||
try (InputStream cipherStream = context.getContentResolver().openInputStream(temporaryFile.getUri())) {
|
try (InputStream cipherStream = context.getContentResolver().openInputStream(temporaryFile.getUri())) {
|
||||||
|
try {
|
||||||
valid = BackupVerifier.verifyFile(cipherStream, backupPassword, finishedEvent.getCount());
|
valid = BackupVerifier.verifyFile(cipherStream, backupPassword, finishedEvent.getCount());
|
||||||
|
} catch (IOException e) {
|
||||||
|
Log.w(TAG, "Unable to verify backup", e);
|
||||||
|
valid = false;
|
||||||
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
attempts++;
|
attempts++;
|
||||||
Log.w(TAG, "Unable to find backup file, attempt: " + attempts + "/" + MAX_STORAGE_ATTEMPTS);
|
Log.w(TAG, "Unable to find backup file, attempt: " + attempts + "/" + MAX_STORAGE_ATTEMPTS);
|
||||||
|
|||||||
Reference in New Issue
Block a user