Don't disable framework scheduling when not current transport
This commit is contained in:
parent
22ca2550c2
commit
878492088d
1 changed files with 8 additions and 5 deletions
|
@ -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,6 +186,7 @@ open class App : Application() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (backupManager.currentTransport == TRANSPORT_ID) {
|
||||||
backupManager.setFrameworkSchedulingEnabledForUser(UserHandle.myUserId(), false)
|
backupManager.setFrameworkSchedulingEnabledForUser(UserHandle.myUserId(), false)
|
||||||
if (backupManager.isBackupEnabled && !pluginManager.isOnRemovableDrive) {
|
if (backupManager.isBackupEnabled && !pluginManager.isOnRemovableDrive) {
|
||||||
AppBackupWorker.schedule(applicationContext, settingsManager, UPDATE)
|
AppBackupWorker.schedule(applicationContext, settingsManager, UPDATE)
|
||||||
|
@ -192,6 +194,7 @@ open class App : Application() {
|
||||||
// cancel old D2D worker
|
// cancel old D2D worker
|
||||||
WorkManager.getInstance(this).cancelUniqueWork("APP_BACKUP")
|
WorkManager.getInstance(this).cancelUniqueWork("APP_BACKUP")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun isFrameworkSchedulingEnabled(): Boolean = Settings.Secure.getInt(
|
private fun isFrameworkSchedulingEnabled(): Boolean = Settings.Secure.getInt(
|
||||||
contentResolver, Settings.Secure.BACKUP_SCHEDULING_ENABLED, 1
|
contentResolver, Settings.Secure.BACKUP_SCHEDULING_ENABLED, 1
|
||||||
|
|
Loading…
Reference in a new issue