EN: Handle callback exceptions for newest methods

This commit is contained in:
Marvin W 2020-12-10 16:53:42 +01:00
parent 5b5f21d27c
commit 128ca58bfe
No known key found for this signature in database
GPG Key ID: 072E9235DB996F2A

View File

@ -465,7 +465,11 @@ class ExposureNotificationServiceImpl(private val context: Context, private val
}.toString()) }.toString())
} }
try {
params.callback.onResult(Status.SUCCESS, response) params.callback.onResult(Status.SUCCESS, response)
} catch (e: Exception) {
Log.w(TAG, "Callback failed", e)
}
} }
} }
@ -512,7 +516,11 @@ class ExposureNotificationServiceImpl(private val context: Context, private val
}.toString()) }.toString())
} }
try {
params.callback.onResult(Status.SUCCESS, response) params.callback.onResult(Status.SUCCESS, response)
} catch (e: Exception) {
Log.w(TAG, "Callback failed", e)
}
} }
} }
@ -522,7 +530,11 @@ class ExposureNotificationServiceImpl(private val context: Context, private val
database.storeConfiguration(packageName, TOKEN_A, params.mapping) database.storeConfiguration(packageName, TOKEN_A, params.mapping)
database.noteAppAction(packageName, "setDiagnosisKeysDataMapping") database.noteAppAction(packageName, "setDiagnosisKeysDataMapping")
} }
try {
params.callback.onResult(Status.SUCCESS) params.callback.onResult(Status.SUCCESS)
} catch (e: Exception) {
Log.w(TAG, "Callback failed", e)
}
} }
} }
@ -533,7 +545,11 @@ class ExposureNotificationServiceImpl(private val context: Context, private val
database.noteAppAction(packageName, "getDiagnosisKeysDataMapping") database.noteAppAction(packageName, "getDiagnosisKeysDataMapping")
triple?.third triple?.third
} }
try {
params.callback.onResult(Status.SUCCESS, mapping.orDefault()) params.callback.onResult(Status.SUCCESS, mapping.orDefault())
} catch (e: Exception) {
Log.w(TAG, "Callback failed", e)
}
} }
} }
@ -543,7 +559,11 @@ class ExposureNotificationServiceImpl(private val context: Context, private val
ExposureDatabase.with(context) { database -> ExposureDatabase.with(context) { database ->
database.noteAppAction(packageName, "getPackageConfiguration") database.noteAppAction(packageName, "getPackageConfiguration")
} }
try {
params.callback.onResult(Status.SUCCESS, PackageConfiguration.PackageConfigurationBuilder().setValues(Bundle.EMPTY).build()) params.callback.onResult(Status.SUCCESS, PackageConfiguration.PackageConfigurationBuilder().setValues(Bundle.EMPTY).build())
} catch (e: Exception) {
Log.w(TAG, "Callback failed", e)
}
} }
} }
@ -553,7 +573,11 @@ class ExposureNotificationServiceImpl(private val context: Context, private val
ExposureDatabase.with(context) { database -> ExposureDatabase.with(context) { database ->
database.noteAppAction(packageName, "getStatus") database.noteAppAction(packageName, "getStatus")
} }
try {
params.callback.onResult(Status.SUCCESS, ExposureNotificationStatus.setToFlags(setOf(ExposureNotificationStatus.UNKNOWN))) params.callback.onResult(Status.SUCCESS, ExposureNotificationStatus.setToFlags(setOf(ExposureNotificationStatus.UNKNOWN)))
} catch (e: Exception) {
Log.w(TAG, "Callback failed", e)
}
} }
} }