From 97093ca0b295d3d3d32f21930946180b8159d993 Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Tue, 18 Jun 2024 10:21:35 -0300 Subject: [PATCH] Don't restore the storage provider app otherwise it gets killed during data restore which kills our restore process --- .../seedvault/restore/AppDataRestoreManager.kt | 8 +++++++- .../com/stevesoltys/seedvault/restore/RestoreViewModel.kt | 5 +++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/stevesoltys/seedvault/restore/AppDataRestoreManager.kt b/app/src/main/java/com/stevesoltys/seedvault/restore/AppDataRestoreManager.kt index 88caefc0..ccd7dd3f 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/restore/AppDataRestoreManager.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/restore/AppDataRestoreManager.kt @@ -24,6 +24,7 @@ import com.stevesoltys.seedvault.NO_DATA_END_SENTINEL import com.stevesoltys.seedvault.R import com.stevesoltys.seedvault.metadata.PackageMetadataMap import com.stevesoltys.seedvault.metadata.PackageState +import com.stevesoltys.seedvault.plugins.StoragePluginManager import com.stevesoltys.seedvault.restore.install.isInstalled import com.stevesoltys.seedvault.settings.SettingsManager import com.stevesoltys.seedvault.transport.TRANSPORT_ID @@ -54,6 +55,7 @@ internal class AppDataRestoreManager( private val backupManager: IBackupManager, private val settingsManager: SettingsManager, private val restoreCoordinator: RestoreCoordinator, + private val storagePluginManager: StoragePluginManager, ) { private var session: IRestoreSession? = null @@ -97,12 +99,16 @@ internal class AppDataRestoreManager( return } + val providerPackageName = storagePluginManager.appPlugin.providerPackageName val observer = RestoreObserver( restoreCoordinator = restoreCoordinator, restorableBackup = restorableBackup, session = session, // sort packages (reverse) alphabetically, since we move from bottom to top - packages = restorableBackup.packageMetadataMap.packagesSortedByNameDescending, + packages = restorableBackup.packageMetadataMap.packagesSortedByNameDescending.filter { + // filter out current plugin package name, so it doesn't kill our restore + it != providerPackageName + }, monitor = monitor, ) diff --git a/app/src/main/java/com/stevesoltys/seedvault/restore/RestoreViewModel.kt b/app/src/main/java/com/stevesoltys/seedvault/restore/RestoreViewModel.kt index 9aff3eec..0912fbe2 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/restore/RestoreViewModel.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/restore/RestoreViewModel.kt @@ -71,8 +71,9 @@ internal class RestoreViewModel( private val appSelectionManager = AppSelectionManager(app, pluginManager, iconManager, viewModelScope) - private val appDataRestoreManager = - AppDataRestoreManager(app, backupManager, settingsManager, restoreCoordinator) + private val appDataRestoreManager = AppDataRestoreManager( + app, backupManager, settingsManager, restoreCoordinator, pluginManager + ) private val mDisplayFragment = MutableLiveEvent() internal val displayFragment: LiveEvent = mDisplayFragment