Skip to content
Snippets Groups Projects
Unverified Commit 8f9f27c0 authored by Matthias Urhahn's avatar Matthias Urhahn Committed by GitHub
Browse files

Fixes 9002 error caused by test fragment risk reset (related to EXPOSUREAPP-1851) (#1037)


* Resetting the preferences deletes our database encryption credentials, but we don't delete the database itself.
On app restart, there is a mismatch between the newly generated credentials and the old database.

* Include dependency 'androidx.annotation'.
The previous commit accidentally used the transitive dependency from google-utils.

Co-authored-by: default avatarMatthias Urhahn <matthias.urhahn@sap.com>
Co-authored-by: default avatarJakob Möller <jakob.moeller@sap.com>
Co-authored-by: default avatarharambasicluka <64483219+harambasicluka@users.noreply.github.com>
parent 6b9c14f1
No related branches found
No related tags found
No related merge requests found
......@@ -235,6 +235,7 @@ dependencies {
implementation 'androidx.preference:preference:1.1.1'
implementation 'androidx.work:work-runtime-ktx:2.3.4'
implementation 'android.arch.lifecycle:extensions:1.1.1'
implementation 'androidx.annotation:annotation:1.1.0'
// QR
implementation('com.journeyapps:zxing-android-embedded:4.1.0') { transitive = false }
......
......@@ -107,10 +107,10 @@ class TestRiskLevelCalculation : Fragment() {
tracingViewModel.viewModelScope.launch {
withContext(Dispatchers.IO) {
try {
// Database Reset
AppDatabase.getInstance(requireContext()).clearAllTables()
// Delete Database Instance
// Preference reset
SecurityHelper.resetSharedPrefs()
// Database Reset
AppDatabase.reset(requireContext())
// Export File Reset
FileStorageHelper.getAllFilesInKeyExportDirectory().forEach { it.delete() }
......@@ -124,7 +124,7 @@ class TestRiskLevelCalculation : Fragment() {
}
RiskLevelTransaction.start()
Toast.makeText(
requireContext(), "Resetted, please fetch diagnosis keys from server again",
requireContext(), "Reset done, please fetch diagnosis keys from server again",
Toast.LENGTH_SHORT
).show()
}
......
......@@ -2,6 +2,7 @@ package de.rki.coronawarnapp.storage
import android.content.Context
import android.database.sqlite.SQLiteDatabase
import androidx.annotation.VisibleForTesting
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
......@@ -39,6 +40,7 @@ abstract class AppDatabase : RoomDatabase() {
}
}
@VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
fun resetInstance() = synchronized(this) {
instance = null
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment