create worker for every auto upload folder

Signed-off-by: Jonas Mayer <jonas.a.mayer@gmx.net>
This commit is contained in:
Jonas Mayer 2024-05-16 14:13:16 +02:00 committed by Jonas Mayer
parent 7031d62def
commit fde7b2914f
11 changed files with 176 additions and 141 deletions

View file

@ -119,11 +119,16 @@ interface BackgroundJobManager {
fun startImmediateFilesExportJob(files: Collection<OCFile>): LiveData<JobInfo?>
fun schedulePeriodicFilesSyncJob()
fun schedulePeriodicFilesSyncJob(syncedFolderID: Long)
/**
* Immediately start File Sync job for given syncFolderID if provided. If no syncFolderID is provided, it will start
* the syncFolder job for all sync folders.
*/
fun startImmediateFilesSyncJob(
syncedFolderID: Long,
overridePowerSaving: Boolean = false,
changedFiles: Array<String> = arrayOf<String>()
changedFiles: Array<String> = arrayOf<String>(),
)
fun scheduleOfflineSync()
@ -163,5 +168,5 @@ interface BackgroundJobManager {
fun cancelAllJobs()
fun schedulePeriodicHealthStatus()
fun startHealthStatus()
fun bothFilesSyncJobsRunning(): Boolean
fun bothFilesSyncJobsRunning(syncedFolderID: Long): Boolean
}

View file

@ -404,27 +404,37 @@ internal class BackgroundJobManagerImpl(
workManager.cancelJob(JOB_PERIODIC_CALENDAR_BACKUP, user)
}
override fun bothFilesSyncJobsRunning(): Boolean {
return workManager.isWorkRunning(JOB_PERIODIC_FILES_SYNC) &&
workManager.isWorkRunning(JOB_IMMEDIATE_FILES_SYNC)
override fun bothFilesSyncJobsRunning(syncedFolderID: Long): Boolean {
return workManager.isWorkRunning(JOB_PERIODIC_FILES_SYNC+"_"+syncedFolderID) &&
workManager.isWorkRunning(JOB_IMMEDIATE_FILES_SYNC+"_"+syncedFolderID)
}
override fun schedulePeriodicFilesSyncJob() {
override fun schedulePeriodicFilesSyncJob(
syncedFolderID: Long
) {
val arguments = Data.Builder()
.putLong(FilesSyncWork.SYNCED_FOLDER_ID, syncedFolderID)
.build()
val request = periodicRequestBuilder(
jobClass = FilesSyncWork::class,
jobName = JOB_PERIODIC_FILES_SYNC,
intervalMins = DEFAULT_PERIODIC_JOB_INTERVAL_MINUTES
).build()
)
.setInputData(arguments)
.build()
workManager.enqueueUniquePeriodicWork(JOB_PERIODIC_FILES_SYNC, ExistingPeriodicWorkPolicy.REPLACE, request)
}
override fun startImmediateFilesSyncJob(
syncedFolderID: Long,
overridePowerSaving: Boolean,
changedFiles: Array<String>
changedFiles: Array<String>,
) {
val arguments = Data.Builder()
.putBoolean(FilesSyncWork.OVERRIDE_POWER_SAVING, overridePowerSaving)
.putStringArray(FilesSyncWork.CHANGED_FILES, changedFiles)
.putLong(FilesSyncWork.SYNCED_FOLDER_ID, syncedFolderID)
.build()
val request = oneTimeRequestBuilder(

View file

@ -48,13 +48,15 @@ class ContentObserverWork(
}
private fun checkAndStartFileSyncJob() {
val syncFolders = syncerFolderProvider.countEnabledSyncedFolders() > 0
if (!powerManagementService.isPowerSavingEnabled && syncFolders) {
val syncFolders = syncerFolderProvider.syncedFolders
if (!powerManagementService.isPowerSavingEnabled && syncerFolderProvider.countEnabledSyncedFolders() > 0) {
val changedFiles = mutableListOf<String>()
for (uri in params.triggeredContentUris) {
changedFiles.add(uri.toString())
}
backgroundJobManager.startImmediateFilesSyncJob(false, changedFiles.toTypedArray())
for (syncFolder in syncFolders){
backgroundJobManager.startImmediateFilesSyncJob(syncFolder.id, false, changedFiles.toTypedArray())
}
}
}

View file

@ -11,11 +11,8 @@ package com.nextcloud.client.jobs
import android.content.ContentResolver
import android.content.Context
import android.content.res.Resources
import android.os.Build
import android.text.TextUtils
import androidx.core.app.NotificationCompat
import androidx.exifinterface.media.ExifInterface
import androidx.work.ForegroundInfo
import androidx.work.Worker
import androidx.work.WorkerParameters
import com.nextcloud.client.account.UserAccountManager
@ -28,7 +25,6 @@ import com.owncloud.android.R
import com.owncloud.android.datamodel.ArbitraryDataProvider
import com.owncloud.android.datamodel.ArbitraryDataProviderImpl
import com.owncloud.android.datamodel.FilesystemDataProvider
import com.owncloud.android.datamodel.ForegroundServiceType
import com.owncloud.android.datamodel.MediaFolderType
import com.owncloud.android.datamodel.SyncedFolder
import com.owncloud.android.datamodel.SyncedFolderProvider
@ -36,7 +32,6 @@ import com.owncloud.android.datamodel.UploadsStorageManager
import com.owncloud.android.lib.common.utils.Log_OC
import com.owncloud.android.operations.UploadFileOperation
import com.owncloud.android.ui.activity.SettingsActivity
import com.owncloud.android.ui.notifications.NotificationUtils
import com.owncloud.android.utils.FileStorageUtils
import com.owncloud.android.utils.FilesSyncHelper
import com.owncloud.android.utils.MimeType
@ -64,72 +59,60 @@ class FilesSyncWork(
const val TAG = "FilesSyncJob"
const val OVERRIDE_POWER_SAVING = "overridePowerSaving"
const val CHANGED_FILES = "changedFiles"
const val FOREGROUND_SERVICE_ID = 414
const val SYNCED_FOLDER_ID = "syncedFolderId"
}
@Suppress("MagicNumber")
private fun updateForegroundWorker(progressPercent: Int, useForegroundWorker: Boolean) {
if (!useForegroundWorker) {
return
}
private lateinit var syncedFolder: SyncedFolder
// update throughout worker execution to give use feedback how far worker is
val notification = NotificationCompat.Builder(context, NotificationUtils.NOTIFICATION_CHANNEL_FILE_SYNC)
.setTicker(context.getString(R.string.autoupload_worker_foreground_info))
.setContentText(context.getString(R.string.autoupload_worker_foreground_info))
.setSmallIcon(R.drawable.notification_icon)
.setContentTitle(context.getString(R.string.autoupload_worker_foreground_info))
.setOngoing(true)
.setProgress(100, progressPercent, false)
.build()
val foregroundInfo = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
ForegroundInfo(FOREGROUND_SERVICE_ID, notification, ForegroundServiceType.DataSync.getId())
} else {
ForegroundInfo(FOREGROUND_SERVICE_ID, notification)
}
setForegroundAsync(foregroundInfo)
}
private fun canExitEarly(changedFiles: Array<String>?): Boolean {
var canExitEarly = false
@Suppress("ReturnCount")
private fun canExitEarly(changedFiles: Array<String>?, syncedFolderID: Long): Boolean {
// If we are in power save mode better to postpone scan and upload
val overridePowerSaving = inputData.getBoolean(OVERRIDE_POWER_SAVING, false)
if ((powerManagementService.isPowerSavingEnabled && !overridePowerSaving)) {
canExitEarly = true
return true
}
if (syncedFolderID < 0) {
Log_OC.d(TAG, "File-sync kill worker since no valid syncedFolderID provided!")
return true
}
// or sync worker already running and no changed files to be processed
val alreadyRunning = backgroundJobManager.bothFilesSyncJobsRunning()
val alreadyRunning = backgroundJobManager.bothFilesSyncJobsRunning(syncedFolderID)
if (alreadyRunning && changedFiles.isNullOrEmpty()) {
Log_OC.d(TAG, "File-sync kill worker since another instance of the worker seems to be running already!")
canExitEarly = true
Log_OC.d(TAG, "File-sync kill worker since another instance of the worker ($syncedFolderID) seems to be running already!")
return true
}
if (!syncedFolderProvider.syncedFolders.any { it.isEnabled }) {
Log_OC.d(TAG, "File-sync kill worker since no sync folder is enabled!")
canExitEarly = true
val syncedFolderTmp = syncedFolderProvider.getSyncedFolderByID(syncedFolderID)
if (syncedFolderTmp == null || !syncedFolderTmp.isEnabled || !syncedFolderTmp.isExisting) {
Log_OC.d(TAG, "File-sync kill worker since syncedFolder (${syncedFolderID}) is not enabled!")
return true
}
syncedFolder = syncedFolderTmp
if (syncedFolderProvider.syncedFolders.all { it.isChargingOnly } &&
if (syncedFolder.isChargingOnly &&
!powerManagementService.battery.isCharging &&
!powerManagementService.battery.isFull
) {
Log_OC.d(TAG, "File-sync kill worker since phone is not charging!")
canExitEarly = true
Log_OC.d(TAG, "File-sync kill worker since phone is not charging (${syncedFolder.localPath})!")
return true
}
return canExitEarly
return false
}
@Suppress("MagicNumber")
override fun doWork(): Result {
backgroundJobManager.logStartOfWorker(BackgroundJobManagerImpl.formatClassTag(this::class))
Log_OC.d(TAG, "File-sync worker started")
val syncFolderId = inputData.getLong(SYNCED_FOLDER_ID, -1)
val changedFiles = inputData.getStringArray(CHANGED_FILES)
if (canExitEarly(changedFiles)) {
backgroundJobManager.logStartOfWorker(BackgroundJobManagerImpl.formatClassTag(this::class)+"_"+syncFolderId)
Log_OC.d(TAG, "File-sync worker started for folder ID: $syncFolderId")
if (canExitEarly(changedFiles, syncFolderId)) {
val result = Result.success()
backgroundJobManager.logEndOfWorker(BackgroundJobManagerImpl.formatClassTag(this::class), result)
return result
@ -137,7 +120,7 @@ class FilesSyncWork(
val resources = context.resources
val lightVersion = resources.getBoolean(R.bool.syncedFolder_light)
FilesSyncHelper.restartJobsIfNeeded(
FilesSyncHelper.restartUploadsIfNeeded(
uploadsStorageManager,
userAccountManager,
connectivityService,
@ -145,9 +128,9 @@ class FilesSyncWork(
)
// Get changed files from ContentObserverWork (only images and videos) or by scanning filesystem
Log_OC.d(TAG, "File-sync worker changed files from observer: " + changedFiles.contentToString())
Log_OC.d(TAG, "File-sync worker (${syncedFolder.remotePath}) changed files from observer: " + changedFiles.contentToString())
collectChangedFiles(changedFiles)
Log_OC.d(TAG, "File-sync worker finished checking files.")
Log_OC.d(TAG, "File-sync worker (${syncedFolder.remotePath}) finished checking files.")
// Create all the providers we'll need
val filesystemDataProvider = FilesystemDataProvider(contentResolver)
@ -155,26 +138,17 @@ class FilesSyncWork(
val dateFormat = SimpleDateFormat("yyyy:MM:dd HH:mm:ss", currentLocale)
dateFormat.timeZone = TimeZone.getTimeZone(TimeZone.getDefault().id)
// start upload of changed / new files
val syncedFolders = syncedFolderProvider.syncedFolders
for ((index, syncedFolder) in syncedFolders.withIndex()) {
updateForegroundWorker(
(50 + (index.toDouble() / syncedFolders.size.toDouble()) * 50).toInt(),
changedFiles.isNullOrEmpty()
)
if (syncedFolder.isEnabled) {
syncFolder(
context,
resources,
lightVersion,
filesystemDataProvider,
currentLocale,
dateFormat,
syncedFolder
)
}
}
Log_OC.d(TAG, "File-sync worker finished")
syncFolder(
context,
resources,
lightVersion,
filesystemDataProvider,
currentLocale,
dateFormat,
syncedFolder
)
Log_OC.d(TAG, "File-sync worker (${syncedFolder.remotePath}) finished")
val result = Result.success()
backgroundJobManager.logEndOfWorker(BackgroundJobManagerImpl.formatClassTag(this::class), result)
return result
@ -183,13 +157,11 @@ class FilesSyncWork(
@Suppress("MagicNumber")
private fun collectChangedFiles(changedFiles: Array<String>?) {
if (!changedFiles.isNullOrEmpty()) {
FilesSyncHelper.insertChangedEntries(syncedFolderProvider, changedFiles)
FilesSyncHelper.insertChangedEntries(syncedFolder, changedFiles)
} else {
// Check every file in every synced folder for changes and update
// filesystemDataProvider database (potentially needs a long time so use foreground worker)
updateForegroundWorker(5, true)
FilesSyncHelper.insertAllDBEntries(syncedFolderProvider, powerManagementService)
updateForegroundWorker(50, true)
// Check every file in synced folder for changes and update
// filesystemDataProvider database (potentially needs a long time)
FilesSyncHelper.insertAllDBEntries(syncedFolder, powerManagementService)
}
}

View file

@ -161,6 +161,9 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
@Inject
ConnectivityService connectivityService;
@Inject
SyncedFolderProvider syncedFolderProvider;
@Inject PowerManagementService powerManagementService;
@Inject
@ -359,7 +362,8 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
backgroundJobManager,
clock,
viewThemeUtils,
walledCheckCache);
walledCheckCache,
syncedFolderProvider);
initContactsBackup(accountManager, backgroundJobManager);
notificationChannels();
@ -586,7 +590,8 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
final BackgroundJobManager backgroundJobManager,
final Clock clock,
final ViewThemeUtils viewThemeUtils,
final WalledCheckCache walledCheckCache) {
final WalledCheckCache walledCheckCache,
final SyncedFolderProvider syncedFolderProvider) {
updateToAutoUpload();
cleanOldEntries(clock);
updateAutoUploadEntries(clock);
@ -600,12 +605,20 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
}
if (!preferences.isAutoUploadInitialized()) {
backgroundJobManager.startImmediateFilesSyncJob(false, new String[]{});
for (SyncedFolder syncedFolder : syncedFolderProvider.getSyncedFolders()) {
if (syncedFolder.isEnabled()) {
backgroundJobManager.startImmediateFilesSyncJob(syncedFolder.getId() ,false, new String[]{});
}
}
preferences.setAutoUploadInit(true);
}
FilesSyncHelper.scheduleFilesSyncIfNeeded(mContext, backgroundJobManager);
FilesSyncHelper.restartJobsIfNeeded(
for (SyncedFolder syncedFolder : syncedFolderProvider.getSyncedFolders()) {
if (syncedFolder.isEnabled()) {
FilesSyncHelper.scheduleFilesSyncIfNeeded(mContext, syncedFolder.getId(), backgroundJobManager);
}
}
FilesSyncHelper.restartUploadsIfNeeded(
uploadsStorageManager,
accountManager,
connectivityService,

View file

@ -27,6 +27,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Observable;
import javax.annotation.Nullable;
import androidx.annotation.NonNull;
import static com.owncloud.android.datamodel.OCFile.PATH_SEPARATOR;
@ -210,6 +212,29 @@ public class SyncedFolderProvider extends Observable {
}
@Nullable
public SyncedFolder getSyncedFolderByID(Long syncedFolderID) {
SyncedFolder result = null;
Cursor cursor = mContentResolver.query(
ProviderMeta.ProviderTableMeta.CONTENT_URI_SYNCED_FOLDERS,
null,
ProviderMeta.ProviderTableMeta._ID + " =? ",
new String[]{syncedFolderID.toString()},
null
);
if (cursor != null && cursor.getCount() == 1 && cursor.moveToFirst()) {
result = createSyncedFolderFromCursor(cursor);
}
if (cursor != null) {
cursor.close();
}
return result;
}
/**
* Delete all synced folders for an account
*

View file

@ -23,6 +23,7 @@ import com.nextcloud.client.network.ConnectivityService;
import com.nextcloud.client.network.WalledCheckCache;
import com.nextcloud.client.preferences.AppPreferences;
import com.owncloud.android.MainApp;
import com.owncloud.android.datamodel.SyncedFolderProvider;
import com.owncloud.android.datamodel.UploadsStorageManager;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.utils.theme.ViewThemeUtils;
@ -48,6 +49,7 @@ public class BootupBroadcastReceiver extends BroadcastReceiver {
@Inject Clock clock;
@Inject ViewThemeUtils viewThemeUtils;
@Inject WalledCheckCache walledCheckCache;
@Inject SyncedFolderProvider syncedFolderProvider;
/**
* Receives broadcast intent reporting that the system was just boot up. *
@ -68,7 +70,9 @@ public class BootupBroadcastReceiver extends BroadcastReceiver {
backgroundJobManager,
clock,
viewThemeUtils,
walledCheckCache);
walledCheckCache,
syncedFolderProvider
);
MainApp.initContactsBackup(accountManager, backgroundJobManager);
} else {
Log_OC.d(TAG, "Getting wrong intent: " + intent.getAction());

View file

@ -571,7 +571,7 @@ class SyncedFoldersActivity :
}
}
if (syncedFolderDisplayItem.isEnabled) {
backgroundJobManager.startImmediateFilesSyncJob(overridePowerSaving = false)
backgroundJobManager.startImmediateFilesSyncJob(syncedFolderDisplayItem.id ,overridePowerSaving = false)
showBatteryOptimizationInfo()
}
}
@ -702,7 +702,7 @@ class SyncedFoldersActivity :
// existing synced folder setup to be updated
syncedFolderProvider.updateSyncFolder(item)
if (item.isEnabled) {
backgroundJobManager.startImmediateFilesSyncJob(overridePowerSaving = false)
backgroundJobManager.startImmediateFilesSyncJob(item.id, overridePowerSaving = false)
} else {
val syncedFolderInitiatedKey = KEY_SYNCED_FOLDER_INITIATED_PREFIX + item.id
val arbitraryDataProvider =
@ -719,7 +719,7 @@ class SyncedFoldersActivity :
if (storedId != -1L) {
item.id = storedId
if (item.isEnabled) {
backgroundJobManager.startImmediateFilesSyncJob(overridePowerSaving = false)
backgroundJobManager.startImmediateFilesSyncJob(item.id, overridePowerSaving = false)
} else {
val syncedFolderInitiatedKey = KEY_SYNCED_FOLDER_INITIATED_PREFIX + item.id
arbitraryDataProvider.deleteKeyForAccount("global", syncedFolderInitiatedKey)

View file

@ -34,6 +34,8 @@ import com.nextcloud.model.WorkerStateLiveData;
import com.owncloud.android.R;
import com.owncloud.android.databinding.UploadListLayoutBinding;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.datamodel.SyncedFolder;
import com.owncloud.android.datamodel.SyncedFolderProvider;
import com.owncloud.android.datamodel.UploadsStorageManager;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
@ -84,6 +86,9 @@ public class UploadListActivity extends FileActivity {
@Inject
BackgroundJobManager backgroundJobManager;
@Inject
SyncedFolderProvider syncedFolderProvider;
@Inject
LocalBroadcastManager localBroadcastManager;
@ -193,7 +198,11 @@ public class UploadListActivity extends FileActivity {
}
private void refresh() {
backgroundJobManager.startImmediateFilesSyncJob(true,new String[]{});
for (SyncedFolder syncedFolder : syncedFolderProvider.getSyncedFolders()) {
if (syncedFolder.isEnabled()) {
backgroundJobManager.startImmediateFilesSyncJob(syncedFolder.getId(), true, new String[]{});
}
}
if (uploadsStorageManager.getFailedUploads().length > 0) {
new Thread(() -> {
@ -316,10 +325,10 @@ public class UploadListActivity extends FileActivity {
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == FileActivity.REQUEST_CODE__UPDATE_CREDENTIALS && resultCode == RESULT_OK) {
FilesSyncHelper.restartJobsIfNeeded(uploadsStorageManager,
userAccountManager,
connectivityService,
powerManagementService);
FilesSyncHelper.restartUploadsIfNeeded(uploadsStorageManager,
userAccountManager,
connectivityService,
powerManagementService);
}
}
@ -339,10 +348,10 @@ public class UploadListActivity extends FileActivity {
} else {
// already updated -> just retry!
FilesSyncHelper.restartJobsIfNeeded(uploadsStorageManager,
userAccountManager,
connectivityService,
powerManagementService);
FilesSyncHelper.restartUploadsIfNeeded(uploadsStorageManager,
userAccountManager,
connectivityService,
powerManagementService);
}
} else {

View file

@ -146,34 +146,29 @@ public final class FilesSyncHelper {
}
}
public static void insertAllDBEntries(SyncedFolderProvider syncedFolderProvider,
public static void insertAllDBEntries(SyncedFolder syncedFolder,
PowerManagementService powerManagementService) {
for (SyncedFolder syncedFolder : syncedFolderProvider.getSyncedFolders()) {
if (syncedFolder.isEnabled() &&
!(syncedFolder.isChargingOnly() &&
!powerManagementService.getBattery().isCharging() &&
!powerManagementService.getBattery().isFull()
)
) {
insertAllDBEntriesForSyncedFolder(syncedFolder);
}
if (syncedFolder.isEnabled() &&
!(syncedFolder.isChargingOnly() &&
!powerManagementService.getBattery().isCharging() &&
!powerManagementService.getBattery().isFull()
)
) {
insertAllDBEntriesForSyncedFolder(syncedFolder);
}
}
public static void insertChangedEntries(SyncedFolderProvider syncedFolderProvider,
public static void insertChangedEntries(SyncedFolder syncedFolder,
String[] changedFiles) {
final ContentResolver contentResolver = MainApp.getAppContext().getContentResolver();
final FilesystemDataProvider filesystemDataProvider = new FilesystemDataProvider(contentResolver);
for (String changedFileURI : changedFiles){
String changedFile = getFileFromURI(changedFileURI);
for (SyncedFolder syncedFolder : syncedFolderProvider.getSyncedFolders()) {
if (syncedFolder.isEnabled() && syncedFolder.containsFile(changedFile)){
File file = new File(changedFile);
filesystemDataProvider.storeOrUpdateFileValue(changedFile,
file.lastModified(),file.isDirectory(),
syncedFolder);
break;
}
if (syncedFolder.isEnabled() && syncedFolder.containsFile(changedFile)){
File file = new File(changedFile);
filesystemDataProvider.storeOrUpdateFileValue(changedFile,
file.lastModified(),file.isDirectory(),
syncedFolder);
}
}
}
@ -249,10 +244,10 @@ public final class FilesSyncHelper {
}
}
public static void restartJobsIfNeeded(final UploadsStorageManager uploadsStorageManager,
final UserAccountManager accountManager,
final ConnectivityService connectivityService,
final PowerManagementService powerManagementService) {
public static void restartUploadsIfNeeded(final UploadsStorageManager uploadsStorageManager,
final UserAccountManager accountManager,
final ConnectivityService connectivityService,
final PowerManagementService powerManagementService) {
boolean accountExists;
boolean whileChargingOnly = true;
@ -316,8 +311,8 @@ public final class FilesSyncHelper {
}).start();
}
public static void scheduleFilesSyncIfNeeded(Context context, BackgroundJobManager jobManager) {
jobManager.schedulePeriodicFilesSyncJob();
public static void scheduleFilesSyncIfNeeded(Context context, Long syncedFolderID, BackgroundJobManager jobManager) {
jobManager.schedulePeriodicFilesSyncJob(syncedFolderID);
if (context != null) {
jobManager.scheduleContentObserverJob();
}

View file

@ -49,10 +49,10 @@ public final class ReceiversHelper {
DNSCache.clear();
walledCheckCache.clear();
if (connectivityService.getConnectivity().isConnected()) {
FilesSyncHelper.restartJobsIfNeeded(uploadsStorageManager,
accountManager,
connectivityService,
powerManagementService);
FilesSyncHelper.restartUploadsIfNeeded(uploadsStorageManager,
accountManager,
connectivityService,
powerManagementService);
}
}
};
@ -76,10 +76,10 @@ public final class ReceiversHelper {
@Override
public void onReceive(Context context, Intent intent) {
if (Intent.ACTION_POWER_CONNECTED.equals(intent.getAction())) {
FilesSyncHelper.restartJobsIfNeeded(uploadsStorageManager,
accountManager,
connectivityService,
powerManagementService);
FilesSyncHelper.restartUploadsIfNeeded(uploadsStorageManager,
accountManager,
connectivityService,
powerManagementService);
}
}
};
@ -102,10 +102,10 @@ public final class ReceiversHelper {
@Override
public void onReceive(Context context, Intent intent) {
if (!powerManagementService.isPowerSavingEnabled()) {
FilesSyncHelper.restartJobsIfNeeded(uploadsStorageManager,
accountManager,
connectivityService,
powerManagementService);
FilesSyncHelper.restartUploadsIfNeeded(uploadsStorageManager,
accountManager,
connectivityService,
powerManagementService);
}
}
};