don't crash in BackupMonitor when there is no packageName
this can happens when it tells us that restore has finished overall
This commit is contained in:
parent
16c00be124
commit
2d47aa3d9f
3 changed files with 5 additions and 5 deletions
|
@ -23,13 +23,12 @@ open class BackupMonitor : IBackupManagerMonitor.Stub() {
|
|||
onEvent(
|
||||
id = bundle.getInt(EXTRA_LOG_EVENT_ID),
|
||||
category = bundle.getInt(EXTRA_LOG_EVENT_CATEGORY),
|
||||
packageName = bundle.getString(EXTRA_LOG_EVENT_PACKAGE_NAME)
|
||||
?: error("no package name for $bundle"),
|
||||
packageName = bundle.getString(EXTRA_LOG_EVENT_PACKAGE_NAME),
|
||||
bundle = bundle,
|
||||
)
|
||||
}
|
||||
|
||||
open fun onEvent(id: Int, category: Int, packageName: String, bundle: Bundle) {
|
||||
open fun onEvent(id: Int, category: Int, packageName: String?, bundle: Bundle) {
|
||||
if (id == LOG_EVENT_ID_ERROR_PREFLIGHT) {
|
||||
val preflightResult = bundle.getLong(EXTRA_LOG_PREFLIGHT_ERROR, -1)
|
||||
Log.w(TAG, "Pre-flight error from $packageName: $preflightResult")
|
||||
|
|
|
@ -20,9 +20,9 @@ internal class BackupTransportMonitor(
|
|||
|
||||
private val log = KotlinLogging.logger { }
|
||||
|
||||
override fun onEvent(id: Int, category: Int, packageName: String, bundle: Bundle) {
|
||||
override fun onEvent(id: Int, category: Int, packageName: String?, bundle: Bundle) {
|
||||
super.onEvent(id, category, packageName, bundle)
|
||||
if (id == LOG_EVENT_ID_NO_DATA_TO_SEND &&
|
||||
if (packageName != null && id == LOG_EVENT_ID_NO_DATA_TO_SEND &&
|
||||
category == LOG_EVENT_CATEGORY_BACKUP_MANAGER_POLICY
|
||||
) {
|
||||
sendNoDataChanged(packageName)
|
||||
|
|
|
@ -67,6 +67,7 @@ internal class ApkBackupManager(
|
|||
}
|
||||
}
|
||||
|
||||
// TODO we could use BackupMonitor for this. It emits LOG_EVENT_ID_PACKAGE_STOPPED
|
||||
private fun recordNotBackedUpPackages() {
|
||||
nm.onAppsNotBackedUp()
|
||||
packageService.notBackedUpPackages.forEach { packageInfo ->
|
||||
|
|
Loading…
Reference in a new issue