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(
|
onEvent(
|
||||||
id = bundle.getInt(EXTRA_LOG_EVENT_ID),
|
id = bundle.getInt(EXTRA_LOG_EVENT_ID),
|
||||||
category = bundle.getInt(EXTRA_LOG_EVENT_CATEGORY),
|
category = bundle.getInt(EXTRA_LOG_EVENT_CATEGORY),
|
||||||
packageName = bundle.getString(EXTRA_LOG_EVENT_PACKAGE_NAME)
|
packageName = bundle.getString(EXTRA_LOG_EVENT_PACKAGE_NAME),
|
||||||
?: error("no package name for $bundle"),
|
|
||||||
bundle = bundle,
|
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) {
|
if (id == LOG_EVENT_ID_ERROR_PREFLIGHT) {
|
||||||
val preflightResult = bundle.getLong(EXTRA_LOG_PREFLIGHT_ERROR, -1)
|
val preflightResult = bundle.getLong(EXTRA_LOG_PREFLIGHT_ERROR, -1)
|
||||||
Log.w(TAG, "Pre-flight error from $packageName: $preflightResult")
|
Log.w(TAG, "Pre-flight error from $packageName: $preflightResult")
|
||||||
|
|
|
@ -20,9 +20,9 @@ internal class BackupTransportMonitor(
|
||||||
|
|
||||||
private val log = KotlinLogging.logger { }
|
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)
|
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
|
category == LOG_EVENT_CATEGORY_BACKUP_MANAGER_POLICY
|
||||||
) {
|
) {
|
||||||
sendNoDataChanged(packageName)
|
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() {
|
private fun recordNotBackedUpPackages() {
|
||||||
nm.onAppsNotBackedUp()
|
nm.onAppsNotBackedUp()
|
||||||
packageService.notBackedUpPackages.forEach { packageInfo ->
|
packageService.notBackedUpPackages.forEach { packageInfo ->
|
||||||
|
|
Loading…
Reference in a new issue