When the restore action fails due to choosing a non-encrypted file while roomBackup is expecting an encrypted file (backupIsEncrypted(true)) (exitCode 7) or due to choosing an encrypted file while roomBackup is expecting a non-encrypted file (backupIsEncrypted(false)) (exitCode 9), the database might close, leading to a crash during subsequent operations such as deleting an entry from the list.
SQLiteLog de....abasebackup.sample E (1) no such table: room_table_modification_log in "SELECT * FROM room_table_modification_log WHERE invalidated = 1;"
ROOM de....abasebackup.sample E Cannot run invalidation tracker. Is the db closed?
android.database.sqlite.SQLiteException: no such table: room_table_modification_log (code 1 SQLITE_ERROR): , while compiling: SELECT * FROM room_table_modification_log WHERE invalidated = 1;
To Reproduce
Steps to reproduce the behavior:
Take an encrypted backup in the demo app.
Disable the Encrypt Backup from Properties.
Restore the encrypted backup file.
It will fail with exitCode: 9.
Now delete an entry from the Fruits List and observe the log entries for crash details.
The other scenario (exitCode 7) also causes a crash.
Expected behavior
When an operation fails in this manner, the database should be handled the same way as after exitCode 0 (success), i.e., no crash.
Screenshots
Not applicable, issue is 100% reproducible.
Smartphone (please complete the following information):
Tested on AVD API 33 and on Huawei Y5 API 23, the same behavior was observed.
Additional context
This issue is very likely to happen if an app offers both encrypted and non-encrypted backup options. If a user inadvertently chooses the wrong file, it may lead to a crash afterward.
Describe the bug
When the restore action fails due to choosing a non-encrypted file while
roomBackup
is expecting an encrypted file (backupIsEncrypted(true)
) (exitCode 7) or due to choosing an encrypted file whileroomBackup
is expecting a non-encrypted file (backupIsEncrypted(false)
) (exitCode 9), the database might close, leading to a crash during subsequent operations such as deleting an entry from the list.To Reproduce
Steps to reproduce the behavior:
The other scenario (exitCode 7) also causes a crash.
Expected behavior
When an operation fails in this manner, the database should be handled the same way as after exitCode 0 (success), i.e., no crash.
Screenshots
Not applicable, issue is 100% reproducible.
Smartphone (please complete the following information):
Tested on AVD API 33 and on Huawei Y5 API 23, the same behavior was observed.
Additional context
This issue is very likely to happen if an app offers both encrypted and non-encrypted backup options. If a user inadvertently chooses the wrong file, it may lead to a crash afterward.