Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2018-01-04 22:22:30 +01:00
parent b4d6545971
commit 8a865ee638
2 changed files with 4 additions and 2 deletions

View file

@ -396,6 +396,7 @@ public class FileUploader extends Service
currentAccount = failedUpload.getAccount(context);
}
charging = charging || Device.getBatteryStatus(context).getBatteryPercent() == 1;
if (!isPowerSaving && gotNetwork && checkIfUploadCanBeRetried(failedUpload, gotWifi, charging)) {
retry(context, currentAccount, failedUpload);
}
@ -942,7 +943,7 @@ public class FileUploader extends Service
cancel(mCurrentUpload.getAccount().name, mCurrentUpload.getFile().getRemotePath()
, ResultCode.DELAYED_FOR_WIFI);
} else if (mCurrentUpload.getIsChargingRequired() &&
!Device.getBatteryStatus(MainApp.getAppContext()).isCharging()) {
(!Device.getBatteryStatus(MainApp.getAppContext()).isCharging())) {
cancel(mCurrentUpload.getAccount().name, mCurrentUpload.getFile().getRemotePath()
, ResultCode.DELAYED_FOR_CHARGING);
} else if (!mCurrentUpload.getIsIgnoringPowerSaveMode() &&

View file

@ -354,7 +354,8 @@ public class UploadFileOperation extends SyncOperation {
}
// Check if charging conditions are met and delays the upload otherwise
if (mWhileChargingOnly && !Device.getBatteryStatus(mContext).isCharging()) {
if (mWhileChargingOnly && (!Device.getBatteryStatus(mContext).isCharging() && Device.getBatteryStatus
(mContext).getBatteryPercent() < 1)) {
Log_OC.d(TAG, "Upload delayed until the device is charging: " + getRemotePath());
return new RemoteOperationResult(ResultCode.DELAYED_FOR_CHARGING);
}