Don't disable framework scheduling when not current transport

This commit is contained in:
Torsten Grote 2024-06-18 11:10:10 -03:00
parent 22ca2550c2
commit 878492088d
No known key found for this signature in database
GPG key ID: 3E5F77D92CF891FF

View file

@ -33,6 +33,7 @@ import com.stevesoltys.seedvault.settings.AppListRetriever
import com.stevesoltys.seedvault.settings.SettingsManager import com.stevesoltys.seedvault.settings.SettingsManager
import com.stevesoltys.seedvault.settings.SettingsViewModel import com.stevesoltys.seedvault.settings.SettingsViewModel
import com.stevesoltys.seedvault.storage.storageModule import com.stevesoltys.seedvault.storage.storageModule
import com.stevesoltys.seedvault.transport.TRANSPORT_ID
import com.stevesoltys.seedvault.transport.backup.backupModule import com.stevesoltys.seedvault.transport.backup.backupModule
import com.stevesoltys.seedvault.transport.restore.restoreModule import com.stevesoltys.seedvault.transport.restore.restoreModule
import com.stevesoltys.seedvault.ui.files.FileSelectionViewModel import com.stevesoltys.seedvault.ui.files.FileSelectionViewModel
@ -185,12 +186,14 @@ open class App : Application() {
return return
} }
backupManager.setFrameworkSchedulingEnabledForUser(UserHandle.myUserId(), false) if (backupManager.currentTransport == TRANSPORT_ID) {
if (backupManager.isBackupEnabled && !pluginManager.isOnRemovableDrive) { backupManager.setFrameworkSchedulingEnabledForUser(UserHandle.myUserId(), false)
AppBackupWorker.schedule(applicationContext, settingsManager, UPDATE) if (backupManager.isBackupEnabled && !pluginManager.isOnRemovableDrive) {
AppBackupWorker.schedule(applicationContext, settingsManager, UPDATE)
}
// cancel old D2D worker
WorkManager.getInstance(this).cancelUniqueWork("APP_BACKUP")
} }
// cancel old D2D worker
WorkManager.getInstance(this).cancelUniqueWork("APP_BACKUP")
} }
private fun isFrameworkSchedulingEnabled(): Boolean = Settings.Secure.getInt( private fun isFrameworkSchedulingEnabled(): Boolean = Settings.Secure.getInt(